[SM 6.10] Disable Work Graphs in SM 6.10 - #8798
Conversation
With the introduction of SM 6.10, we're disabling Work Graphs support. This is captured in the Dxil 1.10 specification in [PR microsoft#918] (microsoft/hlsl-specs#918). Assisted-by: Copilot
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds “maximum shader model” (obsoletion) metadata to HLSL intrinsics/built-in node record types, and converts that metadata into Clang availability diagnostics—most notably enforcing that Work Graphs (node shaders) are removed starting at shader model 6.10 (except for lib_6_x).
Changes:
- Extend intrinsic database +
HLSL_INTRINSICAPI surface to carryMaxShaderModel, and plumb it into generated intrinsic tables. - Emit availability attributes with introduced/deprecated/obsoleted versions and diagnose “removed” intrinsics/types; explicitly error on node shader entry points for SM ≥ 6.10 (but not
lib_6_x). - Update/add tests for new availability output and SM6.10 Work Graph removal, and remove older node-shader-based FileCheckLit tests.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| utils/hct/hctdb_instrhelp.py | Adds max_shader_model into generated intrinsic table entries. |
| utils/hct/hctdb.py | Parses max_sm attribute and stores encoded max shader model in intrinsic DB objects. |
| utils/hct/gen_intrin_main.txt | Annotates an intrinsic with min_sm/max_sm to drive availability. |
| tools/clang/unittests/HLSL/ExtensionTest.cpp | Updates intrinsic table initializers for the new struct field. |
| tools/clang/test/SemaHLSL/hlsl/workgraph/sm6_10_node_shader_removed.hlsl | New semantic test ensuring node shaders are rejected at SM6.10+. |
| tools/clang/test/SemaHLSL/hlsl/workgraph/sm6_10_lib_6x_no_diagnostics.hlsl | New test ensuring lib_6_x defers Work Graph diagnostics. |
| tools/clang/test/SemaHLSL/hlsl/workgraph/ast-NodeOutputArrayTypes.hlsl | Updates AST checks for added availability attributes on node record types. |
| tools/clang/test/SemaHLSL/hlsl/workgraph/ast-EmptyNodeOutputArrayTypes.hlsl | Updates AST checks for added availability attributes. |
| tools/clang/test/SemaHLSL/hlsl/linalg/builtins/stage-errors.hlsl | Removes node-stage expectations now that node shaders are removed in SM6.10 context. |
| tools/clang/test/HLSLFileCheckLit/hlsl/intrinsics/wave/group-wave-nodes.hlsl | Removes node-shader-based FileCheckLit coverage for SM6.10. |
| tools/clang/test/HLSLFileCheckLit/hlsl/intrinsics/wave/group-wave-invalid-nodes.hlsl | Removes node-shader-based negative test that no longer applies to SM6.10. |
| tools/clang/test/HLSLFileCheckLit/hlsl/entry/attributes/GroupSharedLimitNodeError.hlsl | Removes GroupSharedLimit node shader tests targeting SM6.10. |
| tools/clang/test/HLSLFileCheckLit/hlsl/entry/attributes/GroupSharedLimitNode.hlsl | Removes GroupSharedLimit node shader tests targeting SM6.10. |
| tools/clang/test/HLSLFileCheck/hlsl/workgraph/ast-rwnodeinput.hlsl | Updates AST checks for node input record availability attributes. |
| tools/clang/test/HLSLFileCheck/hlsl/workgraph/ast-nodeoutput.hlsl | Updates AST checks for node output record availability attributes. |
| tools/clang/test/HLSLFileCheck/hlsl/workgraph/ast-nodeinput.hlsl | Updates AST checks for node input record availability attributes. |
| tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp | Adds “removed” availability diagnostics and SM6.10 node shader entry-point erroring. |
| tools/clang/lib/Sema/SemaHLSL.cpp | Creates availability attrs using both min/max shader model (introduced/deprecated/obsoleted). |
| tools/clang/lib/AST/ASTContextHLSL.cpp | Adds availability attrs to node record template types (introduced 6.8, deprecated 6.9, obsoleted 6.10). |
| tools/clang/include/clang/Basic/DiagnosticSemaKinds.td | Introduces new diagnostics for “removed” intrinsics/types/constants and node shaders. |
| include/dxc/dxcapi.internal.h | Extends HLSL_INTRINSIC with MaxShaderModel. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (pIntrinsic->MaxShaderModel) { | ||
| unsigned Major = pIntrinsic->MaxShaderModel >> 4; | ||
| unsigned Minor = pIntrinsic->MaxShaderModel & 0xF; | ||
| Deprecated = clang::VersionTuple(Major, Minor); | ||
| Obsoleted = clang::VersionTuple(Major, Minor + 1); | ||
| } |
There was a problem hiding this comment.
I've added an assert to cover this because it is unclear to me exactly what we would do. Bumping the major version is possible, as is reving the file format to remove the restrictions on minor version count.
| # cannot be encoded in the version DWORD. | ||
| if major < 0 or minor < 0 or minor > 14: |
There was a problem hiding this comment.
I don't think we should change this. I've added an assert in the C++ code to make sure we know how if we encounter problems with this.
| // RUN: %dxc -T lib_6_10 %s -verify | ||
|
|
||
| // Work Graphs (node shaders) were obsoleted in shader model 6.10. Declaring a | ||
| // node shader of any launch type when targeting shader model 6.10 or above | ||
| // must be an error, regardless of whether any node record types are used. | ||
| // Using a node record type must also be an error, independent of whether the | ||
| // entry point declaring it is itself a node shader. |
There was a problem hiding this comment.
The removed tests all cover SM 6.10 features, and would otherwise fail targeting 6.9.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated no new comments.
Suppressed comments (3)
tools/clang/lib/AST/ASTContextHLSL.cpp:484
- This helper function has external linkage as written (non-
staticat TU scope). To avoid potential link-time symbol collisions across translation units, give it internal linkage (e.g.,staticand/or place it in an anonymous namespace), consistent with typical.cpp-local helpers.
AvailabilityAttr *
ConstructAvailabilityAttribute(clang::ASTContext &context,
VersionTuple Introduced,
VersionTuple Deprecated = VersionTuple(),
VersionTuple Obsoleted = VersionTuple()) {
AvailabilityAttr *AAttr = AvailabilityAttr::CreateImplicit(
context, &context.Idents.get(""), Introduced, Deprecated, Obsoleted,
false, "");
return AAttr;
}
utils/hct/hctdb.py:9921
- The comment says a minor version of 15 has special meaning, but the validation currently rejects
minor == 15by enforcingminor > 14as invalid. Either update the comment to state that 15 is reserved/disallowed formax_sm, or adjust the check (and downstream handling) if6.15is intended to be representable.
# minor of 15 has special meaning, and larger values
# cannot be encoded in the version DWORD.
if major < 0 or minor < 0 or minor > 14:
raise ValueError
tools/clang/lib/Sema/SemaHLSL.cpp:2114
- New behavior is introduced here for
MaxShaderModel(deriving anObsoletedversion and driving “removed” diagnostics). Add a dedicated SemaHLSL test that exercises an intrinsic withmax_sm(e.g., compile at the obsoleted SM and assert the newwarn_hlsl_intrinsic_removeddiagnostic, and compile underlib_6_xto assert no diagnostics), so this doesn’t regress silently.
if (pIntrinsic->MinShaderModel || pIntrinsic->MaxShaderModel) {
clang::VersionTuple Introduced;
if (pIntrinsic->MinShaderModel) {
unsigned Major = pIntrinsic->MinShaderModel >> 4;
unsigned Minor = pIntrinsic->MinShaderModel & 0xF;
Introduced = clang::VersionTuple(Major, Minor);
}
// The maximum shader model is the last one that still supports the
// intrinsic: it is deprecated there, and obsoleted in the next minor
// shader model version. We could give longer deprecation periods in the
// future if there is a need for that.
clang::VersionTuple Deprecated;
clang::VersionTuple Obsoleted;
if (pIntrinsic->MaxShaderModel) {
unsigned Major = pIntrinsic->MaxShaderModel >> 4;
unsigned Minor = pIntrinsic->MaxShaderModel & 0xF;
Deprecated = clang::VersionTuple(Major, Minor);
Obsoleted = clang::VersionTuple(Major, Minor + 1);
}
FD->addAttr(AvailabilityAttr::CreateImplicit(
context, &context.Idents.get(""), Introduced, Deprecated, Obsoleted,
false, ""));
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated no new comments.
Suppressed comments (5)
utils/hct/hctdb.py:9924
assert Falseis used for input validation. Python assertions can be optimized out (e.g., running with-O), which would silently ignore invalidmax_smvalues. Prefer raising a regular exception (e.g.,ValueError) with the same message (or using an existing error-reporting path in this tool) so invalid attributes are always rejected.
try:
major_minor = v.split(".")
if len(major_minor) != 2:
raise ValueError
major, minor = major_minor
major = int(major)
minor = int(minor)
# minor of 15 has special meaning, and larger values
# cannot be encoded in the version DWORD.
if major < 0 or minor < 0 or minor > 14:
raise ValueError
max_shader_model = (major, minor)
except ValueError:
assert False, "invalid max_sm: %s" % (v)
utils/hct/hctdb.py:9851
max_shader_modelis initialized to(0, 0), which is truthy, while later code treats “unset” as falsy (if max_shader_model:). Although this currently encodes to0and behaves correctly downstream, it makes the control flow and intent harder to reason about. Consider initializingmax_shader_modeltoNone(and only setting a tuple whenmax_smis present) to align with the existing sentinel semantics.
hidden = False
min_shader_model = (0, 0)
max_shader_model = (0, 0)
for a in attrs:
tools/clang/lib/AST/ASTContextHLSL.cpp:484
- This helper function in a
.cppfile has external linkage (notstatic/ not in an anonymous namespace). That can create unnecessary exported symbols and increases the risk of collisions if a similarly-named helper is added elsewhere. Make itstatic(or wrap in an anonymous namespace) to keep the symbol TU-local.
AvailabilityAttr *
ConstructAvailabilityAttribute(clang::ASTContext &context,
VersionTuple Introduced,
VersionTuple Deprecated = VersionTuple(),
VersionTuple Obsoleted = VersionTuple()) {
AvailabilityAttr *AAttr = AvailabilityAttr::CreateImplicit(
context, &context.Idents.get(""), Introduced, Deprecated, Obsoleted,
false, "");
return AAttr;
}
tools/clang/lib/Sema/SemaHLSL.cpp:2110
Obsoletedis computed as(Major, Minor + 1)without guarding boundary conditions. Given the earlier comment that minor15has special meaning, amax_smof6.14would produce an obsoleted version6.15, which may be confusing in diagnostics and can collide semantically with the reserved/offline minor. Consider rejectingmax_smminors that would overflow into the reserved value, or explicitly handling the boundary (e.g., avoid generating an obsoleted tuple whenMinor == 14, or map to a well-defined next versioning scheme).
if (pIntrinsic->MaxShaderModel) {
unsigned Major = pIntrinsic->MaxShaderModel >> 4;
unsigned Minor = pIntrinsic->MaxShaderModel & 0xF;
Deprecated = clang::VersionTuple(Major, Minor);
Obsoleted = clang::VersionTuple(Major, Minor + 1);
}
tools/clang/test/SemaHLSL/hlsl/workgraph/sm6_10_node_shader_removed.hlsl:7
- This PR removes multiple existing FileCheckLit tests that exercised Work Graph node shaders in
lib_6_10(e.g., wave/group and GroupSharedLimit scenarios). The new Sema tests cover the removal diagnostics, but they don’t replace coverage for the underlying functionality in the last supported shader models (e.g., SM 6.8/6.9) or forlib_6_xwhere checks are deferred. Consider reintroducing equivalent tests retargeted tolib_6_9(for “still supported”) and/orlib_6_x(for “no diagnostics”) so behavior remains covered where it’s intended to work.
// RUN: %dxc -T lib_6_10 %s -verify
// Work Graphs (node shaders) were obsoleted in shader model 6.10. Declaring a
// node shader of any launch type when targeting shader model 6.10 or above
// must be an error, regardless of whether any node record types are used.
// Using a node record type must also be an error, independent of whether the
// entry point declaring it is itself a node shader.
With the introduction of SM 6.10, we're disabling Work Graphs support.
This is captured in the Dxil 1.10 specification in PR #918.
This is the first of two PRs, the second adds validation errors, validator tests, and updates the release notes.
Assisted-by: Copilot