Skip to content

Commit 1a1d82c

Browse files
[LoadOpToBlockIOConversion] Ensure mask constancy to be power of 2 (#5233)
This PR addresses mask constancy validation in the `LoadOpToBlockIOConversion` by ensuring mask constancy values are powers of 2, which is a requirement for block IO operations. Signed-off-by: Whitney Tsang <[email protected]>
1 parent 9633ec1 commit 1a1d82c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

third_party/intel/lib/TritonIntelGPUToLLVM/LoadStoreOpToLLVM.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,20 +2715,21 @@ struct LoadOpToBlockIOConversion
27152715
if (axisInfo) {
27162716
maskConstancyHor = axisInfo->getConstancy(rank - 1);
27172717
maskConstancyVer = axisInfo->getConstancy(rank - 2);
2718-
} else {
2719-
maskConstancyHor = 1;
2720-
maskConstancyVer = 1;
2718+
// The mask constancy has to be power of 2 for block IO.
2719+
if (!llvm::isPowerOf2_64(maskConstancyHor) ||
2720+
!llvm::isPowerOf2_64(maskConstancyVer))
2721+
return failure();
27212722
}
2723+
2724+
// Check the constancy of the mask support to load the memory in 2D block.
2725+
if (!(maskConstancyHor >= instWidth && maskConstancyVer >= instHeight))
2726+
return failure();
27222727
} else {
27232728
// no mask
27242729
maskConstancyHor = std::numeric_limits<unsigned>::max();
27252730
maskConstancyVer = std::numeric_limits<unsigned>::max();
27262731
}
27272732

2728-
// Check the constancy of the mask support to load the memory in 2D block.
2729-
if (!(maskConstancyHor >= instWidth && maskConstancyVer >= instHeight))
2730-
return failure();
2731-
27322733
// Get the LLVM values for `other`
27332734
Value other = op.getOther();
27342735
SmallVector<Value> otherElems;

0 commit comments

Comments
 (0)