audit_shader4_regs.rbw_registers and vs_input_survey.read_before_write took every VOP `_co_` op with a scalar
second operand as vdst + carry-out. The assembler's short form v_add_co_ci_u32 vD, src0, src1 (also sub and subrev)
has VCC as its carry-out and carry-in and names neither, so its second operand is src0, a read: an SGPR there was
counted as written and dropped from the read-before-write sets. For audit_shader4_regs that hid exactly the s3 read
the audit looks for. The same fix#2357 makes in lane_masks, wave64_halves and writes_exec (wavehs's follow-up there).
Tests: test_short_form_carry_in_reads_s3_in_the_audit and test_short_form_carry_in_reads_its_scalar_src0 fail on
main (s3 missing from the read-before-write sets) and pass here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JPqXc6svM4pbBagTsVEYA3
`--limit 0` passed the non-negative check, `files[:0]` kept no listing, and the
tool printed `=== CS (0 shaders; ...) ===` for every stage with exit 0: a typo
gave a plausible empty audit. 0 is distinguishable from no limit (the default
is None), so it is now an argparse error naming the option, exit 2, the same
type function and wording as `anim_index`'s `byte_count`. A negative value and
a non-number are rejected the same way; `audit()` raises ValueError below 1.
Tests: `--limit 0`, `-1` and `x` exit 2 with no report and no JSON;
`--limit 1` on a two-listing folder audits one. The JSON-refusal test that
used `--limit 0` to exclude the listing now uses a second listing and
`--limit 1`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Squash-merged after diff review of PR #6767 - audit_shader4_regs: a direct-to-LDS load reads its address, and the v_dot*c forms read their accumulator (EGEN-AUDIT-RBW-LDS-DOT)
ds_add_u32 v1, v2 and the other non-_rtn LDS atomics (cmpst, mskor, the
f32/f64/u64/b64 forms, src2 forms) and ds_gws_init/ds_gws_barrier treated
args[0] as a written destination, so a later read of the LDS address
register was not reported as read-before-write. A ds_ op now has no
destination unless it has _rtn or is ds_read*, ds_swizzle, ds_permute,
ds_bpermute, ds_append, ds_consume or ds_ordered_count, the rule
tools/lane_masks.py already uses.
Under `python -I` on Windows a redirected stdout is strict ANSI, so printing a path with a character outside the
code page raised UnicodeEncodeError. tools/ guards against it at the start of every __main__ block and
tests/test_tool_stdout_encoding.py enforces that, but only for tools/. viewer/serve.py died before it started
serving and scripts/audit_shader4_regs.py exited 1 after writing its report; bench_wave64.py and run_gpu_tests.py
print the same kind of output unguarded. All four get the guard, and the check now covers scripts/ and viewer/.
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ABh36DZ2sZNq3ChN6EZJs
The scalar mask in the second operand is an output even when the instruction also has a separate carry-in. Mark it written to avoid reporting it as an incoming register value.
open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly
listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/,
make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source
with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention.
AI-assisted (Claude), on behalf of dev-ewann.
os.listdir on a missing path or a file traced back with FileNotFoundError, and
--json into a folder that does not exist raised after the whole corpus audit had
already printed its report, losing the run. An explicit --fssm/--dxbc that does
not exist was counted as "(missing fssm)" instead, so the report looked valid
while every CS shader's RSRC2 was skipped. Validate the three paths, create the
report's folder, and report an unwritable report path as one line.
rbw_registers() treated the first operand of s_addk_i32, s_mulk_i32 and
s_cmovk_i32 as a pure write, so `s_addk_i32 s3, 1` with s3 never written
before it reported no read-before-write at all. These three read their
destination; they now use shader_meta.SGPR_RMW, the list shader_meta already
keeps for the same reason, and the s3 pattern shows the register as read.
--limit -1 sliced files from the end of the list and reported a shorter
audit. A negative limit is now an argparse-style error (exit 2) before any
output, and audit() raises ValueError for one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>