build: name the rect geometry RTV handle instead of taking a temporary's address #3313
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3313
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3311"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@KelboLive on GitHub · 2026-11-28 08:09 UTC · original
KelboLive:fix/gfx2hlsl-scc-phi-mask→main· +2 −1 · 1 files · 1 commits · merged 2026-11-29 16:28 UTCstartup_rect_geometry.cpppassed the address of a temporary toOMSetRenderTargets:GetCPUDescriptorHandleForHeapStart()returnsD3D12_CPU_DESCRIPTOR_HANDLEby value, so that is&on a class prvalue. On MSVC 14.44.35207 it is a nonstandard extension that/permissive-rejects. Compilingmain's file with the target's own compile line plus the flag:/W4warning C4238: nonstandard extension used: class rvalue used as lvalue/permissive-error C2102: '&' requires l-valueThe project sets neither flag, which is why CI accepts the current code. A build configured with
/permissive-does not.After the change,
cmake --build out/build/dev --target startup_rect_geometrycompiles and links.Scope
Rebuilt on current
mainas one commit:unpin_slotcommit is gone. It reachedmainthrough #3309.phi_mask_okhunk is dropped, per both reviews. It had no fixture, and it refused shapesmaintranslates exactly. If a real mistranslation exists there, the place to decide it is where the SCC of ans_and_b32with a lane-mask source is emitted (set_scc), with a fixture that fails onmainand a negative control.Not included: the
const_castchanges instartup_gameinput_trace.cpp.reinterpret_cast<Fn>(const void*)produced no diagnostic at/W4or/permissive-, so I could not show it fixes anything. Name the compiler that rejected the old code and I will add it back with the evidence.github-bot referenced this pull request2026-11-28 08:21:09 +00:00
@JohnConnorNPC on GitHub · 2026-11-28 08:54 UTC · original
Thanks for this. I checked head
8f1ce018against main3f780716. It merges cleanly (git merge-tree --write-tree origin/main pr3311exits 0) and CI passes. There are a few things to fix before it's ready:The first commit is already on main.
ca165ed9(theunpin_slotfix) came in through #3309 (git branch -r --contains ca165ed9→origin/main). GitHub still listssrc/xmem_mapped_pages.cppunder Files changed. Could you rebase onto main so that commit drops out?Please split the PR. The title and body only describe the warning fixes in
startup_gameinput_trace.cppandstartup_rect_geometry.cpp, but the branch also changesphi_mask_okintools/startup/gfx2hlsl.py. AGENTS.md asks for one reviewable behavior per PR, so the.cppfixes and the translator change would each be easier to review on their own.The new SCC refusal has no test. I ran
tests/startup_gfx2hlsl_compute_check.pyagainst main'sgfx2hlsl.py, which is the PR without its 9/−1 hunk, and it still passes (exit 0). Nothing goes red if the change is removed.It refuses shapes that main translates exactly. I added cases to the existing
phi()harness in that check, each with zeroings_mov_b32 s20, 0and the readv_cndmask_b32 v5, v5, v6, s20after the join:v_cmp_gt_u32 vcc_lo, 3, v0; s_and_b32 s20, vcc_lo, exec_lo; s_cselect_b32 s24, 1, 0, with s24 dead at the join: main accepts it, and this PR refuses it withdefinition of s20, live where the block joins. Swapping the operands tos_and_b32 s20, exec_lo, vcc_logives the same result.s_cselect_b32 ... definition of s24, live where the block joins).execz_refusalsalready refuses SCC and any SCC-derived register that is live at the join. A wave-wide SCC read inside the block therefore can't reach anything observable in the cases I tried. If you have a case where main mistranslates, please add it as a fixture together with a negative control, and explain why the two shapes above should now be refused. Otherwise, I'd suggest dropping the hunk.Smaller points about the hunk, if you keep it:
scc_liveis set only by ans_and_b32into M and is cleared whenever M is rewritten. SCC is actually overwritten by any SALU write, and ans_and_b32into a temporary is never tracked.'exec_lo' in ops[1:] or 'exec_lo' in ops[2], the second test is a substring check that the first already covers.phi_mask_okdocstring doesn't mention the new rule.The
.cppchanges look right to me:const_castahead of thereinterpret_castofconst void*, and a named local instead of taking the address of a temporary. Could you name the compiler that rejected the old code in the body? MSVC CI accepts both versions, so CI can't confirm the fix.This comment was AI-assisted.
@Leyukaka on GitHub · 2026-11-29 13:05 UTC · original · reviewed
Two additions to the review above, both on the
phi_mask_okhunk at head8f1ce018. Code reading only, nothing was built or run.SHOULD — the check is only reached when M itself is live at the join.
tools/startup/gfx2hlsl.py:3301-3302:phi_mask_okis called only forcand, the masks written in the block that are inlive_in[t]. The commit message describes a hazard on SCC, not on M. For a blocks_and_b32 s20, vcc_lo, exec_lo; s_cselect_b32 s24, 1, 0where s20 is dead at the join, s20 is not incand,phi_mask_okis never called for it, and the new lines 3675-3676 do not run. The same pair outside anys_cbranch_execzblock is not seen either. So the hunk refuses the wave-wide SCC read only in the subset of cases where the mask happens to be a live i1 phi, which is unrelated to whether the SCC read is exact. If there is a real mistranslation, the place that decides it is where the SCC of ans_and_b32with a lane-mask source is emitted and tracked (set_scc, comment at :6150), with a fixture that fails on main.SHOULD —
scc_liveis cleared by writes that leave SCC untouched.tools/startup/gfx2hlsl.py:3677-3678clears the flag on any write of M. A VOPC write of M (v_cmp_* M, ..., whichmask_write_classaccepts as 'zero') does not write SCC. Ins_and_b32 s20, vcc_lo, exec_lo; v_cmp_gt_u32_e64 s20, 3, v0; s_cselect_b32 s24, 1, 0thes_cselectstill reads the SCC of thes_and_b32, and the hunk accepts it. This is the opposite direction from point 5 above (which covers the reads it refuses although another SALU op has overwritten SCC): here the rule misses the case it was written for.@KelboLive on GitHub · 2026-11-29 16:22 UTC · original
Rebuilt as a single commit on current \main; the body now carries the compiler evidence for the one change that remains.
The branch name \ix/gfx2hlsl-scc-phi-mask\ is now stale. GitHub does not let me rename a pull request's head branch in place, so it stays unless this is reopened from a differently named branch. Say the word if you would rather I do that.
'Fix compiler warnings in tests'to build: name the rect geometry RTV handle instead of taking a temporary's address8f1ce01882tob27cff1bb6@JohnConnorNPC on GitHub · 2026-11-29 16:28 UTC · original
Re-reviewed at
b27cff1bb6. The branch sits directly on main36914379, with 0 commits behind. I read the code but didn't compile it here, since this host has no MSVC.All the earlier points are resolved: ours on
8f1ce018and both from the other review. The branch is one commit, andca165ed9is gone. Thephi_mask_okhunk is gone too:git diff origin/maintouches onlytests/startup_rect_geometry.cpp, +2/−1. The title now matches the change. The body gives the compiler and flags that show the problem: MSVC 14.44.35207, C4238 at/W4and C2102 at/permissive-.What I checked:
GetCPUDescriptorHandleForHeapStart()returns the handle by value. The namedconstlocal lives past theOMSetRenderTargetscall, which reads the handle during the call.ClearRenderTargetViewon the line above already takes the handle by value and is unchanged.git grep -E '&[A-Za-z_>.-]*(->|\.)Get(CPU|GPU)DescriptorHandleForHeapStart\(\)'finds 1 match on main (this line) and 0 at the head.git merge-tree --write-tree origin/mainexits 0, andgit diff --checkexits 0. CI onb27cff1b: 3 success, 2 skipped.NIT
/permissive-nor/we4238. A separate PR could enable one of them for the test targets, if the rest of the tree is clean under it.No MUST or SHOULD. Merged as
c4b8a41b.AI-assisted.