Skip to content

[LinAlg] Disallow linalg types in cbuffers and gs - #8969

Open
Chris B (llvm-beanz) wants to merge 2 commits into
microsoft:mainfrom
llvm-beanz:linalg-static-groupshared
Open

Chris B (llvm-beanz) wants to merge 2 commits into
microsoft:mainfrom
llvm-beanz:linalg-static-groupshared

Conversation

@llvm-beanz

Copy link
Copy Markdown
Collaborator

This change disallows linalg objects in groupshared memory and in cbuffers. A global of any type containing a linalg handle must be marked static.

Assisted-by: GitHub Copilot

This change disallows linalg objects in groupshared memory and in
cbuffers. A global of any type containing a linalg handle must be marked
`static`.

Assisted-by: GitHub Copilot
Copilot AI balanced review requested due to automatic review settings September 25, 2026 19:30

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.

Copilot review overview

🟡 Changes recommended

Explicit ConstantBuffer<T> and TextureBuffer<T> declarations still permit structs containing LinAlg handles.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 1 Low severity

Open (2)
What changed in this PR

Restricts LinAlg matrix handles to valid storage contexts while preserving explicit static globals.

Changes:

  • Rejects non-static globals and groupshared LinAlg values.
  • Adds diagnostics and semantic/code-generation coverage.
  • Updates existing builtin and AST tests.
File Description
tools/​clang/​lib/​Sema/​SemaHLSL.cpp Implements storage validation.
tools/​clang/​include/​clang/​Basic/​DiagnosticSemaKinds.td Adds the global diagnostic.
tools/​clang/​test/​SemaHLSL/​hlsl/​linalg/​linalg-matrix-global-error.hlsl Tests invalid storage contexts.
tools/​clang/​test/​SemaHLSL/​hlsl/​linalg/​builtins/​builtin-matrix-handle-type.hlsl Updates builtin-handle diagnostics.
tools/​clang/​test/​SemaHLSL/​hlsl/​linalg/​builtins/​builtin-matrix-handle-type-ast.hlsl Makes the AST test global static.
tools/​clang/​test/​CodeGenDXIL/​hlsl/​linalg/​linalg-matrix-global.hlsl Verifies static-global lowering.

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

Comment thread tools/clang/lib/Sema/SemaHLSL.cpp Outdated
Comment thread tools/clang/lib/Sema/SemaHLSL.cpp
Comment thread tools/clang/lib/Sema/SemaHLSL.cpp Outdated

@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.

Nit on param names (although I'm unsure what the llvm coding guidelines has to say about them, so maybe it's wrong).

Looks like the copilot feedback about ConstantBuffer<T> might be worth considering.

Copilot AI review requested due to automatic review settings September 25, 2026 21:19

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.

Copilot review overview

🟢 Approval recommended

The implementation consistently enforces the intended restrictions and includes broad semantic and code-generation coverage.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (1)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

4 participants