#asahi-gpu · 2021-04-12 01:29
dougallah, that makes sense, thanks#asahi-gpu · 2021-04-12 01:24
dougallwhat does 'keyed to formats' mean?#asahi-gpu · 2021-04-12 01:14
dougalllooks great!#asahi-gpu · 2021-04-12 00:32
dougallhaha nice!#asahi-gpu · 2021-04-12 00:29
dougallbut yeah, it's a nice self-contained challenge for anyone interested in numerics if people want to try :)#asahi-gpu · 2021-04-12 00:28
dougallyeah, maybe 1 is the way to go for now? (i do have a script that i have technically done something like this with, but it'll be a lot easier once we've made more progress on everything else)#asahi-gpu · 2021-04-11 23:17
dougallah yeah, great find on i/u2! i think that makes sense#asahi-gpu · 2021-04-11 23:15
dougallbloom: A vs At etc is arbitrary, as you say, i just wanted to have splitting in one place, and try to separate 'instruction' from 'data' in the bit diagram (A can be a literal immediate, although also sometimes the low bit indicates whether or not the reg is 64-bit, so it's not perfect)#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 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: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: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: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
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:30
dougallhahaha#asahi-gpu · 2021-04-11 03:29
dougall'full * analysis' does sound optimal, but that mostly goes over my head - is that the uniform hoisting optimisation thing?#asahi-gpu · 2021-04-11 03:25
dougallhaha yep#asahi-gpu · 2021-04-11 03:25
dougall(you can only update r0l on threads that are active, which is either obvious or confusing)#asahi-gpu · 2021-04-11 03:23
dougallyeah - break is the only place i've seen that done, but that was really helpful to figure out what on earth was going on#asahi-gpu · 2021-04-11 03:23
dougallnot sure about "continue"/"else" though#asahi-gpu · 2021-04-11 03:22
dougallyeah break and loop aren't bad (if you look at metal compiler output)... break is an icmpsel to r0l then pop_exec 0 (to update execmask)#asahi-gpu · 2021-04-11 03:16
dougall(i don't know if apple compiler implementation specific stuff belongs in the docs, but the fact that you kind of have to re-structure your cfg to compile C was an intuition of Erika's that i didn't have at all)#asahi-gpu · 2021-04-11 03:12
dougallyeah, it's a bit crazy - did you see this thread? (scroll up) https://twitter.com/dougallj/status/1361063810493083648#asahi-gpu · 2021-04-11 03:08
dougallhahaha#asahi-gpu · 2021-04-11 03:06
dougalli like less magic, i like declarative descriptions, and either will potentially have to be updated as r/e progresses#asahi-gpu · 2021-04-11 03:04
dougallyeah - it's definitely a strange challenge - after thinking on it, i don't have a clear opinion either way...#asahi-gpu · 2021-04-11 02:50
dougallyeah, the python definitely feels like a bad fit for mesa - i hadn't seen isaspec, but it sounds like it has the right goals... hmm#asahi-gpu · 2021-04-11 02:44
dougallhaha yeah, applegpu.py doesn't feel Right either - i'd like to rewrite it a bit more deliberately, but it's enough to make RE and doc progress for now#asahi-gpu · 2021-04-11 02:16
dougall(i'll try to remember what i was doing and make a little progress on memory ops today)#asahi-gpu · 2021-04-11 02:14
dougallbloom: oh, wow, that's awesome! fun to see how the goal of generating html turned into the possiblity of generating xml/c#asahi-gpu · 2021-04-10 22:40
dougallDarkShadow44: good catch, thanks - i'll try to look later today, but i'm guessing 0b00 is the correct encoding there https://github.com/dougallj/applegpu/blob/main/applegpu.py#L859-L860#asahi-gpu · 2021-04-04 03:36
dougallDarkShadow44: yeah, that table was just generated by asking the gpu to convert all 256 values#asahi-gpu · 2021-03-21 11:56
dougallheh - yeah, iirc they just use a couple of (hopefully) uninteresting instructions i haven't named yet, so it might be a good beginner instruction to re#asahi-gpu · 2021-03-21 11:56
dougallheh - yeah, iirc they just use a couple of (hopefully) uninteresting instructions i haven't named yet, so it might be a good beginner instruction to re#asahi-gpu · 2021-03-21 06:01
dougallhmm, not that springs to mind... maybe the instructions that implement fast sin/cos, or simd-group ops like 'call/ret' and 'simd_shuffle_down'#asahi-gpu · 2021-03-21 06:01
dougallhmm, not that springs to mind... maybe the instructions that implement fast sin/cos, or simd-group ops like 'call/ret' and 'simd_shuffle_down'#asahi-gpu · 2021-03-21 02:27
dougall(command to compile it is in a comment at the top of that file - sorry if that's pointing out the obvious, but i missed it myself)#asahi-gpu · 2021-03-21 02:27
dougall(command to compile it is in a comment at the top of that file - sorry if that's pointing out the obvious, but i missed it myself)#asahi-gpu · 2021-03-21 02:26
dougallah, yeah (heh, neither of those pings worked) - I use https://github.com/Thog/gpu/blob/metallib/metal_compiler.m which calls [MTLDynamicLibrary serializeToURL:...] to generate it#asahi-gpu · 2021-03-21 02:26
dougallah, yeah (heh, neither of those pings worked) - I use https://github.com/Thog/gpu/blob/metallib/metal_compiler.m which calls [MTLDynamicLibrary serializeToURL:...] to generate it#asahi-gpu · 2021-03-21 01:38
dougall(or, if I'm understanding correctly, I think they're usually given to the driver as LLVM IR? which it specialises because it knows "this is a top level compute or whatever function"? but that's mainly based on having used those two tools on the same functions and seen the code differences, so I'm not sure)#asahi-gpu · 2021-03-21 01:38
dougall(or, if I'm understanding correctly, I think they're usually given to the driver as LLVM IR? which it specialises because it knows "this is a top level compute or whatever function"? but that's mainly based on having used those two tools on the same functions and seen the code differences, so I'm not sure)#asahi-gpu · 2021-03-21 01:33
dougalland yeah, no idea - i don't really know how metal works, sorry#asahi-gpu · 2021-03-21 01:33
dougalland yeah, no idea - i don't really know how metal works, sorry#asahi-gpu · 2021-03-21 01:31
dougall(i got it working with an old revision of asahilinux/gpu and never updated - iirc one of these hardcoded offsets worked for me https://github.com/AsahiLinux/gpu/blob/b9591908e19a737aaa60c28619fbd39a091ce0f1/wrap/wrap.c#L143 )#asahi-gpu · 2021-03-21 01:31
dougall(i got it working with an old revision of asahilinux/gpu and never updated - iirc one of these hardcoded offsets worked for me https://github.com/AsahiLinux/gpu/blob/b9591908e19a737aaa60c28619fbd39a091ce0f1/wrap/wrap.c#L143 )#asahi-gpu · 2021-03-21 01:29
dougalli'm like 90% sure - yeah - the tricky bit is it'll dump code for about six other different shaders and you have to find the code you care aboout at some offset in one of the dumped mappings...#asahi-gpu · 2021-03-21 01:29
dougalli'm like 90% sure - yeah - the tricky bit is it'll dump code for about six other different shaders and you have to find the code you care aboout at some offset in one of the dumped mappings...#asahi-gpu · 2021-03-21 01:24
dougall(e.g. it'll never use the discard hint, as it can't assume all threads are active when the library function is called)#asahi-gpu · 2021-03-21 01:24
dougall(e.g. it'll never use the discard hint, as it can't assume all threads are active when the library function is called)