Repository navigation
Conversation
…compare (vk_ps_sweep, tools/ps_sweep.py)
…component is a difference
…mesh-compute and compare (vk_ms_sweep, tools/ms_sweep.py)
Kam471
left a comment
There was a problem hiding this comment.
Checked 5f6bb485f on Windows 11 (Vulkan SDK 1.4.363):
pytest tests/test_ms_sweep.py -q-> 19 passed.vk_ms_sweepbuilds and links; with no arguments it printsusage: vk_ms_sweep native|compute ms.spv ps.spv vs.spv|- out.raw width height groups slot-bytes max-prims(exit 2).git diff --checkclean.
The new tools/ms_sweep.py + vk_ms_sweep worker samples translated mesh shaders, draws each natively and again as --mesh-compute, and compares the two readbacks; the Python tests cover the stratified picker, the run/compare modes and the empty-sample cases. I did not run the sweep itself, which needs a translated mesh-shader corpus and an ms.spv/PS/VS set this host does not keep. No blocking issue from build + unit evidence.
|
The sample can contain fewer shaders than requested. At Run this synthetic check from the checkout with import json, subprocess, sys, tempfile
from pathlib import Path
with tempfile.TemporaryDirectory() as tmp:
d = Path(tmp)
names = [f"m{i:02}" for i in range(60)]
(d / "index.json").write_text(json.dumps({k: {"stage": "ms"} for k in names}))
for i, k in enumerate(names):
(d / (k + ".spv")).write_bytes(bytes(i + 1))
subprocess.run([sys.executable, "-I", "tools/ms_sweep.py", "sample",
"--spirv", tmp, "--out", str(d / "out"), "--n", "19"], check=True)Actual: All 19 existing tests pass. AI-assisted. |
|
A truncated native readback can produce a false agreement at import struct, sys, tempfile
from pathlib import Path
sys.path.insert(0, str(Path.cwd() / "tools"))
import ms_sweep as m
with tempfile.TemporaryDirectory() as tmp:
n, c = Path(tmp) / "native.raw", Path(tmp) / "fallback.raw"
n.write_bytes(b"")
c.write_bytes(struct.pack("<4f", 1, 0, 0, 1) * 4096 + bytes(32))
layout = {"slot_bytes": 8, "max_vertices": 0, "max_primitives": 0}
print(m.classify({"code": 0, "prims": 0}, {"code": 0}, n, c, layout))Actual: Expected: report a short native output. Check the native image size against AI-assisted. |
|
Partial independent check (Windows 11, RTX 5090, Vulkan SDK 1.4.363, MSVC 19.44):
AI-assisted (Devin); no game data. |
kacper-serewis
left a comment
There was a problem hiding this comment.
At 5f6bb48, two independent executions of the same cached mesh entry on Windows RTX 5070 (616.56) gave four native primitives across four workgroups and zero vertices/primitives in every lowered header. The 64×64 images matched byte for byte. Both translations validated and both captures had the expected lengths. This confirms a reproducible count mismatch for one entry with the zero heap. Its cause and corpus frequency remain open. AI-assisted.
kacper-serewis
left a comment
There was a problem hiding this comment.
Follow-up at 5f6bb48 on Windows RTX 5070, driver 616.56. Four workgroups emitting zero primitives gave native query 0. Four groups emitting one triangle each gave query 4 and 512 covered pixels. Direct compute-slot controls returned the expected (0,0) and (3,1) per group, with matching image coverage and full capture lengths. This rules out the query merely counting workgroups here. The two cached translated runs still differ, native 4 versus lowered 0 with clear images. The direct compute control bypasses translation, so the responsible path and whether it actually wrote the cleared headers remain unresolved. AI-assisted.
|
Tested 5f6bb48 merged onto main 3faac55 on AMD Radeon RX 9070 (RDNA4, subgroup 32..64), Windows 11 Pro 26300, MSVC 19.44, RelWithDebInfo, using the translated corpus from a local game build (9,282 mesh shaders), seed 20261123,
I didn't check @shdann's two findings (short sample, truncated readback). This run got the full 400, and every record exited 0. AI-assisted (Claude Code). |
|
Tested
|
kacper-serewis
left a comment
There was a problem hiding this comment.
AI-assisted CPU follow-up at 5f6bb48. The zero-heap trace predicts (1,0) before dummy allocation, then (1,1) per group. That explains how the native query can return four primitives with a blank frame. Across both emitted modules, 5,492 instructions before the epilogue barrier matched after ID and constant normalization. Both epilogues read and unpack the same workgroup allocation word. The lowered path assigns local invocation zero to write the two counts at slot offsets 0 and 4. Both modules validated for Vulkan 1.3. Static analysis cannot determine whether the observed (0,0) headers were written or remained at their initial values. Prefilling the headers with nonzero sentinels would distinguish those outcomes.
kacper-serewis
left a comment
There was a problem hiding this comment.
AI-assisted sentinel follow-up at 5f6bb48, Windows RTX 5070 driver 616.56. In three compute-only dispatches, all four 4,112-byte slots ended with (0,0) in place of their distinct nonzero header sentinels. Skipping dispatch preserved all eight words. A synthetic compute writer replaced all eight with the expected per-slot values. No draw ran in the compute tests. The native rerun generated four primitives. This rules out untouched headers for this cached module and input. The readback establishes final values only; the responsible instruction and intermediate values remain unresolved.
Kam471
left a comment
There was a problem hiding this comment.
Head: 5f6bb48 (matches refs/pull/5072/head). Base d0835dd, 5 commits behind current main 3faac55; the PR delta is 8 files. Windows 11, RTX 5070 Ti, VS 2022 build of this head.
git diff --check 3faac557b...HEAD: clean.python -I -m pytest tests/test_ms_sweep.py tests/test_ps_sweep.py -q: 32 passed (19 ms + 13 ps).- Direct CI-style runs:
python -I tests/test_ms_sweep.py-> Ran 19, OK;python -I tests/test_ps_sweep.py-> Ran 13, OK. python -I tools/ms_sweep.py --help: exit 0.tests/test_ci_registration.py: 8 passed.vk_ms_sweepbuilds (cmake --build ... --target vk_ms_sweep: no work to do), andLEONIDA_VK_DEVICEworks: withLEONIDA_VK_DEVICE='RTX 5070 Ti'it printsdevice: NVIDIA GeForce RTX 5070 Tithroughvk_device_pick.h.ms_sweep.py runinherits the environment, so there is no device-selection blocker.
Not run: the sweep itself. It needs a translated corpus (--spirv with index.json + .spv; the PR used 9,282 mesh entries from game data) and, for translate, <work>/shaders with dxbc/index.json, .dxbc, disasm/*.s and optional fssm/*.fssm. Neither is present here; glslangValidator (Vulkan SDK 1.4.363.0) and the built worker are.
Scope/duplicate: this branch contains open PR #4628's head 8a2644f. Its three ps_sweep files are byte-identical to #4628; only the five ms_sweep files (plus CMake/docs lines) are new here. Please state the dependency, or rebase after #4628 lands, so this is not merged as an 8-file PR carrying unreviewed #4628 work (#4847 also builds on ps_sweep).
Merge-tree: clean against #2124, #1712 and #3777 (the shared runtime/CMakeLists.txt line merges without conflict).
Verdict: tests and tooling are sound; not merge-ready until the #4628 dependency is resolved, and the end-to-end sweep is unverified here.
…t native capture is a failure, not an agreement
|
@shdann both reports were real; fixed in
Run: Linux, Python 3.12.16, |
|
@kacper-serewis thanks for the sentinel and zero-heap follow-ups. I could not find the cause, and here is what I checked. I do not have your cached entry (and a synthetic module cannot be made to take the same zero-heap path), so this is a read of the generator, not a reproduction. In The sweep already surfaces this as |
|
Independent Windows CPU check of 91d8d21c, with GitHub base 3faac557. Windows x64, CPython 3.12.8.
Synthetic CPU fixtures only. AI-assisted. |
Item: TEST, claimed at #4816 (comment). Depends on: #4628 (this branch is on top of it, so the diff shows its commits too; only the last one is new). Related: #4408/#2124 (
--mesh-computeruntime and checker), #4815 (one real drawable throughms_pass).What. The 9,282 mesh shaders had been translated, validated and pipeline-checked but never run on real shaders.
vk_ms_sweepruns one translated mesh shader on the runtime's bindless set 0 (zero heap, four workgroups) with a generated pixel shader:nativeas aVK_EXT_mesh_shadershader (countingMESH_PRIMITIVES_GENERATED) orcomputeas the--mesh-computefallback (dispatch, then themesh_compute_vs.pydraw).tools/ms_sweep.pysamples (fixed seed, strata: size tercile, params, reads buffers, clip distances), translates both ways, runs, and compares the native primitive count and image with the fallback's slots and image. It also reads NaN/Inf positions and out-of-range indices from the slots. Docs: a section indocs/shader_validation.md.Results (RTX 4080 SUPER, Windows 11, 400 of 9,282, seed 20261123): 399 agree (native primitive count equals the fallback's, images agree), 1 device lost in both modes (a null pointer read from the zero heap). 10 shaders have a NaN/Inf position from zero input, and native agrees with the fallback on them. Pipeline creation is slow: native median 3.4 s, 15 over 30 s (up to ~60 s). Limit: any data in the heap is read as a wild address, so the heap stays zero and the geometry is 1 to 2 primitives per workgroup.
Tests.
python -I tests/test_ms_sweep.py(19 tests: sampling, slot analysis, image comparison, classification; Python 3.12.16, Linux), no GPU or game data. Windows build with MSVC 14.51, run on the RTX 4080 SUPER. Negative control: the new files do not exist on main, so the test fails there with ModuleNotFoundError.AI-assisted.