Repository navigation
spirv_gs_to_compute: one ERROR line and exit 2 for a missing input, a missing spirv-dis/spirv-as, or an unwritable --layout - #6428
Open
evilclanker9000 wants to merge 4 commits into
Conversation
spirv-dis runs with check=True, so a nonexistent input died in a FileNotFoundError traceback (exit 1) before any message; check the input path first, as BUILD-1046 asks of every tool.
A spirv-dis that is not on PATH (or a wrong SPIRV_DIS) raised FileNotFoundError out of subprocess.run; print one ERROR line that names the tool and the variable, and exit 2 like the path guards already do, and keep a refusal's own first stderr line.
The assembler ran with check=True unguarded: a spirv-as that is not on PATH raised FileNotFoundError, and a refusal raised CalledProcessError, both as a traceback. One ERROR line naming SPIRV_AS, with the tool's own first stderr line when it refused the module.
The layout JSON was written unguarded after the module, so a --layout under a folder that does not exist left a traceback behind a module that had already been written.
|
Verified merged with main 1cc6e3c: the tool's suite runs 31 tests (pytest, re-run) and passes, the four new ERROR-line tests fail on clean main, and the bounds suite stays green; the stubbed spirv-dis/spirv-as paths mean no SPIRV-Tools install is needed (and under python -I the file hard-fails on import pytest rather than silently running nothing). Heads-up for ordering: I merge-tested it against the current head of the long-running #4149 — both edit tools/spirv_gs_to_compute.py and conflict, so whichever merges second needs a rebase. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tools/spirv_gs_to_compute.pyrunsspirv-disandspirv-aswithcheck=Trueand no guard, and writes--layoutunguarded. So the three ordinary failures — a nonexistent input, a SPIRV-Tools binary that is not on PATH (or a wrongSPIRV_DIS/SPIRV_AS), and a--layoutunder a folder that does not exist — each ended in a Python traceback, and the missing input exited 1 instead of the exit 2 BUILD-1046 asks of a missing input. This makes each one a singleERROR:line and exit 2, and keeps the refusing tool's own first stderr line so the reason is still visible.The happy path is unchanged: a valid geometry module still lowers, writes the layout and validates (below).
Test
Both directions,
tests/test_spirv_gs_to_compute.py(needs no SPIRV-Tools on PATH for the three new tests: the input check runs beforespirv-dis, and the other two fake the subprocess):test_cli_names_a_missing_input_in_one_linefails —assert 1 == 2, stderr isFileNotFoundError ...traceback;test_cli_names_a_disassembler_that_cannot_startfails the same way;test_cli_names_an_assembler_that_cannot_start_or_refusesletsFileNotFoundError: [Errno 2] ... 'spirv-as'escapemain().6 passed, 25 skipped(the skips needspirv-as/spirv-valon PATH).Command line, before and after (main
f6c6d11eevs this branch):Happy path on this machine, with
SPIRV_DIS/SPIRV_ASpointed at the local SPIRV-Tools build and a hand-assembledPHI_GSmodule (the one already in the test file, written to a scratch file outside the branch):tools/spirv_gs_to_compute.pywith a realspirv-disthat refuses a non-module now also prints one line:ERROR: ...spirv-dis.exe refused gs_spvasm.txt: error: file size should be a multiple of 4; file 'gs_spvasm.txt' corrupt(exit 2).python -m compileall -q tools/spirv_gs_to_compute.py tests/test_spirv_gs_to_compute.py-> 0python -m pytest tests/test_spirv_gs_to_compute_bounds.py -q->6 passedNo GPU needed: no translation or dispatch is involved.
Notes
tests/test_missing_input_exit_codes.pyencodes. An input that parses but holds an unsupported op still exits 1 fromUnsupported, unchanged.--layoutguard comes with the same commit series: without it the module is already written when the layout write fails, so it was the same class of half-done run._why()returns the tool's first stderr line (orexit Nwhen it printed nothing), so a refusal says why instead of just naming the path.--helpprints and a test pins those two lines.AI-assisted.