Skip to content

[IR] Update names of decomposed tensor descriptor args#9587

Merged
peterbell10 merged 3 commits intotriton-lang:mainfrom
sjw36:sjw/tensdesc-names
Mar 10, 2026
Merged

[IR] Update names of decomposed tensor descriptor args#9587
peterbell10 merged 3 commits intotriton-lang:mainfrom
sjw36:sjw/tensdesc-names

Conversation

@sjw36
Copy link
Copy Markdown
Contributor

@sjw36 sjw36 commented Feb 26, 2026

Tensor descriptor function arguments are decomposed into
tt.ptr, shape, stride, and some flags. This pr updates each
new parameter with a meaningful name, aligned with codegen'd
tensordesc naming.

@sjw36 sjw36 requested a review from ptillet as a code owner February 26, 2026 15:15
@sjw36
Copy link
Copy Markdown
Contributor Author

sjw36 commented Mar 4, 2026

@peterbell10 fyi this is a follow-up to align with #9347 . Do you see the rewrite-tensor-descriptor-to-ptr pass going away at some point?

Copy link
Copy Markdown
Contributor

@peterbell10 peterbell10 left a comment

Choose a reason for hiding this comment

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

Yes, we will need RewriteTensorDescriptorToPointer.cpp so long as there is non-TMA hardware that we need to support. This looks good, but I have a few nits.

if (auto t = dyn_cast<T>(type)) {
return callback(t, out_suffix);
}
return std::nullopt;
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.

Why not return success() so it doesn't need to be optional<LogicalResult> which is quite strange.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is a distinction between whether the type is handled, and if it is handled is it successful or not. This is mostly lifted from mlir/include/mlir/Transforms/DialectConversion.h.

Comment thread lib/Dialect/Triton/Transforms/FunctionTypeConversion.cpp Outdated
Comment thread lib/Dialect/Triton/Transforms/FunctionTypeConversion.cpp Outdated
if (!suffix.empty()) {
auto newLoc =
NameLoc::get(StringAttr::get(funcOp.getContext(),
baseName + delimiter + suffix),
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.

I'm not sure the delimiter really adds anything. You could as well include it in the suffix, e.g. ".stride.0". This would still give you the flexibility to use other delimiters.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, I think it should be uniform across the fields, but sub-fields like the array indices could use different delimiter and that is controlled by the suffixes generated in the RenamerCallbackFn.

sjw36 added 3 commits March 9, 2026 10:16
    Tensor descriptor function arguments are decomposed into
    tt.ptr, shape, stride, and some flags. This pr updates each
    new parameter with a meaningful name, aligned with codegen'd
    tensordesc naming.
@sjw36 sjw36 force-pushed the sjw/tensdesc-names branch from ad5ae7a to 6977771 Compare March 9, 2026 15:16
@sjw36
Copy link
Copy Markdown
Contributor Author

sjw36 commented Mar 9, 2026

Yes, we will need RewriteTensorDescriptorToPointer.cpp so long as there is non-TMA hardware that we need to support. This looks good, but I have a few nits.

Thanks for the review @peterbell10 , I cleaned up accordingly.

@peterbell10 peterbell10 changed the title [NFC] Update names of decomposed tensor descriptor args [IR] Update names of decomposed tensor descriptor args Mar 10, 2026
@peterbell10 peterbell10 enabled auto-merge (squash) March 10, 2026 11:26
@peterbell10 peterbell10 merged commit 94da4f3 into triton-lang:main Mar 10, 2026
9 checks passed
CRobeck pushed a commit to CRobeck/triton that referenced this pull request Mar 10, 2026
)

Tensor descriptor function arguments are decomposed into
    tt.ptr, shape, stride, and some flags. This pr updates each
    new parameter with a meaningful name, aligned with codegen'd
    tensordesc naming.
raymondtay pushed a commit to raymondtay/triton that referenced this pull request Mar 22, 2026
)

Tensor descriptor function arguments are decomposed into
    tt.ptr, shape, stride, and some flags. This pr updates each
    new parameter with a meaningful name, aligned with codegen'd
    tensordesc naming.
jvican pushed a commit to jvican/triton that referenced this pull request Mar 27, 2026
)

Tensor descriptor function arguments are decomposed into
    tt.ptr, shape, stride, and some flags. This pr updates each
    new parameter with a meaningful name, aligned with codegen'd
    tensordesc naming.
plognjen pushed a commit to plognjen/triton that referenced this pull request Apr 14, 2026
)

Tensor descriptor function arguments are decomposed into
    tt.ptr, shape, stride, and some flags. This pr updates each
    new parameter with a meaningful name, aligned with codegen'd
    tensordesc naming.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants