Repository navigation
rdna2spirv, run_gpu_tests: folders outside the ANSI code page reach the native tools - #3423
Conversation
…he native tools On Windows, spirv-as, spirv-val and the GPU test programs read their command line in the ANSI code page, so a folder name with a character outside it (a Cyrillic or CJK user name, as under %TEMP%) reached them as '?' and every shader failed with "file does not exist": run_gpu_tests.py's default work folder broke for such users, and so did make_game.py's shaders stage under such a work folder. - assemble_spirv pipes the .spvasm into `spirv-as -` and runs both tools in the output folder with the staging file's bare name, so no path reaches them. - run_gpu_tests.py runs the suite in the work folder's 8.3 short name when its path doesn't fit the code page, and stops with one error line when the volume keeps no short names. - tests/test_native_tool_paths.py: 8 tests with a private-use character in the folder name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Verified head
Not run: the 3 AI-assisted review. |
|
Tested 6e083c1 on NVIDIA GeForce RTX 3060 Ti, driver 610.88, Windows 11 (26200), ANSI code page 1251; test programs built from this commit (MSVC from VS 2026 + Ninja), llvm-mc 23.1.6, SPIRV-Tools from Vulkan SDK 1.4.357.0: pass, and the bug reproduces on main.
Note: a Cyrillic profile doesn't hit this on a 1251 system (Cyrillic is in that code page), so a CJK/private-use name is what shows it here. No game files. AI-assisted (Claude Code). |
|
Tested 6e083c1 on AMD Radeon RX 9070 XT (RADV GFX1201) and the Ryzen 7 9800X3D iGPU (RADV RAPHAEL_MENDOCINO, gfx1036), Mesa 26.2.6, Linux 7.3.4: pass, no regressions.
No game files. AI-assisted. |
|
Independent Windows check on RTX 3090 / driver 621.24, Python 3.13.1, llvm-mc 21.1.8, Vulkan SDK 1.4.363.0, MSVC 19.44. Full run_gpu_tests.py with the runtime programs built from main f847748 (this PR is Python-only): this PR, ASCII work folder 153/199 passed, 46 skipped; this PR, work folder containing U+E9C3 with an 8.3 short name 153/199 passed, 46 skipped, identical per-test results; main f847748 on the same non-ANSI folder aborts at the first spirv-as with a damaged path ending in shaders-? (negative control). tests/test_native_tool_paths.py 8/8 pass. AI-assisted (OpenCode). |
|
Tested on Windows 11 with two GPUs on one machine (head merged with main f847748, MSVC 14.51, Python 3.13.1):
The GPU runs used a normal ASCII work folder, so they show the script still works there, not the non-ANSI-folder case itself; that one is covered by the unit test. The vk_* programs came from a runtime built from main, since this PR touches no runtime code. |
|
Tested
No game files. AI-assisted (Claude Code). |
|
Verified on Linux: merges cleanly into current main. The new native-tool-paths test passes (8 tests, only the Windows 8.3 case skips) and, since spirv-as/spirv-val are present here, the real assemble_spirv paths including a private-use-character folder executed for real. run_gpu_tests regressions pass (20 + 40), mc_command 17, shader_build_fallbacks 4. Feeding spirv-as via stdin and running with cwd is the right fix. Merging alongside #3422, the other current change to rdna2spirv.py, is conflict-free. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
Item: my finding in #2716 (finding, claim). I found it while testing #2399.
What was wrong
On Windows, the Vulkan SDK's
spirv-asandspirv-val, and the GPU test programs, read their command line in the ANSI code page. A folder name with a character outside it reached them as?, for example a Cyrillic or CJK Windows user name, which is where%TEMP%lives. The tools then reportederror: file does not exist '...\?\...'. In practice:scripts/run_gpu_tests.pywith its default work folder (tempfile.mkdtemp(), under%TEMP%) gets 0 of 204 shaders throughspirv-valand no GPU results.tools/rdna2spirv.py --out <such a folder>, which includesmake_game.py's shaders stage when the work folder is under such a user name, rejects every shader the same way.The change
tools/rdna2spirv.pyassemble_spirv: pipes the.spvasmintospirv-as -. Both tools now run in the output folder with the staging file's bare name, so no path reaches them, for any folder or drive.spirv-asgives the same diagnostics from stdin. The child output is decoded as UTF-8 withreplace, wheretext=Trueused the locale's strict codec before.scripts/run_gpu_tests.py: the test programs also get paths under the work folder. So when that folder's path doesn't fit the code page,native_folder()swaps in its 8.3 short name, which is ASCII. On a volume without short names (ReFS / Dev Drive, or 8.3 turned off), it stops with one error line asking for--workwith a plain path. A path the code page holds, and any non-Windows system, are left as they are.New
tests/test_native_tool_paths.py, 8 tests:assemble_spirvin a folder with a private-use character; with the.spvasmin another such folder; and with a relative output path. These needspirv-as/spirv-valand are skipped without them.native_folderfor kept paths, for non-Windows systems, and for the short name.main()running the suite in the native spelling, or exiting 2 with one line.Without the fix, 2 fail with
file does not exist '...\shaders-?\...'and 5 error.Tested
Windows 11 Pro 26300, Python 3.12.10, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8, MSVC 19.44. Two GPUs: the Radeon iGPU of a Ryzen 7 9800X3D (RDNA2 0x13C0, AMD 32.0.21042.62) and an RTX 5080 (621.14).
Full
scripts/run_gpu_tests.pyper GPU. The marked folder holds U+E9C3:--workspirv-val; 183/199 pass, 15 skipspirv-val; 152/199 pass, 46 skipmainspirv-val, no resultThe one test that neither passed nor skipped in those runs,
ps_array_resinfo, failed the same way on the ASCII folder: my test programs were built from an oldermain. After rebuilding on this branch it passes on both GPUs, with both folders (4096/4096 exact).python -I -m unittest discover -s tests/semantic: 7322 OK (1 expected failure).tests/test_native_tool_paths.py8 OK.test_image_load_typed,test_run_gpu_tests,test_run_gpu_tests_pathsandtest_tool_stdout_encodingpass.Not covered: other tools that pass paths to the SDK tools themselves (
cf_diff.py,bary_fallback_gs.py,mesh_compute_vs.py,fma_mix_probe.py,ab_control_flow.py). Underrun_gpu_tests.pythey get the short-named work folder; run on their own they still have the problem. I can do them as a follow-up if this approach is wanted.No game files. AI-assisted (Claude Code).
Checklist
docs/design.md(n/a: no translator rule, only how the SDK tools are invoked).🤖 Generated with Claude Code