Skip to content

Commit 406b887

Browse files
committed
[MLIR][AMX] Remove llvm.ptr<i8> bitcasts from legalize for LLVM pass
This commit removes the no longer required `llvm.ptr<i8>` bitcasts from AMX's legalize-for-llvm-export pass. Typed pointers have been deprecated for a while now and it's planned to soon remove them from the LLVM dialect. Related PSA: https://discourse.llvm.org/t/psa-removal-of-typed-pointers-from-the-llvm-dialect/74502
1 parent 3cf9bf3 commit 406b887

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ Value getStride(ConversionPatternRewriter &rewriter,
7373
return rewriter.create<LLVM::ConstantOp>(loc, llvmInt64Type, attr);
7474
}
7575

76-
/// Cast any pointer to the !llvm.ptr<i8> pointer type.
77-
Value castPtr(ConversionPatternRewriter &rewriter, Location loc, Value ptr) {
78-
auto i8Ptr =
79-
LLVM::LLVMPointerType::get(IntegerType::get(ptr.getContext(), 8));
80-
return rewriter.create<LLVM::BitcastOp>(loc, i8Ptr, ptr);
81-
}
82-
8376
struct TileZeroConversion : public ConvertOpToLLVMPattern<TileZeroOp> {
8477
using ConvertOpToLLVMPattern<TileZeroOp>::ConvertOpToLLVMPattern;
8578
LogicalResult
@@ -116,7 +109,6 @@ struct TileLoadConversion : public ConvertOpToLLVMPattern<TileLoadOp> {
116109
// Replace operation with intrinsic.
117110
Value ptr = getStridedElementPtr(op.getLoc(), mType, adaptor.getBase(),
118111
adaptor.getIndices(), rewriter);
119-
ptr = castPtr(rewriter, op.getLoc(), ptr);
120112
Type resType = typeConverter->convertType(vType);
121113
rewriter.replaceOpWithNewOp<amx::x86_amx_tileloadd64>(
122114
op, resType, tsz.first, tsz.second, ptr, stride);
@@ -143,7 +135,6 @@ struct TileStoreConversion : public ConvertOpToLLVMPattern<TileStoreOp> {
143135
// Replace operation with intrinsic.
144136
Value ptr = getStridedElementPtr(op.getLoc(), mType, adaptor.getBase(),
145137
adaptor.getIndices(), rewriter);
146-
ptr = castPtr(rewriter, op.getLoc(), ptr);
147138
rewriter.replaceOpWithNewOp<amx::x86_amx_tilestored64>(
148139
op, tsz.first, tsz.second, ptr, stride, adaptor.getVal());
149140
return success();

0 commit comments

Comments
 (0)