Skip to content

[SM6.10] LinAlg Validation: Convert - #8837

Merged
Ashley Coleman (V-FEXrt) merged 4 commits into
mainfrom
linalg-vali-convert
Sep 3, 2026
Merged

[SM6.10] LinAlg Validation: Convert#8837
Ashley Coleman (V-FEXrt) merged 4 commits into
mainfrom
linalg-vali-convert

Conversation

@V-FEXrt

Copy link
Copy Markdown
Collaborator

Fixes #8509

Implements LinAlg Convert validation rules


Stack created with GitHub Stacks CLIGive Feedback 💬

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

✅ With the latest revision this PR passed the C/C++ code formatter.

Copilot AI balanced review requested due to automatic review settings August 26, 2026 17:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements Shader Model 6.10 validation rules for LinAlg Convert operations.

Changes:

  • Validates interpretation constants, vector element types, and output dimensions.
  • Adds validation diagnostics and DXIL documentation.
  • Adds and updates validation/code-generation tests.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/DxilValidation/DxilValidation.cpp Implements Convert validation.
lib/DxilValidation/DxilValidationUtils.cpp Identifies native component types.
lib/DxilValidation/DxilValidationUtils.h Declares the native-type helper.
utils/hct/hctdb.py Defines new validation messages.
docs/DXIL.rst Documents the new rules.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-convert.ll Tests validation failures.
tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/convert/nominal.hlsl Updates nominal inputs to valid interpretations.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/DxilValidation/DxilValidation.cpp Outdated
Comment thread lib/DxilValidation/DxilValidation.cpp Outdated
Comment thread lib/DxilValidation/DxilValidation.cpp

@damyanp Damyan Pepper (damyanp) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although some of the copilot comments look like they need addressing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The vector-length diagnostic incorrectly references a matrix, and the user-visible validation change needs preview release-note coverage.

Review details

Suppressed comments (2)

lib/DxilValidation/DxilValidation.cpp:1620

  • This reuses the matrix-dimension diagnostic for LinAlgConvert, so an invalid conversion reports that its result must match an “input matrix M dimension” even though this operation has no matrix (as the new test demonstrates). Please add a Convert-specific vector-length rule, e.g. one that says the output vector size must match the expected converted size, and update the generated documentation/test expectation accordingly.
        CI, ValidationRule::InstrLinAlgMatrixDimVectorMismatch,
        {"Return", std::to_string(RetVecTy->getNumElements()),
         std::to_string(ExpectedOutVecSize)});

lib/DxilValidation/DxilValidation.cpp:1549

  • This adds user-visible validation behavior for experimental Shader Model 6.10, but the PR does not add an entry under docs/ReleaseNotes.mdUpcoming Preview Release. Please add a release note for the new LinAlg Convert validation, or point to the related stacked PR that will provide the shared release-note coverage.
  ValidateLinAlgOpParameters(CI, ValCtx);
  • Files reviewed: 7/7 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI review requested due to automatic review settings September 1, 2026 23:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The diagnostics contain typos, and the user-visible SM6.10 validation behavior needs release-note coverage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

lib/DxilValidation/DxilValidation.cpp:1551

  • This adds user-visible validation behavior for experimental Shader Model 6.10, but the PR does not add an entry under docs/ReleaseNotes.md → “Upcoming Preview Release.” Please add an entry for the Convert validation rules, or point to the shared release-note coverage in the stacked effort.
  ValidateLinAlgOpParameters(CI, ValCtx);
  • Files reviewed: 7/7 changed files
  • Comments generated: 4
  • Review effort level: Balanced

Comment thread docs/DXIL.rst Outdated
Comment thread lib/DxilValidation/DxilValidation.cpp Outdated
Comment thread tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-convert.ll Outdated
Comment thread utils/hct/hctdb.py Outdated
)
self.add_valrule(
"Instr.LinAlgMatrixVecElemCountMismatch",
"Return vector size '%0' must must size '%1' derived from input vector size and type.",

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Release-note coverage is missing, and several newly added messages contain typos.

Review details

Suppressed comments (5)

utils/hct/hctdb.py:8756

  • The diagnostic is grammatically malformed: “must must size” should be “must match size.” Please update the generated documentation and test expectation as well.
            "Return vector size '%0' must must size '%1' derived from input vector size and type.",

docs/DXIL.rst:3234

  • Keep this generated diagnostic text consistent with the corrected validation rule: “must must size” should be “must match size.”
INSTR.LINALGMATRIXVECELEMCOUNTMISMATCH                Return vector size '%0' must must size '%1' derived from input vector size and type.

tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-convert.ll:50

  • The expected diagnostic repeats the malformed “must must size” wording. Update it to match the corrected validation message.
  ; CHECK-NEXT: Function: main: error: Return vector size '32' must must size '2' derived from input vector size and type.

lib/DxilValidation/DxilValidation.cpp:1581

  • Correct the typo “minimze” to “minimize.”
  // ComponentTypes. Stop early to minimze noise/avoid being unhelpful

lib/DxilValidation/DxilValidation.cpp:1552

  • This introduces user-visible validation behavior for experimental Shader Model 6.10, so please add an entry under ### Upcoming Preview Release in docs/ReleaseNotes.md, or point to the shared release-note coverage planned for this stacked effort.
  DxilInst_LinAlgConvert Op(CI);
  • Files reviewed: 7/7 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@bob80905 Joshua Batista (bob80905) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on the Copilot comment on the double-must typo

Comment thread lib/DxilValidation/DxilValidation.cpp
Comment thread utils/hct/hctdb.py
Base automatically changed from linalg-vali-matrixloadfrommemory to main September 3, 2026 16:34
Copilot AI review requested due to automatic review settings September 3, 2026 17:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Release-note coverage must be added or confirmed; round-up validation also lacks direct test coverage.

Review details

Suppressed comments (2)

lib/DxilValidation/DxilValidation.cpp:1551

  • This introduces user-visible validation behavior for experimental SM 6.10, but docs/ReleaseNotes.md has no Convert-specific entry. Please add one under Upcoming Preview Release, or confirm that the existing #8588 entry is intended as shared coverage for this stacked validation effort.
static void ValidateLinAlgConvert(CallInst *CI, ValidationContext &ValCtx) {
  ValidateLinAlgOpParameters(CI, ValCtx);

tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-convert.ll:52

  • The vector-size test only covers an exactly divisible conversion (8 F32 elements to 2 packed F8 scalars), so the newly implemented round-up path is not exercised. Add a validator case for an odd source size—such as <3 x half> F16 to <1 x i32> F8—and position the valid case where an unexpected diagnostic cannot be skipped by the first CHECK; an invalid result-size counterpart would also verify rejection.
  ; CHECK-NEXT: Function: main: error: Return vector size '32' must match size '2' derived from input vector size and type.
  ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgConvert.v32i32.v8f32
  %13 = call <32 x i32> @dx.op.linAlgConvert.v32i32.v8f32(i32 -2147483618, <8 x float> <float 9.000000e+00, float 8.000000e+00, float 7.000000e+00, float 6.000000e+00, float 5.000000e+00, float 4.000000e+00, float 3.000000e+00, float 2.000000e+00>, i32 9, i32 21)  ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation)
  • Files reviewed: 7/7 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@V-FEXrt
Ashley Coleman (V-FEXrt) merged commit 5723248 into main Sep 3, 2026
13 checks passed
@V-FEXrt
Ashley Coleman (V-FEXrt) deleted the linalg-vali-convert branch September 3, 2026 19:46
@github-project-automation github-project-automation Bot moved this from New to Done in HLSL Roadmap Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

LinAlg Validation: Convert

4 participants