#asahi-gpu · 2021-04-11 03:33
bloomif (varying) { expensive() } ----> if_icmp / expensive() / pop_exec#asahi-gpu · 2021-04-11 03:32
bloomAlthough I'm not actually seeing a good way to use that info here, hm.#asahi-gpu · 2021-04-11 03:32
bloom(Most obvious case is "if (uniform) { .. }" but also less obviously "if (ballot(..)) { ... }"#asahi-gpu · 2021-04-11 03:31
bloomBut if we can prove at compile-time that all the threads in a given SIMD group will branch together, there's often optimizations to be had#asahi-gpu · 2021-04-11 03:30
bloomAll the silliness is needed for divergent (data-dependent) branches "if (some_varying) { ... }"#asahi-gpu · 2021-04-11 03:30
dougallhahaha#asahi-gpu · 2021-04-11 03:30
bloom"Divergence analysis" ~~calculates the sums of partial derivatives of a vector field~~ determines what values might differ across threads in a SIMD gorup#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:28
bloomtries to come up with example#asahi-gpu · 2021-04-11 03:28
bloom(I think)#asahi-gpu · 2021-04-11 03:27
bloomsomething else that may be either obvious or confusing -- for optimal perf, the compiler needs to do full divergence analysis#asahi-gpu · 2021-04-11 03:25
bloomall of this seems both intuitively obvious and completely impossible to wrap my head around :-p#asahi-gpu · 2021-04-11 03:25
dougallhaha yep#asahi-gpu · 2021-04-11 03:25
bloomcan it be both obvious and confusing?#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
bloomoh, you can update r0l directly, right :p#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:20
bloomloop { ... } I guess is just `*: ...; jmp_exec_any *`#asahi-gpu · 2021-04-11 03:19
krbtgtWRT the earlier convo on basically starting with GPU RE; it is tricky for sure, and i'm certainly an idiot at it. me and a friend were looking at REing ancient SGI GPUs and we found a few quite things out but didn't get as far as say disassembly#asahi-gpu · 2021-04-11 03:19
bloomif { ..} corresponds naturally to if_cmp/pop_exec.. the other 3 not so much#asahi-gpu · 2021-04-11 03:18
bloom(Basically we get `if { ... }` `loop { .. }` `break` and `continue` and that's it. while loops become things like `loop { if not cond { break } .. }`#asahi-gpu · 2021-04-11 03:17
bloomThe CFG we get from NIR is very simple, which is great for normal hw with actual branch instructions, but...#asahi-gpu · 2021-04-11 03:17
bloomI expect this will have big implications on how the IR will be structured#asahi-gpu · 2021-04-11 03:16
bloomnods#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:13
bloomoh!#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:11
bloomtries to wrap her head around apple control flow#asahi-gpu · 2021-04-11 03:10
bloomsrs :(#asahi-gpu · 2021-04-11 03:08
dougallhahaha#asahi-gpu · 2021-04-11 03:08
bloom"i like less magic, i like declarative descriptions," unfortunately writing in languages designed in the 70s means these are mutually ^#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 03:04
bloomthere's likely a healthy balance..#asahi-gpu · 2021-04-11 02:58
bloomfor hw with an active r/e effort, that may backfire. otoh, being bale to add instructions easily matters far more for r/e!#asahi-gpu · 2021-04-11 02:57
bloomfor the compilers at work, I have full visibility into the ISA so I can do proper top-down design.. so having one master ISA.xml that everything is generated from works well#asahi-gpu · 2021-04-11 02:56
bloomthere's also a question of what level of magic is appropraite#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:48
bloombut not sure if there's much point in defining an intermediate XML schema for the sake of it, or trying to wire up robclark's isaspec (which will have impedance mismatches of its own)#asahi-gpu · 2021-04-11 02:47
bloomJust want the actual encoding details, so then we can spit out C code to do what we need#asahi-gpu · 2021-04-11 02:47
bloomI suspect we don't want emulation, or the Python disasm/asm stack, in Mesa.#asahi-gpu · 2021-04-11 02:46
bloomnod#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:39
bloomI suspect whatever I did today is Not it#asahi-gpu · 2021-04-11 02:39
bloomdougall: yeah, still trying to figure out the Right way to approach it is#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)