Commit Graph

23 Commits

Author SHA1 Message Date
63b0b680ba Merge upstream main into PR #2494 2026-11-28 13:59:12 +00:00
20a4e5d891 Merge pull request #888 from narekshaghoyandev/ubiq-audit-shader4-regs-psv0-stagemap-and-atomic-json
OLD-7883: audit_shader4_regs: harden stage map loading, bound PSV0 reads, and write JSON atomically
2026-11-28 14:07:10 +01:00
5acf0fa3fc scripts: the short form v_add_co_ci_u32 vD, src0, src1 reads src0 (SCRIPTS-SHORT-CO-CI-OPERANDS)
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
2026-11-27 18:30:50 +00:00
6c6d66fbb8 audit_shader4_regs: harden stage map loading, bound PSV0 reads, and write JSON atomically 2026-11-24 14:56:49 +00:00
165402ddeb audit_shader4_regs: --limit must be at least 1; 0 audited nothing and printed a zero report
`--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>
2026-11-24 07:39:25 -05:00
b03e803a82 audit_shader4_regs: fix lds buffer loads and dot-accumulate RBW (#6746)
Squash-merged after diff review of PR #6746
2026-11-23 10:48:11 -06:00
ae12372e3c 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) (#6767)
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)
2026-11-23 09:56:56 -06:00
a995c2a177 Merge pull request #4340 from fladit123
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:13:49 -05:00
89438d24e6 BUILD-1216: protect metadata inputs from JSON overwrite 2026-11-22 22:44:40 -03:00
565bb51424 BUILD-1216: prevent audit JSON output from overwriting .s disassembly listings 2026-11-22 21:49:17 -03:00
72f5d2f0d7 audit_shader4_regs: list ds_nop in DS_HAS_DST to match tools/lane_masks.py 2026-11-22 22:21:01 +00:00
4646a5ee73 audit_shader4_regs: non-returning DS ops read every operand and write nothing
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.
2026-11-22 22:13:53 +00:00
1a6ec4a7bd Merge pull request #3214 from Leo Leahy 2026-11-22 15:15:46 -05:00
826fd2b184 audit_shader4_regs: classify tbuffer/scalar stores, non-glc atomics, dual-dst VALU, and NSA lists 2026-11-22 16:42:46 -03:00
d2288ab497 Merge pull request #2465 from bbareth 2026-11-22 13:15:30 -05:00
c4bee344ef Merge pull request #2399 from AAyberkU 2026-11-22 13:14:44 -05:00
f7d73c3b03 audit_shader4_regs: count only real listings toward the limit 2026-11-22 18:07:44 +01:00
a1343528f7 scripts, viewer: a redirected stdout no longer dies on a path outside the code page
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
2026-11-22 19:55:36 +03:00
bb147680c7 fix(audit): classify carry-in and carry-out operands separately
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.
2026-11-22 17:17:45 +01:00
ec9b6cf22b tools: text reports are written with LF line ends on every platform (BUILD-468)
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.
2026-11-22 14:20:30 +00:00
418dcd6223 audit_shader4_regs: a bad path is one ERROR line, and --json keeps its folder
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.
2026-11-22 03:24:37 -06:00
5e7b00ecec audit_shader4_regs.py: count SGPR reads by s_addk/s_mulk/s_cmovk, reject a negative --limit
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>
2026-11-22 03:14:13 +01:00
1284712038 Docs/Tools: record SHADER-4 corpus counts and add audit_shader4_regs.py 2026-11-21 21:05:25 -03:00