Shader tests: LLVM's verifier over every module the tests emit #68
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/uiliannn--VItoriaBr!68
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-68"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@lcg007xd-c on GitHub · 2026-11-25 21:34 UTC · original
lcg007xd-c:feat/llvm-verify-test-modules→main· +140 −1 · 4 files · 2 commits · openWhat
The DXIL we emit is LLVM bitcode, so LLVM's own verifier can check it on any platform. Today a broken module is caught only by
dxil.dll, and only on Windows. That covers the class of bug the README mentions: a phi or value that does not dominate its uses.This adds a test-only hook where
Shader::finishwrites the bitcode, right next to thecensushook. WhenVICTORY_LLVM_OPTnames anoptbinary, every module any test emits goes throughopt -passes=verify. A rejected module fails the test that made it, with LLVM's message, and the module is saved to the temp directory forllvm-dis. When the variable is unset, nothing happens. The Windows job is unchanged.Details:
i8is 8-bit aligned. Plainopt/llvm-disrefuse it ("i8 must be 8-bit aligned"), so the check passes DXIL's layout as-data-layout.optthat can't read the module at all (too old, or something else namedopt) is reported once and then not asked again.portablejob setsVICTORY_LLVM_OPTto the newestopton the runner image, if there is one, and prints its version.Tests
the_verifier_rejects_a_use_its_definition_does_not_dominatebuilds a two-armed diamond with the bitcode writer. It checks that the phi version verifies and that the version reading the arm's value directly is rejected ("Instruction does not dominate all uses!"). So the hook is shown to really run, not just to be silent.opt),VICTORY_LLVM_OPT=opt cargo teston the portable crates passes.optran on 99 modules from thevictory-shadertests and added about 2 s.--target x86_64-pc-windows-msvc) are clean.Not tested: which LLVM the
ubuntu-latestimage has, and whether that version reads DXIL. I only had LLVM 23 here. This PR's CI log will show it on the "VICTORY_LLVM_OPT=" line. If it can't read the modules, the tests still pass, and the step only says so once.Note: the Windows
checkjob fails on current main for an unrelated reason (5668b8b, missingLayout::bytes_from), which #64 fixes.🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.