Repository navigation
Conversation
…(CENSUS-SHORT-CARRY-SRC) image_bvh_census's sgpr_step and mask_writes list a[1] as a written SGPR for every _co_ or v_div_scale op. The three-operand carry forms print dst, src0, src1 with VCC implicit, so a[1] is a source there: a descriptor literal used there was dropped and the census reported descriptor word 0 as unknown, while the form with explicit VCC operands kept it. Take a[1] as the carry or scale destination only where the form prints it: VOP3b, and the e32 form with explicit VCC, which have four or more operands. Test: tests/test_image_bvh_census.py fails on 1fc9283 and passes with the change (22 tests OK, three short forms plus the mask_writes pair).
|
Verified on Windows, and the control bites: the suite fails four cases with
So the four cases this adds are tied to the tool's change and not to fixtures the file already had. That is the control I want on a fix to a parser - the new cases read the old tool and fail. What the change is, from the diff: What I could not test: a real title's BVH census - that needs the game. The parser and its tests are what I ran. AI-assisted: yes - DeepSeek v4.1 (flash), both arms on the machine above. Written with an AI assistant. |
KelboLive
left a comment
There was a problem hiding this comment.
The rule matches the printed forms, and the probe confirms it rather than just the test: a[1] is the carry/scale SGPR only for the four-plus-operand spellings (_e64 or explicit VCC), while the short three-operand _co_ci forms print dst, src0, src1 with VCC implicit — so keeping s8 as a source is right. My six-form probe behaves as intended: v_add_co_ci_u32 v1, s8, v2 (short), the immediate form, and the s[8:9] pair now decode descriptor word 0 as literal 5, while _e64, v_div_scale_f32 and the explicit-VCC e32 still drop it, and a synthetic census summary moves exactly those three sites from "not a literal" to "literal 5". Reverting the fix fails 4 of 22 tests, so it is pinned.
Two caveats worth recording, both about the heuristic rather than this diff:
len(a) > 3is an operand-count proxy, not an encoding check. A future four-operand_co_spelling with a source ata[1]would be misclassified the same way the short form was; keying on_e64/explicit VCC would be direct and does not depend on how many operands the formatter prints.v_mad_u64_u32/v_mad_i64_i32also write an SGPR ata[1](seetests/test_audit_shader4_regs.py:73) and match neither condition, before or after — a pre-existing gap in the SGPR map, out of this PR's scope, but the same class of bug and worth afinding:in the coordination issue if nobody has it.
Test coverage: the three short forms, the explicit e32 and the e64 mask_writes case are covered; the immediate and s[8:9] pair forms are not, though the code handles them (verified). Two sub-tests would close that.
|
Temporarily closed: GitHub will not let this account open a second pull request in this repository while one of its pull requests is open (the same |
|
The reopen was refused, and the answer says why: |
|
The whole standard-library suite passes on this branch's head, with the CI's own selection.
For the record, the suite without the CI's selection predicate (every The change here is one file ( |
Claimed in the coordination issue as: CENSUS-SHORT-CARRY-SRC (#2570 (comment))
What and why
tools/image_bvh_census.pybuilds the SGPR literal map (sgpr_step) and the per-instruction write set (mask_writes). Both took operanda[1]of every_co_op (andv_div_scale) as the carry/scale destination. The three-operand carry forms -v_add_co_ci_u32 v1, s8, v2- printdst, src0, src1with VCC implicit, soa[1]is a source:s8's literal was dropped and a ray-intersection site reading descriptors[8:11]reported word 0 as unknown. The explicit-VCC spelling of the same bytes (v_add_co_ci_u32_e32 v1, vcc, s8, v2, vcc) kept it, which is how the bug showed up (item 2 of the pre-existing finding in the coordination issue).a[1]is now taken as a written SGPR only for the forms that print it: VOP3b, and the e32 form with explicit VCC, both of which have four or more operands. Nothing else changes.Tested
python -I tests/test_image_bvh_census.py- fails onmain60f7dcd90(the new test: the three short forms and themask_writespair) and 22 tests OK with the change.python -m compileall -q tools tests- OK.python -I scripts/check_no_game_data.py tools/image_bvh_census.py tests/test_image_bvh_census.py- OK.GPUs tested: n/a (offline census tool and its unit test, CPU only)
AI-assisted: yes - OpenCode (DeepSeek V4.1 Flash Free)
Checklist
mainand merges cleanly (branch based on60f7dcd90).docs/design.md, with how it was confirmed.Not applicable: offline census tool, no translator rule.