00:19 karolherbst: fsign is kinda broken on a couple of drivers for fp16...
07:17 phasta: Anyone here knowledgable in CRTC? Maybe you can take a look at this: https://lore.kernel.org/dri-devel/d54ba24b0a4748b5c00052d4542460ea014aa50d.camel@mailbox.org/
07:21 glehmann: karolherbst: what do you mean?
08:46 Kayden: airlied: looks like something made a new mesa subproject https://gitlab.freedesktop.org/mesa/airlied-deletion_scheduled-28560 today, with a single branch, and also scheduled it for auto-deletion a week from now? misconfigured AI agent or something...?
08:47 Kayden: seems like it's a fork of the main mesa repo
08:53 airlied: Kayden: yeah that was me, it's in the delete queue now
08:54 airlied: no I just can't type, it was AI fault but not AI doing
08:54 airlied: I had a repo that I'd configured https on so agents can't push from it accidentally
08:54 airlied: but then I tried to push from it deliberately and typed the url in backwards
08:55 Kayden: okay, cool :)
08:55 Kayden: just got the email about it and wasn't sure what it was
08:56 airlied: Kayden: I can't delete it, I just had to add it to the queue
08:57 Kayden: huh, really? it says that I can
08:58 Kayden: (should I try?)
08:58 Kayden: I don't think I have any more permissions than you do though, so
09:02 airlied: Kayden: maybe I didn't try hard enough, it gave me a scary warning and said to queue it
09:04 airlied: okay I can, will do it
09:12 Kayden: nice :)
10:45 karolherbst: glehmann: seems like around edge cases (NaN and -NaN) I see unexpected results in the CL CTS
10:46 glehmann: well nir fsign is not openCl fsign
10:46 karolherbst: it is defined like one tho
10:46 glehmann: so fsign(NaN) and fsign(-0.0) are not strictly defined
10:46 karolherbst: the constant folding does define it
10:47 karolherbst: oh mhh the doc text says some values are not required actually mhhh
10:47 glehmann: yes
14:41 alyssa: glehmann: do we want to change that?
14:41 alyssa: for fsign! at least?
14:42 glehmann: imo no
14:42 alyssa: or just make glsl/spirv set nnan/nsz on fsign
14:42 glehmann: nobody can implement the OpenCL fsign in a sane way
14:43 glehmann: nnan/nsz would be even stronger undefindness
14:43 glehmann: like, according to the GLSL rules, fsign(+0.0) cannot be -0.0, but nsz would allow that
14:43 alyssa: ahhhh
14:43 alyssa: yeah, ok
14:44 karolherbst: yeah.. CL fsign is weird...
14:44 glehmann: just lower it in vtn and forget about it
14:44 karolherbst: the spec: "Returns 1.0 if x > 0, -0.0 if x = -0.0, +0.0 if x = +0.0, or -1.0 if x < 0. Returns 0.0 if x is a NaN."
14:44 karolherbst: yeah...
14:44 alyssa: yeah that seems like the right
14:44 karolherbst: I was under the impression we already lowering, because it seems to work for fp32...
14:45 karolherbst: I'll just lower it...
14:46 karolherbst: I guess I need to check for +-0.0 and Nan mhhh
14:46 alyssa: glehmann: do we want 2 fsign's in NIR?
14:46 karolherbst: yeah I'll just do that
14:47 glehmann: alyssa: if anyone actually wants OpenCL fsign, maybe
14:47 karolherbst: it's kinda funny how lp, zink, radeonsi, iris, ... pass the fp32 sign test, but all fail the fp16 one :'(
14:47 alyssa: glehmann: fair
14:47 karolherbst: yeah I mean.. I don't care about performance here anyway
14:47 alyssa: I think Intel can implement the CL one in a way that's not /too/ stupid
14:47 karolherbst: isn't it like two bcsels + fabs + fsign or something?
14:48 alyssa: yeah but fsign lowers too :p
14:48 karolherbst: oh no
14:48 alyssa: cl fsign on intel i think i can do as like
14:48 karolherbst: yeah maybe at this point just use the libclc impl 🙃
14:48 alyssa: CSEL + CSEL + CMP + SEL
14:48 karolherbst: let me check how terrible that one is
14:48 alyssa: plus a move for the 0x3f800000 constant
14:49 alyssa: with gl/vk rules, what do we save exactly? uhh
14:49 alyssa: CSEL + CSEL plus a move i guess
14:49 karolherbst: https://gitlab.freedesktop.org/karolherbst/mesa-libclc/-/blob/llvm_22/clc/lib/generic/common/clc_sign.inc mhhh...
14:49 alyssa: (x > 0.0) ? 1.0 : ((x < 0.0) ? -1.0 : 0.0)
14:49 alyssa: that's 2 CSEL on Intel (+a constant)
14:49 alyssa: for gl/vk
14:50 alyssa: which I think is correct except for fsign(-0.0)
14:50 alyssa: ^for cl
14:50 karolherbst: nan requires the sign
14:50 karolherbst: ehh wait..
14:50 alyssa: I'm just looking at the nir constant folding
14:50 karolherbst: I don't think it does actually..
14:50 karolherbst: but the CTS might...
14:50 alyssa: If it does
14:51 karolherbst: yeah...
14:51 karolherbst: I'll fix it then
14:51 alyssa: (x > 0.0) ? 1.0 : ((x < 0.0) ? -1.0 : (x & 0x8000_0000)))
14:51 alyssa: which is 2 CSEL + 1 AND, and no constants
14:51 karolherbst: yeah
14:51 karolherbst: I'll just implement it like that then...
14:51 karolherbst: and hope that works
14:52 alyssa: that's not what nir cdocs say it should be though.
15:00 karolherbst: mhh okay, yeah so it complains about -nan: 64513) Error: sign(-nan) returned -0x0p+0
15:00 alyssa: Yeah
15:01 alyssa: (x == x) ? 0.0 : (x < 0.0 ? -1.0 : ((x == 0.0) ? x : 1.0))
15:01 alyssa: er
15:01 alyssa: (x != x) ? 0.0 : (x < 0.0 ? -1.0 : ((x == 0.0) ? x : 1.0))
15:01 alyssa: That's 2 CSEL + 1 CMP + 1 SEL on intel
15:03 karolherbst: yeah that passes everything
15:04 karolherbst: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45442
15:05 karolherbst: ehh wait
15:05 karolherbst: wrong preserve flag
15:06 pq: sign(-0.0) = 0.0?
15:06 pq: err, -0.0
15:07 karolherbst: no, -0.0
15:07 karolherbst: the iand can go I think...
15:07 karolherbst: mhh might need a canonicalize then...
15:10 alyssa: karolherbst: isnan(x) ? 0.0 : ((x == 0.0) ? x : (x > 0.0) ? 1.0 : -1.0))
15:10 alyssa: this is the nir opcodes.py constant fold
15:10 alyssa: and should be good codegen on Intel/Apple/Arm at least
15:16 simon-perretta-img: Oh wow so fsign NaN rules for gl/vk are way more permissive than I thought
15:16 karolherbst: yeah...
15:17 alyssa: simon-perretta-img: Arm's driver for midgard had a really unhinged impl back in the day
15:18 simon-perretta-img: I'm curious to see how it compares to the Rouge one lol
15:18 alyssa: I dont remember exactly
15:18 alyssa: something like
15:18 simon-perretta-img: To make it fit in 1 instruction group we basically do ((signed)x >= 0) ? clamp(x * INFINITY) : -1.0f
15:18 alyssa: clamp(fmulz(x, Inf), -1.0, 1.0)
15:18 alyssa: yeah voila
15:18 simon-perretta-img: Lmao
15:19 alyssa: Mali has hw fsat_signed modifiers
15:20 simon-perretta-img: Neat
15:21 karolherbst: mhhh
15:21 karolherbst: I think in nvidia it could be one instruction.. or two.. would have to think
15:23 karolherbst: yeah.. soo
15:23 karolherbst: clamp(x, -1.0, 1.0) is a single instruction for us
15:23 karolherbst: (using cursed magic)
15:23 alyssa: 0 on Mali
15:24 alyssa: karolherbst: wire up nir_op_fsat_signed if you bad
15:25 karolherbst: kinda want to land this one at some point: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/43587
15:25 karolherbst: alyssa: we can do it with a flexible immediate 🙃
15:25 karolherbst: as long as it's the same absolute value on both ends
15:25 karolherbst: soo...
15:25 karolherbst: clamp(x, -c, c) is a single instruction
15:27 alyssa: your isa is bonkers
15:27 alyssa: this is praise coming from me
15:27 karolherbst: uwu
15:28 karolherbst: I was looking at that .xorsign modifier and I was like: .... wait a second, I can use this in cursed ways
15:30 karolherbst: maybe I should implement nir_op_fsat_signed for now tho...
15:30 karolherbst: optimizing that clamp is a bit of more annoying work
15:31 alyssa: yeah and c = 1.0 in 90% of the cases anyway
15:32 mlankhorst: Optimize for light speed c=1
15:34 karolherbst: yeah.. though the reason I did this opt, was because of I've seen that pattern with a different c...
15:37 karolherbst: guess I'll wire up nir_op_fsat_signed late today then..
17:06 zmike: mareko: can I get an ack on https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45450/diffs?commit_id=cab45d141892def047cef240e4fe3891523ba90d
17:19 mbrost: drm-tip has a back conflict in Xe breaking the build, trying to resolve now
17:36 mbrost: drm-tip build should be fixed
22:25 karolherbst: eric_engestrom, dcbaker: seen my pint on https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45403 ? Any thoughts on backporting this to 26.3 and 26.2?