Repository navigation
Conversation
Sign-extend the 16-bit immediate, reuse the two-source scalar lowering, and set SCC to the signed overflow for s_addk_i32. Adds startup_gfx2hlsl_s_mulk_addk.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 710b1cf9de
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not reg or reg[0] != 's' or reg[1] != reg[2] or reg[1] > 105: | ||
| raise Unsupported('%s destination %s' % (base, ops[0])) |
There was a problem hiding this comment.
Reject SOPK arithmetic on projected lane-mask SGPRs
When SDST holds a comparison mask, this validation accepts it even though Stage.compare() stores only the current lane's 0/1 projection and records that fact in self.masks. For example, after v_cmp_lt_i32_e64 s4, v0, v1 produces a guest low mask of 0x7fffffff, s_addk_i32 s4, 1 must set SCC, but the emitted expression computes on 0/1 and sets SCC false in every invocation; a following scalar select or SCC branch therefore takes the wrong path. Reject mask-tagged SGPRs before either SOPK lowering, as the complement/pack handlers already do, or model the full mask instead of treating its projection as a numeric word.
Useful? React with 👍 / 👎.
| if self.sym.get(reg[1]): | ||
| raise Unsupported('scc from descriptor data') |
There was a problem hiding this comment.
Allow numeric symbolic SGPRs through the addk guard
When SDST is initialized by an immediate move or supplied as a root constant, self.sym contains a numeric const or ud entry, not descriptor data. Consequently, the ordinary sequence s_mov_b32 s4, 1; s_addk_i32 s4, 1 raises Unsupported('scc from descriptor data') through the production Stage constructor instead of lowering the addition. Numeric fixed_buffer_word entries are rejected too. Restrict this guard to genuinely non-numeric symbols so the new instruction works on initialized scalar values; the added test misses this because it starts with an empty symbol table.
Useful? React with 👍 / 👎.
| add_test(NAME startup_gfx2hlsl_s_mulk_addk COMMAND "${INTAKE_PYTHON}" -B | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_s_mulk_addk_check.py") |
There was a problem hiding this comment.
Document the new startup SOPK capability and reproduction check
The patch introduces startup-translator support and a new CTest, but updates neither README.md nor docs/experiments.md. AGENTS.md requires documentation updates when public capabilities or reproduction commands change; the existing SOPK paragraph documents pixel_aot, not this startup lowering. Add the new startup check and its measured scope to the public experiment documentation, distinguishing the Linux emitted-statement evaluation from Windows/DXIL or GPU validation.
AGENTS.md reference: AGENTS.md:L209-L210
Useful? React with 👍 / 👎.
|
Closing as superseded by #2102 which also guards mask/descriptor destinations and adds mutation controls. |
The lowering is already on this branch. Keep the branch code, add the PR's check (passes against it) and register it.
Part of #1723
What this unblocks: Run 20 census #5 (79/77 pairs).
Lower
s_mulk_i32ands_addk_i32intools/startup/gfx2hlsl.py. Both read and write SDST and take a 16-bit immediate. The decoder prints it as unsigned hex, so it is sign-extended first, then routed through the existing two-source scalar lowering (s_mul_i32/s_add_i32).s_addk_i32also sets SCC to the signed overflow of the add, computed from the old destination before the result is written.s_mulk_i32leaves SCC alone. A destination that is not a plain SGPR (m0, exec, vcc) is refused, and so iss_addk_i32on descriptor data (SCC would depend on it).Verification:
python3 -B tests/startup_gfx2hlsl_s_mulk_addk_check.pyon this branch:PASS. The test builds SOPK words from the decoder layout, executes the emitted statements on 32-bit values and compares them with the architectural result for immediates 0, 1, 0x7fff, 0x8000, 0xfffe, 0xffff.tools/startup/gfx2hlsl.pyfromorigin/main: fails withUnsupported: s_mulk_i32.tests/startup_gfx2hlsl_*check.pyrun one by one on this branch: all pass.startup_gfx2hlsl_s_mulk_addkin CMakeLists.txt. These were run on Linux, not on Win2025. No ctest run.AI-assisted; commands listed were executed locally.