Skip to content

Commit 251ec88

Browse files
authored
[BACKEND] Use the LL API to replace the using of legacy layout attribute API. (#5196)
The util function `getDistributedLayoutStr` uses the `DistributedLayout` attribute interface, which is not flexible for third-party extensions. Use the `getInDimSize` of the `LinearLayout`, which is better since the legacy layout has been converted to the `LinearLayout`. There is no new test case since it is only a change in API usage.
1 parent d36e579 commit 251ec88

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/Dialect/TritonGPU/IR/Dialect.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3058,10 +3058,6 @@ std::string getDistributedLayoutStr(RankedTensorType tensorType,
30583058
if (!layout)
30593059
return "";
30603060

3061-
unsigned threadsPerWarp = getWarpSize(layout);
3062-
unsigned numWarpsPerCTA = getNumWarpsPerCTA(layout);
3063-
unsigned numBlocks = getNumCTAs(layout);
3064-
int numElementsPerThreads = getTotalElemsPerThread(tensorType);
30653061
StringAttr kRegister = StringAttr::get(tensorType.getContext(), "register");
30663062
StringAttr kLane = StringAttr::get(tensorType.getContext(), "lane");
30673063
StringAttr kWarp = StringAttr::get(tensorType.getContext(), "warp");
@@ -3074,6 +3070,10 @@ std::string getDistributedLayoutStr(RankedTensorType tensorType,
30743070
int64_t tensorSize = product(tensorType.getShape());
30753071
std::vector<std::string> elementMapping(tensorSize);
30763072
std::vector<std::string> threadMapping;
3073+
unsigned threadsPerWarp = ll->getInDimSize(kLane);
3074+
unsigned numWarpsPerCTA = ll->getInDimSize(kWarp);
3075+
unsigned numBlocks = ll->getInDimSize(kBlock);
3076+
int numElementsPerThreads = ll->getInDimSize(kRegister);
30773077
for (int blockId = 0; blockId < numBlocks; ++blockId) {
30783078
for (int warpId = 0; warpId < numWarpsPerCTA; warpId++) {
30793079
for (int tid = 0; tid < threadsPerWarp; ++tid) {

0 commit comments

Comments
 (0)