Skip to content

rdna2spirv: support VOP3 neg/abs source modifiers on v_cndmask_b32 (SHADER-738) - #5605

Open
kotekompotek wants to merge 1 commit into
ItsNotRexed:mainfrom
kotekompotek:work/shader-738-cndmask-mods
Open

kotekompotek wants to merge 1 commit into
ItsNotRexed:mainfrom
kotekompotek:work/shader-738-cndmask-mods

Conversation

@kotekompotek

Copy link
Copy Markdown

Implements SHADER-738 (claimed in #4933):

  • In tools/rdna2spirv.py (v_cndmask_b32), when src0 or src1 carries VOP3 abs or neg modifiers, evaluate via self.src_f(arg) and OpBitcast %uint instead of self.src_u(arg) (which ignored abs/neg). Unmodified operands keep self.src_u(arg) unchanged.
  • Adds tests/semantic/test_cndmask_mods.py (2/2 OK).
  • Verified locally:
    • python -I tests/semantic/test_cndmask_mods.py -v (2/2 OK)
    • git diff --check (clean)

@tylerstraub

Copy link
Copy Markdown
Contributor

Tested 2220275b65754cb96a200534413dd62a3b18652f on NVIDIA GeForce RTX 5090, 595.99.02 (Linux).

At 2220275b on a Linux RTX 5090, the absolute-value modifier on a selected signaling NaN lost its payload. A synthetic compute shader used v_cndmask_b32_e64 v3, |v1|, -v2, vcc_lo with v1 = 0xff800123, v2 = 0x00000001, and the condition first clear, then set. The expected sign-bit operations give 0x7f800123 and 0x80000001.

Translator variant Condition clear Condition set
Submitted head 0x7fffffff 0x80000001
Only this PR’s translator hunk reverted 0x7fffffff 0x80000001
Temporary integer AND/XOR sign-bit operations as in #4103 0x7f800123 0x80000001

All three modules passed SPIR-V validation. Both new unit tests also passed with the translator hunk reverted. A regression assertion on the full selected NaN word would distinguish these implementations. This supports the integer approach in #4103 for SHADER-738.

AI-assisted verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants