Skip to content

Comments

[SM6.10] Implement FillMatrix Builtin#8186

Open
V-FEXrt wants to merge 1 commit intomainfrom
linalg-fillmatrix
Open

[SM6.10] Implement FillMatrix Builtin#8186
V-FEXrt wants to merge 1 commit intomainfrom
linalg-fillmatrix

Conversation

@V-FEXrt
Copy link
Collaborator

@V-FEXrt V-FEXrt commented Feb 20, 2026

  • Implements the FillMatrix Builtin
  • Add support to map LinAlgMatrix types to the overload type (dx.types.LinAlgMatrixC10M16N16U0S1 -> mC10M16N16U0S1)
  • Puts in placeholders for remaining DXIL op implementations so they can all be uploaded/merged without ordering or merge conflicts.

Fixes #7895

Implements the first linalg DXIL op including required support for
overload name generation. This also adds lowering placeholders so
that subsequent DXIL op implementations may be merged in parallel
without risk of merge conflict
}

StringRef GetHLSLLinAlgMatrixTypeMangling(llvm::StructType *Ty) {
return Ty->getStructName().substr(sizeof("dx.types.LinAlgMatrix") - 1);
Copy link
Member

Choose a reason for hiding this comment

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

sizeof("dx.types.LinAlgMatrix")

TIL!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

haha I figured folks wouldn't like substr(21) very much

Copy link
Member

@damyanp damyanp left a comment

Choose a reason for hiding this comment

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

LGTM, but you'll need an approval from someone more experienced than me.

void main() {
// CHECK-LABEL: define void @main()

// CHECK: %{{.*}} = call %dx.types.LinAlgMatrixC4M5N4U1S2 @dx.op.linAlgFillMatrix.mC4M5N4U1S2.i32(i32 -2147483636, i32 {{.*}}) ; LinAlgFillMatrix(value)
Copy link
Collaborator

Choose a reason for hiding this comment

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

what does -2147483636 mean?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahh that's the opcode! 0x80000001 in hex. Its negative because the opcodes are currently experimental

// expected-no-diagnostics

[numthreads(1,1,1)]
void main() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this test necessary with the codegen test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmm maybe not. Originally this was one big file with code from every builtin but it got split into a bunch of small files to enable parallel PRs

I'm not opposed to removing it, or even merging them all back together into one file at the end.

In general, I'm a big fan of having a straightforward test as a form of "this is how you are supposed to hold it" documentation but in this case we don't want people calling the builtins directly so it doesn't really apply

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.

Implement Matrix Fill builtin

3 participants