[IR] Update names of decomposed tensor descriptor args#9587
[IR] Update names of decomposed tensor descriptor args#9587peterbell10 merged 3 commits intotriton-lang:mainfrom
Conversation
sjw36
commented
Feb 26, 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? |
peterbell10
left a comment
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Why not return success() so it doesn't need to be optional<LogicalResult> which is quite strange.
There was a problem hiding this comment.
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.
| if (!suffix.empty()) { | ||
| auto newLoc = | ||
| NameLoc::get(StringAttr::get(funcOp.getContext(), | ||
| baseName + delimiter + suffix), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.
ad5ae7a to
6977771
Compare
Thanks for the review @peterbell10 , I cleaned up accordingly. |