[llvm] [mlir] [MLIR][AMDGPU] Adding dynamic size check to avoid subword buffer load (PR #135014)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 14 14:11:56 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- mlir/lib/Dialect/AMDGPU/Transforms/TransferReadToLoad.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Dialect/AMDGPU/Transforms/TransferReadToLoad.cpp b/mlir/lib/Dialect/AMDGPU/Transforms/TransferReadToLoad.cpp
index a7d402752..f665c1794 100644
--- a/mlir/lib/Dialect/AMDGPU/Transforms/TransferReadToLoad.cpp
+++ b/mlir/lib/Dialect/AMDGPU/Transforms/TransferReadToLoad.cpp
@@ -162,10 +162,8 @@ struct TransferReadLowering final : OpRewritePattern<vector::TransferReadOp> {
rewriter.create<memref::ExtractStridedMetadataOp>(loc, src);
SmallVector<OpFoldResult> strides =
stridedMetadata.getConstifiedMixedStrides();
- SmallVector<OpFoldResult> sizes =
- stridedMetadata.getConstifiedMixedSizes();
- OpFoldResult offset =
- stridedMetadata.getConstifiedMixedOffset();
+ SmallVector<OpFoldResult> sizes = stridedMetadata.getConstifiedMixedSizes();
+ OpFoldResult offset = stridedMetadata.getConstifiedMixedOffset();
OpFoldResult linearizedIndices;
std::tie(std::ignore, linearizedIndices) =
memref::getLinearizedMemRefOffsetAndSize(rewriter, loc, elementBitWidth,
@@ -191,22 +189,20 @@ struct TransferReadLowering final : OpRewritePattern<vector::TransferReadOp> {
AffineExpr strideExpr, sizeExpr;
OpFoldResult stride = strides[i];
OpFoldResult size = sizes[i];
- if (auto constantStride =
- getConstantIntValue(stride)) {
+ if (auto constantStride = getConstantIntValue(stride)) {
strideExpr = rewriter.getAffineConstantExpr(*constantStride);
} else {
strideExpr = symbols[symbolIndex++];
- offsetValues.push_back(getValueOrCreateConstantIndexOp(
- rewriter, loc, stride));
+ offsetValues.push_back(
+ getValueOrCreateConstantIndexOp(rewriter, loc, stride));
}
- if (auto constantSize =
- getConstantIntValue(size)) {
+ if (auto constantSize = getConstantIntValue(size)) {
sizeExpr = rewriter.getAffineConstantExpr(*constantSize);
} else {
sizeExpr = symbols[symbolIndex++];
- offsetValues.push_back(getValueOrCreateConstantIndexOp(
- rewriter, loc, size));
+ offsetValues.push_back(
+ getValueOrCreateConstantIndexOp(rewriter, loc, size));
}
productExpressions.push_back(strideExpr * sizeExpr);
``````````
</details>
https://github.com/llvm/llvm-project/pull/135014
More information about the llvm-commits
mailing list