feat(dispatch): Validate the dispatch-surface declaration at configure time - #373
Draft
ahuber21 wants to merge 1 commit into
Draft
feat(dispatch): Validate the dispatch-surface declaration at configure time#373ahuber21 wants to merge 1 commit into
ahuber21 wants to merge 1 commit into
Conversation
ahuber21
force-pushed
the
dispatch/03-validate-surface
branch
2 times, most recently
from
August 24, 2026 09:44
7200927 to
0a0a6e7
Compare
The declaration added in the preceding commit is only worth something if it
is checked rather than trusted, and if the knob that overrides it is
actually turned by something other than a person debugging.
Move the validation out of `generate-dispatch-surface.cmake` into
`validate-dispatch-surface.cmake`, which touches no build-system state and
so runs in script mode:
cmake -DSVS_DISPATCH_SURFACE_FILE=<file> -DSVS_X86_SRC_DIR=<dir> \
-P cmake/validate-dispatch-surface.cmake
`tests/cmake/dispatch-surface/` holds two declarations that must be accepted
and eleven that must be rejected, each carrying the substring its rejection
has to mention. `.github/scripts/check_dispatch_surface.sh` runs the lot --
plus the default declaration -- in 0.2s, needing nothing but cmake. It is a
pre-commit hook and a CI job.
Script mode has no `cmake_minimum_required`, so CMP0007 and CMP0057 default
to OLD there. Both matter: without CMP0007 an empty `|`-field disappears
when the entry is split, and without CMP0057 `IN_LIST` is not an operator.
Set both, scoped with cmake_policy PUSH/POP.
The new `Dispatch Surface` workflow adds what the script cannot check:
- a configure with the default declaration must leave the committed
`dispatch_surface.h` untouched. This catches a declaration changed
without a reconfigure, and a generated header edited by hand.
- a full build and test run against `valid-reduced.cmake`, which shares no
extent with the default declaration -- so a build that quietly fell back
to the committed header would fail to compile rather than pass by
accident. That build's archive holds 288 kernels at extents 32, 384 and
svs::Dynamic, against 864 at the default nine.
- that same overridden build must leave the committed header alone.
Correctness does not depend on which extents have a fixed-extent kernel: an
extent without one is served by the svs::Dynamic kernel. `ctest -LE long`
against the reduced surface passes 153 of 154, the one failure being
`Testing Binary Reader Iterator`, which fails identically on the unmodified
default-surface build.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ahuber21
force-pushed
the
dispatch/02-generate-surface
branch
from
August 24, 2026 10:28
c2d57c2 to
fe66e35
Compare
ahuber21
force-pushed
the
dispatch/03-validate-surface
branch
from
August 24, 2026 10:28
0a0a6e7 to
135d3cc
Compare
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.
A single declaration is only worth something if it is checked rather than
trusted, and if the knob that overrides it is exercised by something.
cmake/validate-dispatch-surface.cmakerejects a malformed declaration atconfigure time -- duplicate or non-numeric extents,
svs::Dynamiclistedexplicitly, malformed level specs, a level with no translation unit. Thirteen
fixtures in
tests/cmake/dispatch-surface/each state the error they expect, and.github/scripts/check_dispatch_surface.shruns the validator over all of them.The
dispatch-surfaceworkflow additionally builds the whole library againstvalid-reduced.cmake, a surface that shares no extent with the default one, so abuild cannot pass by accidentally reusing the committed header. A
pre-commithook checks that the committed generated header matches the declaration.
Part 3 of 5 of the ISA dispatching v2 milestone.