2021-04-15
00:02vlixa has quit [Remote host closed the connection]
00:02bloomif you want to know what my reference point for regularity is i'll link you the bifrost encoding :p
00:06dougallyeah, they could definitely be worse - i'm just thinking of moving the Am/Bm/Cm field relative to their 32-bit equivalents (why did they do that?), and the fact that 32-bit ops can have 16-bit sources and destinations too
00:11bloomThe 32-bit ops are heavier weight. Yes, you _can_ run a fadd.32 with all operands 16-bit, but that will (depending on uarch details that are not ISA visible) be slower or higher power.
00:11bloomIt's fundamentally a different operation. Convert, fp32 multiply, convert, versus fp16 multiply. The latter is much cheaper. (The converts are cheap regardless.)
00:13bloomon some arches, fp16 multiply is even vectorized (where fp32 is scalar, conversions be damned)
00:27dougallyeah, C is particularly painful for that... i'd probably use __int128, and i'd probably end up regretting it :p
01:38odmir has joined #asahi-gpu
01:42odmir has quit [Ping timeout: 240 seconds]
01:56vijfhoek has quit [Ping timeout: 246 seconds]
01:56vijfhoek has joined #asahi-gpu
01:57anuejn has quit [Ping timeout: 246 seconds]
01:58anuejn has joined #asahi-gpu
02:16bloomIt's like it's supposed to be a 48-bit instruction and they added an extra 2 bytes of padding for no reason? what?
02:17dougallfwiw i saw apple's compiler emit 64-bit subtracts and 64-bit add+shift, but (as far as i can recall) not 64-bit adds
02:21dougallyeah, not sure what's up with that encoding... i do think there's _something_ in the high couple of bits in most/all instructions that i haven't figured out, which might make it make a tiny bit more sense
02:24TheJollyRoger has quit [Quit: TheJollyRoger]
02:24TheJollyRoger has joined #asahi-gpu
02:29Necrosporus has quit [Killed (beckett.freenode.net (Nickname regained by services))]
02:29Necrosporus has joined #asahi-gpu
02:35Necrosporus has quit [Killed (verne.freenode.net (Nickname regained by services))]
02:35Necrosporus has joined #asahi-gpu
02:52dougall(or maybe i was trying to say that immediates don't get sign extended? not really the best way to represent that... hmm)
02:52phiologe has quit [Ping timeout: 250 seconds]
02:55phiologe has joined #asahi-gpu
05:35pthariensflame has joined #asahi-gpu
05:42pthariensflame has quit []
05:46bpye has quit [Quit: The Lounge - https://thelounge.chat]
05:47bpye has joined #asahi-gpu
07:04vlixa has joined #asahi-gpu
08:41bpye has quit [Quit: Ping timeout (120 seconds)]
08:42bpye has joined #asahi-gpu
09:00Bastian[m] has quit [Quit: Idle for 30+ days]
09:08neobrain has quit [Remote host closed the connection]
09:12Bastian[m] has joined #asahi-gpu
11:09gabboman has joined #asahi-gpu
11:21gabboman has quit [Quit: Ping timeout (120 seconds)]
12:31gabboman has joined #asahi-gpu
12:39gabboman has quit [Quit: Connection closed]
14:45tomtastic has quit [Ping timeout: 240 seconds]
14:49tomtastic has joined #asahi-gpu
15:20vup has quit [Ping timeout: 245 seconds]
15:20vup has joined #asahi-gpu
16:50chrisf has quit [Quit: ZNC - https://znc.in]
16:54chrisf has joined #asahi-gpu
17:17odmir has joined #asahi-gpu
18:03bloomThe heavylifting is done by sin_pt_2. However, the function it computes is *not* sin(x), rather it's sin(x)/x
18:04bloomBut it only computes in a single quadrant. So given 0 <= x < 1, it'll spit back sin(x * (pi/2)) / x
18:05bloomNotice that's an even function. So sin_pt_2 is in fact defined over [-1, 1], but it ignores the sign bit of its input.
18:06bloomThis is a useful property: it lets sin_pt_1 pass the sign of the output over the sin_pt_2 call, to be recombined with a later multiplication.
18:08bloomFor x in the first quadrant, it's simply the identity. sin_pt_2 is defined as such, so when we compute sin_pt_2(sin_pt_1(x)) * sin_pt_1(x) we're just computing sine.
18:09bloomFor x in the third quadrant, recall sin(x + pi) = -sin(x). So sin_pt_2 will just flip the sign, so we can compute in the first quadrant (pt_2), and then the sign gets restored with the multiply.
18:11bloomFor xin the second quadrant, recall sin(x + pi/2) = cos(x) = sin(pi/2 - x). So rather than flip the sign, we take the arithmetic complement.
18:12bloomThe last detail I glossed is the units. sin_pt_2 wants its angle as [-1, 1] but sin_pt_1 takes in a rotation [0, 4]. This doesn't affect any of the math, but it means the constants work out to nice integers.
18:16bloom(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.)
18:17bloom(This requires the value to be finite, since Inf * 0 and NaN * 0 are both NaN under standard IEEE 754 rules.)
20:04odmir has quit [Remote host closed the connection]
20:05odmir has joined #asahi-gpu
20:07nickiminjaj has joined #asahi-gpu
20:10odmir has quit [Ping timeout: 260 seconds]
20:11robinp has quit [Read error: Connection reset by peer]
20:14robinp has joined #asahi-gpu
20:21odmir has joined #asahi-gpu
20:26odmir has quit [Ping timeout: 268 seconds]
20:37odmir has joined #asahi-gpu
20:57odmir has quit [Ping timeout: 240 seconds]
21:11odmir has joined #asahi-gpu
21:50bloomand if you look at how MRT writeout works you can see a pair of bits moving along in those unk48 ("writeout" in dougall's)
21:56pthariensflame has joined #asahi-gpu
21:57pthariensflame has quit [Client Quit]
22:21chrisf has quit [Quit: ZNC - https://znc.in]
22:25chrisf has joined #asahi-gpu
23:06odmir has quit [Remote host closed the connection]
23:07odmir has joined #asahi-gpu
23:12odmir has quit [Ping timeout: 268 seconds]
23:38odmir has joined #asahi-gpu