10:30karolherbst: is frcp of Infinity well defined in nir?
10:33karolherbst: like I have code that relies on it to return 0, but I'm seeing NaN on asahi
10:33karolherbst: so I'm wondering if I need to handle it in the frontend, or if that's technically a driver issue
10:36glehmann: it is well defined, frcp(Inf) is +0.0 and frcp(-Inf) is -0.0
10:36glehmann: frcp should never return NaN if the input is not NaN
10:42karolherbst: okay.. I'm having this shader and it's returning me Nan for Inf: https://gist.github.com/karolherbst/81013dc60d678891dc2e46a23e4b87a6 already tried slapping more preserve inf/nan everywhere, but I suspect it's the frcp doing it
10:43karolherbst: or maybe it's the iand/ior.. I'll have to dig deeper I guess
10:43karolherbst: it gives me the correct result on llvmpipe at least...
11:01glehmann: likely not the source of your issue, but why are you testing infinity without preserve-inf float controls?
12:15karolherbst: glehmann: bug when I was fixing the inf/nan preserve. It's applied to the actual kernel, but not when compiling libclc, but I already checked and it's not fixing the issue either.
12:22alyssa: karolherbst: see libagx_frcp
12:25karolherbst: ahh.. I remember that one now..
12:27karolherbst: alyssa: I've disabled the lowering and now the atan test i passing....
12:29alyssa: charming
12:32karolherbst: alyssa: you remember on what hardware you were testing this on?
12:33alyssa: probably m1
12:33karolherbst: mhhhhh
12:33karolherbst: I'm on a M2
12:33karolherbst: maybe they fixed the issue on M2, but then I'll have to figure out why the lowering is broken on a "fixed" rcp then
12:34karolherbst: you know what... I just run the CTS with it disabled and see what happens...
12:36karolherbst: okay... I had 7 fails in bruteforce: atan, atan2, atan2pi, atanpi, half_rsqrt, tanh and tanpi.. and all of them are fixed by not doing the lowering...
12:38glehmann: oh well, nir_fisnan is broken
12:38glehmann: so nir_opt_algebraic probably removes it
12:39glehmann: and then you hit NaN here: https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/asahi/compiler/agx_compile.c#L3564 12:39alyssa: glehmann: lol, that'll do it
12:39glehmann: https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/compiler/nir/nir_builtin_builder.h#L68 this should preserve inf and nan instead of setting exact
12:40karolherbst: glad we talked about it.. though we might want to disable the lowering for M2 then after proper testing
12:40karolherbst: or maybe keep it...
12:41alyssa: karolherbst: stick a `b->fp_math_ctrl = nir_fp_no_fast_math` at the top op libagx_Frcp
12:41glehmann: I'm suprised it's even needed, AMD's 32bit frcp isn't correctly rounded either
12:42karolherbst: rusticl already does a refinement step for divisions
12:42alyssa: this is for integer division
12:42karolherbst: ohhh...
12:42alyssa: glehmann: it's not needed for app-generated frcp, it is needed for nir_lower_idiv on that hardware
12:42karolherbst: right... we've talked about that...
12:42karolherbst: it's an issue I hit 🙃
12:42alyssa: arguably nir_lower_idiv should be fixed but it was easier to deal with in driver
12:44glehmann: karolherbst: are you going to fix nir_fisnan or should I do that?
12:44karolherbst: glehmann: you can
12:58karolherbst: with that resolved, I'm now passing the 3.1 CTS on asahi it seems
12:59alyssa: woo!
13:00karolherbst: need to doa non wimpy run once I'm home
13:03alyssa: karolherbst: the fmin patch doesn't pass my sniff test but I'm trying to figure out who gets the hot potato of fixing it between you me and glehmann :p
13:04karolherbst: :D
13:05karolherbst: seems like running test_integer_ops uint_math properly runs into some issues in non wimpy mode
13:06karolherbst: prolly something with exact or something
13:16zmike: can I get an ack on https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41422 14:00karolherbst: okay... integer division regressed by https://gitlab.freedesktop.org/mesa/mesa/-/commit/d3adef316414bf94b61248c1a631fffcf21a9e52 14:04karolherbst: seems like reverting it on main still fixes it
14:07alyssa: uh
14:11glehmann: well the commit moves it after agx_nir_lower_fdiv
14:12glehmann: so the frcp workaround intended for int div is not applied
14:30karolherbst: wow.. I got back fro my coffee break and already got the answer!
14:32MrCooper: the universe telling you to take a coffe break more often :)
14:33karolherbst: yep that fixes it
14:50alyssa: MrCooper: legit
15:33alyssa: oops I accidentally fixed my remaining opencl cts fails on jay
15:43karolherbst: so guess that makes it 3 drivers that are ready 🙃
16:04alyssa: heh
22:33airlied: rodrigovivi: can you send me a new PR with the drm-next revert instead of a new pull