8000 [TMA] Correctly get TMA Block Shape for SwizzledShared Blocks by NikhilAPatel · Pull Request #7275 · triton-lang/triton · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[TMA] Correctly get TMA Block Shape for SwizzledShared Blocks #7275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ SmallVector<int64_t> getTMABlockShape(ArrayRef<int64_t> shapePerCTA,
inline SmallVector<int64_t> getTMABlockShape(Attribute encoding,
ArrayRef<int64_t> shapePerCTA,
bool packedSize) {
auto swizzledEnc =
llvm::dyn_cast_or_null<gpu::SwizzledSharedEncodingAttr>(encoding);
if (swizzledEnc) {
SmallVector<int64_t> blockShape(shapePerCTA);
constexpr int64_t dimMax = 256;
for (auto &size : blockShape)
size = std::min(size, dimMax);

return blockShape;
}

auto mmaEnc = cast<gpu::NVMMASharedEncodingAttr>(encoding);
return getTMABlockShape(shapePerCTA, mmaEnc.getElementBitWidth(),
mmaEnc.getSwizzlingByteWidth(), mmaEnc.getFp4Padded(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ using ::mlir::LLVM::linearize;
using ::mlir::triton::gpu::getCTALayout;
using ::mlir::triton::gpu::getTotalElemsPerThread;
using ::mlir::triton::gpu::NVMMASharedEncodingAttr;
using ::mlir::triton::gpu::SwizzledSharedEncodingAttr;

// Toggle this to work around Cooperative Grid Launch ld.acquire optimized path
static constexpr bool disableLDAcquireLowering = false;
Expand Down Expand Up @@ -1307,8 +1308,14 @@ static LinearLayout getMsgToPackedOffsetLayout(ttg::MemDescType ty) {
static LinearLayout
getMsgToUnpackedOffsetLayout(const LinearLayout &packedLayout,
ttg::MemDescType ty) {
auto isFp4Padded =
cast<NVMMASharedEncodingAttr>(ty.getEncoding()).getFp4Padded();
auto enc = ty.getEncoding();
auto swizzledEnc = llvm::dyn_cast_or_null<SwizzledSharedEncodingAttr>(enc);

if (swizzledEnc) {
return packedLayout;
}

auto isFp4Padded = cast<NVMMASharedEncodingAttr>(enc).getFp4Padded();
if (!isFp4Padded) {
return packedLayout;
}
Expand Down
Loading
0