#asahi-gpu · 2021-04-17 02:08
bloombut that might not be the allocation of threads#asahi-gpu · 2021-04-17 02:08
bloomGranularity of 4 is almost certainly the allocation of registers#asahi-gpu · 2021-04-17 02:08
bloomPossibly, possibly not.#asahi-gpu · 2021-04-17 02:01
bloom"the shader cores... feature a constant execution and prefetch"#asahi-gpu · 2021-04-17 01:58
bloomhttps://metalkit.org/2020/07/03/wwdc20-whats-new-in-metal.html has some goodies.#asahi-gpu · 2021-04-17 01:57
bloom"Advanced Metal Shader Optimization" from WWDC'16 is still relevant :)#asahi-gpu · 2021-04-17 01:55
bloomOh, even better maxTotalThreadsPerThreadgroup is literally in the Metal API. nice!#asahi-gpu · 2021-04-17 01:48
bloomSo it ought to be able to figure out from the other direction like you've done with the cpu?#asahi-gpu · 2021-04-17 01:48
bloomBut! Apple docs talk about occupancy perf counters?#asahi-gpu · 2021-04-17 01:48
bloomThe cmdstream just specifies register count/4, but that seems more fine grained than real hw would implement#asahi-gpu · 2021-04-17 01:47
bloomI'd like to know what the thresholds are for register usage --> thread occupancy#asahi-gpu · 2021-04-17 01:47
bloomdougall: hey, I have a reversing question for you#asahi-gpu · 2021-04-17 01:42
bloompiles of ALU#asahi-gpu · 2021-04-16 22:46
bloomI would expect if you have fast imprecise transcendentals available, you'd use them and feed the estimate into Newton's method or something#asahi-gpu · 2021-04-16 22:46
bloomwhat's more interesting to me is that they don't use the fast sine anywhere in it#asahi-gpu · 2021-04-16 22:45
bloomthat it is..#asahi-gpu · 2021-04-16 21:27
bloomdefault in Metal is fast::sin(x) which is super cheap#asahi-gpu · 2021-04-16 21:19
bloom(~90 instructions)#asahi-gpu · 2021-04-16 21:18
bloomThe assembly prduced for precise::sin(x) is horrifying#asahi-gpu · 2021-04-16 20:13
bloom(was trying to find out if there's an xchg/swap instruction)#asahi-gpu · 2021-04-16 20:12
bloomDunno if that's deliberate.#asahi-gpu · 2021-04-16 20:12
bloomnote: Metal compiler likes bitop_mov more than xor#asahi-gpu · 2021-04-16 19:57
bloomalso, modifiers are unsupported (both float and int mods)#asahi-gpu · 2021-04-16 19:57
bloomto change sizes, iadd/fadd are used.#asahi-gpu · 2021-04-16 19:57
bloomnote to self: `convert` is only for data type converts#asahi-gpu · 2021-04-16 19:39
bloomInteresting... Metal implements unary fneg/fabs with bitop (twiddling the sign bit) instead of fadd.#asahi-gpu · 2021-04-16 03:57
bloomwill test tomorrow 😴#asahi-gpu · 2021-04-16 03:56
bloom" wrote a proper C encoder#asahi-gpu · 2021-04-16 03:56
bloomdougall: "# okay, this is very lazy#asahi-gpu · 2021-04-16 03:09
bloomso now all the known float ops are handled#asahi-gpu · 2021-04-16 03:09
bloomand implemented in the compiler :)#asahi-gpu · 2021-04-16 00:43
bloom:)#asahi-gpu · 2021-04-15 21:50
bloomsimilarly interesting patterns with depth/stencil writeouts, et#asahi-gpu · 2021-04-15 21:50
bloomand if you look at how MRT writeout works you can see a pair of bits moving along in those unk48 ("writeout" in dougall's)#asahi-gpu · 2021-04-15 21:49
bloomI *suspect* that controls some detail of the tilebuffer#asahi-gpu · 2021-04-15 21:49
bloomyep..#asahi-gpu · 2021-04-15 18:21
bloom(Up to constants, sin_pt_2 is the "sinc" function.)#asahi-gpu · 2021-04-15 18:18
bloomAnd that's how AGX computes sine and cosine!#asahi-gpu · 2021-04-15 18:17
bloom(This requires the value to be finite, since Inf * 0 and NaN * 0 are both NaN under standard IEEE 754 rules.)#asahi-gpu · 2021-04-15 18:16
bloom(Is sin_pt_2(0) undefined? Maybe, maybe not. It doesn't matter, as long as it's value satisfies sin_pt_2(0) * 0 = 0 since sin(0) = 0.)#asahi-gpu · 2021-04-15 18:15
bloomsin_pt_2(x) = sin((pi/2) * |x|) / |x|#asahi-gpu · 2021-04-15 18:15
bloomAs well as:#asahi-gpu · 2021-04-15 18:15
bloom{ fract(x) - 1 if 3 <= x < 4#asahi-gpu · 2021-04-15 18:15
bloom{ - fract(x) if 2 <= x < 3#asahi-gpu · 2021-04-15 18:15
bloom{ 1 - fract(x) if 1 <= x < 2#asahi-gpu · 2021-04-15 18:14
bloom{ fract(x) if 0 <= x < 1#asahi-gpu · 2021-04-15 18:14
bloomsin_pt_1(x) =#asahi-gpu · 2021-04-15 18:14
bloomOr more clearly:#asahi-gpu · 2021-04-15 18:14
bloom{ x - 4 if 3 <= x < 4#asahi-gpu · 2021-04-15 18:14
bloom{ 2 - x if 2 <= x < 3