#asahi-gpu · 2021-04-11 18:16
DarkShadow44heh, wishing you the best of luck! :)#asahi-gpu · 2021-04-11 18:11
glibctaking humble baby steps, but yeah#asahi-gpu · 2021-04-11 18:10
DarkShadow44I take it, you're also trying to re the ISA?#asahi-gpu · 2021-04-11 18:05
glibccool, that's exactly what I wanted. (I was still missing a clean method for extracting the raw payload)#asahi-gpu · 2021-04-11 18:04
DarkShadow44FWIW, I just copied that - but also integrated it into my tool - so you can just feed it source and it outputs disassembly#asahi-gpu · 2021-04-11 18:03
glibcno, I wasn't aware of this -- but this looks quite nice :) Thanks for the link.#asahi-gpu · 2021-04-11 17:57
DarkShadow44glibc: Alright, otherwise I could have offered you my version. Do you also use this code https://github.com/DarkShadow44/AsahiLinux-gpu/blob/asmtool/asmtool/asmtool/metallib.c ?#asahi-gpu · 2021-04-11 17:51
glibcI wanted a .metal -> .disasm workflow, which I now have :)#asahi-gpu · 2021-04-11 17:33
DarkShadow44glibc: What exactly do you want to do?#asahi-gpu · 2021-04-11 16:33
glibcI guess I can build an binary archive and serialize it, but I wonder if there is an easier way to get the raw compiled binaries.#asahi-gpu · 2021-04-11 16:06
bloom....why is `stac_adjust/stack_store/stack_load` the fastest way to convert i32 to u8norm...#asahi-gpu · 2021-04-11 16:03
bloom"Ewwwwwwww" was at AGX architecturally lacking support for basic vertex attributes.#asahi-gpu · 2021-04-11 15:55
bloomand then the load 1 can be pipelined with the `do something with 0`#asahi-gpu · 2021-04-11 15:55
bloom`load 0, load 1, wait 0, do something with 0, wait 1, do something with 1`#asahi-gpu · 2021-04-11 15:55
bloomso the metal compiler can output code like#asahi-gpu · 2021-04-11 15:55
bloomto allow a more fine grained scoreboarding#asahi-gpu · 2021-04-11 15:55
bloomdougall: not sure if you've figured this out yet, but it looks like the `i` bit on wait corresponds to the `u2` immediate on device_Load#asahi-gpu · 2021-04-11 15:52
bloomEwwwwwwww#asahi-gpu · 2021-04-11 15:10
bloomThe ISA is regular enough and RA requirements simple enough it should be doable#asahi-gpu · 2021-04-11 15:10
bloomintends on a full SSA backend compiler#asahi-gpu · 2021-04-11 14:51
glibcramping up on Metal... I can compile .metallib files, which I understand are LLVM IR containers. I can compile them in a metal app; how can I get the output binary?#asahi-gpu · 2021-04-11 14:49
bloomYou really need push_exec in general, unless you can gurantee no divergence#asahi-gpu · 2021-04-11 14:48
bloomdougall: After giving it some thought last night i believe this would work, but it would break if there was something after the loop before the else, etc#asahi-gpu · 2021-04-11 04:24
dougallhmm - i want to write an emulator to test that, although i guess i kinda did (maybe? i don't think i implemented jumps)... but yeah, i can't be sure either way at a glance#asahi-gpu · 2021-04-11 04:21
bloomactualy, is it?#asahi-gpu · 2021-04-11 04:16
bloombut I fully expect even if this works, it's a hack#asahi-gpu · 2021-04-11 04:15
bloomif_icmp 1; * icmpsel r0l, #2, #0; update_exec; ....; jmp_exec_any *; else_cmp 1; ...; pop_exec 2;#asahi-gpu · 2021-04-11 04:14
bloomdougall: for that particular example, I think you could do:#asahi-gpu · 2021-04-11 03:56
bloomtries on pen/paper#asahi-gpu · 2021-04-11 03:56
bloompeeling that back to Metal idioms will be one of the more memorable parts of compiler bringup ;)#asahi-gpu · 2021-04-11 03:56
bloomso in NIR, we'd have `if { loop { if { break } foo } else { bar }`,#asahi-gpu · 2021-04-11 03:56
bloomnod#asahi-gpu · 2021-04-11 03:55
dougallyeah - it wasn't easy figuring out what these instruction do, but figuring out how to use them from what they do feels trickier (using metal compiler idioms seems easier, but it'd be good to understand it properly)#asahi-gpu · 2021-04-11 03:51
bloomyikes, ok, right. thanks, knew I was doing something wrong#asahi-gpu · 2021-04-11 03:51
bloomohhhh#asahi-gpu · 2021-04-11 03:50
dougall(yeah, icmpsel #1 is more like a break than an 'if' - like if you have "if { your while } else { foo }" the "1"s and the else threads have the same value)#asahi-gpu · 2021-04-11 03:50
bloompush_exec isn't documented but that's just a special case of if_icmp, ok#asahi-gpu · 2021-04-11 03:49
bloomthe last pop should've been n=1, sorry#asahi-gpu · 2021-04-11 03:48
dougallyeah - it's not entirely clear in my mind... I think their while loop codegen starts with a push_exec 2... you're missing an initial push/final pop of some kind#asahi-gpu · 2021-04-11 03:48
bloomif icmpsel runs on a thread, by definition r0l = 0, so that's fine#asahi-gpu · 2021-04-11 03:47
bloomer is it?#asahi-gpu · 2021-04-11 03:47
bloomoh but that's broken for nested loops#asahi-gpu · 2021-04-11 03:45
bloomseems a very natural translation#asahi-gpu · 2021-04-11 03:45
bloomwhile(x) { ... } ---> start: icmpsel r0l, x, #0, #1; pop_exec 0; jmp_exec_none end; ....; jmp_exec_any start; pop_exec 0;#asahi-gpu · 2021-04-11 03:43
bloomI still don't see what while_*cmp is for#asahi-gpu · 2021-04-11 03:42
dougall(i should look into how they handle convergence (ballot/etc) more - it does sound like an optimisation oportunity, and maybe i'm missing some instructions/flags there)#asahi-gpu · 2021-04-11 03:36
bloom^ indeed, and more aggressively than any other gpu i've played with#asahi-gpu · 2021-04-11 03:36
dougallyeah jmp_exec_none/any are the only conditional branches i know of, which should benefit from uniformity either way... but apple does love proving things are uniform and hoisting them into a shader that only runs once#asahi-gpu · 2021-04-11 03:35
bloomThis doesn't really prove anything since the latter compile is always legal, just not always optimal.#asahi-gpu · 2021-04-11 03:33
bloomif (uniform) { expensive() } ----> if_icmp / jmp_exec_none * / expensive() / * pop_exec