Skip to content

Commit f6c8e7d

Browse files
authored
[MLIR][AMDGPU] Remove support for old llvm.amdgcn.buffer.* intrinsics (#93838)
They have been superseded by llvm.amdgcn.raw.buffer.* and llvm.amdgcn.struct.buffer.*.
1 parent cc2fafa commit f6c8e7d

File tree

4 files changed

+0
-134
lines changed

4 files changed

+0
-134
lines changed

mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -425,43 +425,6 @@ def ROCDL_RawPtrBufferAtomicUminOp : ROCDL_RawPtrBufferAtomicNoRet<"umin">;
425425
// Note: not supported on all architectures
426426
def ROCDL_RawPtrBufferAtomicFaddOp : ROCDL_RawPtrBufferAtomicNoRet<"fadd">;
427427

428-
/// LEGACY BUFFER OPERATIONS. DO NOT USE IN NEW CODE. KEPT FOR IR COMPATIBILITY.
429-
//===---------------------------------------------------------------------===//
430-
// Vector buffer load/store intrinsics
431-
432-
def ROCDL_MubufLoadOp :
433-
ROCDL_Op<"buffer.load">,
434-
Results<(outs LLVM_Type:$res)>,
435-
Arguments<(ins LLVM_Type:$rsrc,
436-
LLVM_Type:$vindex,
437-
LLVM_Type:$offset,
438-
LLVM_Type:$glc,
439-
LLVM_Type:$slc)>{
440-
string llvmBuilder = [{
441-
$res = createIntrinsicCall(builder,
442-
llvm::Intrinsic::amdgcn_buffer_load, {$rsrc, $vindex, $offset, $glc,
443-
$slc}, {$_resultType});
444-
}];
445-
let hasCustomAssemblyFormat = 1;
446-
}
447-
448-
def ROCDL_MubufStoreOp :
449-
ROCDL_Op<"buffer.store">,
450-
Arguments<(ins LLVM_Type:$vdata,
451-
LLVM_Type:$rsrc,
452-
LLVM_Type:$vindex,
453-
LLVM_Type:$offset,
454-
LLVM_Type:$glc,
455-
LLVM_Type:$slc)>{
456-
string llvmBuilder = [{
457-
auto vdataType = moduleTranslation.convertType(op.getVdata().getType());
458-
createIntrinsicCall(builder,
459-
llvm::Intrinsic::amdgcn_buffer_store, {$vdata, $rsrc, $vindex,
460-
$offset, $glc, $slc}, {vdataType});
461-
}];
462-
let hasCustomAssemblyFormat = 1;
463-
}
464-
465428
//===---------------------------------------------------------------------===//
466429
// Raw buffer load/store intrinsics
467430

mlir/lib/Dialect/LLVMIR/IR/ROCDLDialect.cpp

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -39,54 +39,6 @@ using namespace ROCDL;
3939
// Parsing for ROCDL ops
4040
//===----------------------------------------------------------------------===//
4141

42-
// <operation> ::=
43-
// `llvm.amdgcn.buffer.load.* %rsrc, %vindex, %offset, %glc, %slc :
44-
// result_type`
45-
ParseResult MubufLoadOp::parse(OpAsmParser &parser, OperationState &result) {
46-
SmallVector<OpAsmParser::UnresolvedOperand, 8> ops;
47-
Type type;
48-
if (parser.parseOperandList(ops, 5) || parser.parseColonType(type) ||
49-
parser.addTypeToList(type, result.types))
50-
return failure();
51-
52-
MLIRContext *context = parser.getContext();
53-
auto int32Ty = IntegerType::get(context, 32);
54-
auto int1Ty = IntegerType::get(context, 1);
55-
auto i32x4Ty = LLVM::getFixedVectorType(int32Ty, 4);
56-
return parser.resolveOperands(ops,
57-
{i32x4Ty, int32Ty, int32Ty, int1Ty, int1Ty},
58-
parser.getNameLoc(), result.operands);
59-
}
60-
61-
void MubufLoadOp::print(OpAsmPrinter &p) {
62-
p << " " << getOperands() << " : " << (*this)->getResultTypes();
63-
}
64-
65-
// <operation> ::=
66-
// `llvm.amdgcn.buffer.store.* %vdata, %rsrc, %vindex, %offset, %glc, %slc :
67-
// result_type`
68-
ParseResult MubufStoreOp::parse(OpAsmParser &parser, OperationState &result) {
69-
SmallVector<OpAsmParser::UnresolvedOperand, 8> ops;
70-
Type type;
71-
if (parser.parseOperandList(ops, 6) || parser.parseColonType(type))
72-
return failure();
73-
74-
MLIRContext *context = parser.getContext();
75-
auto int32Ty = IntegerType::get(context, 32);
76-
auto int1Ty = IntegerType::get(context, 1);
77-
auto i32x4Ty = LLVM::getFixedVectorType(int32Ty, 4);
78-
79-
if (parser.resolveOperands(ops,
80-
{type, i32x4Ty, int32Ty, int32Ty, int1Ty, int1Ty},
81-
parser.getNameLoc(), result.operands))
82-
return failure();
83-
return success();
84-
}
85-
86-
void MubufStoreOp::print(OpAsmPrinter &p) {
87-
p << " " << getOperands() << " : " << getVdata().getType();
88-
}
89-
9042
// <operation> ::=
9143
// `llvm.amdgcn.raw.buffer.load.* %rsrc, %offset, %soffset, %aux
9244
// : result_type`

mlir/test/Dialect/LLVMIR/rocdl.mlir

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -273,30 +273,6 @@ llvm.func @rocdl.raw.ptr.buffer.i32(%rsrc : !llvm.ptr<8>,
273273

274274
// -----
275275

276-
// Tests for deprecated buffer ops.
277-
278-
llvm.func @rocdl.mubuf(%rsrc : vector<4xi32>, %vindex : i32,
279-
%offset : i32, %glc : i1,
280-
%slc : i1, %vdata1 : vector<1xf32>,
281-
%vdata2 : vector<2xf32>, %vdata4 : vector<4xf32>) {
282-
// CHECK-LABEL: rocdl.mubuf
283-
// CHECK: %{{.*}} = rocdl.buffer.load %{{.*}} %{{.*}} %{{.*}} %{{.*}} %{{.*}} : vector<1xf32>
284-
%r1 = rocdl.buffer.load %rsrc, %vindex, %offset, %glc, %slc : vector<1xf32>
285-
// CHECK: %{{.*}} = rocdl.buffer.load %{{.*}} %{{.*}} %{{.*}} %{{.*}} %{{.*}} : vector<2xf32>
286-
%r2 = rocdl.buffer.load %rsrc, %vindex, %offset, %glc, %slc : vector<2xf32>
287-
// CHECK: %{{.*}} = rocdl.buffer.load %{{.*}} %{{.*}} %{{.*}} %{{.*}} %{{.*}} : vector<4xf32>
288-
%r4 = rocdl.buffer.load %rsrc, %vindex, %offset, %glc, %slc : vector<4xf32>
289-
290-
// CHECK: rocdl.buffer.store %{{.*}} %{{.*}} %{{.*}} %{{.*}} %{{.*}} %{{.*}} : vector<1xf32>
291-
rocdl.buffer.store %vdata1, %rsrc, %vindex, %offset, %glc, %slc : vector<1xf32>
292-
// CHECK: rocdl.buffer.store %{{.*}} %{{.*}} %{{.*}} %{{.*}} %{{.*}} %{{.*}} : vector<2xf32>
293-
rocdl.buffer.store %vdata2, %rsrc, %vindex, %offset, %glc, %slc : vector<2xf32>
294-
// CHECK: rocdl.buffer.store %{{.*}} %{{.*}} %{{.*}} %{{.*}} %{{.*}} %{{.*}} : vector<4xf32>
295-
rocdl.buffer.store %vdata4, %rsrc, %vindex, %offset, %glc, %slc : vector<4xf32>
296-
297-
llvm.return
298-
}
299-
300276
llvm.func @rocdl.raw.buffer.f32(%rsrc : vector<4xi32>,
301277
%offset : i32, %soffset : i32,
302278
%aux : i32, %vdata1 : f32,

mlir/test/Target/LLVMIR/rocdl.mlir

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -429,31 +429,6 @@ llvm.func @rocdl.raw.ptr.buffer.atomic.cmpswap(%rsrc : !llvm.ptr<8>,
429429
llvm.return %val : i32
430430
}
431431

432-
llvm.func @rocdl.mubuf(%rsrc : vector<4xi32>, %vindex : i32,
433-
%offset : i32, %vdata1 : vector<1xf32>,
434-
%vdata2 : vector<2xf32>, %vdata4 : vector<4xf32>) {
435-
%glc = llvm.mlir.constant(false) : i1
436-
%slc = llvm.mlir.constant(true) : i1
437-
// CHECK-LABEL: rocdl.mubuf
438-
// CHECK: call <1 x float> @llvm.amdgcn.buffer.load.v1f32(<4 x i32> %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 {{.*}}, i1 {{.*}})
439-
// CHECK: call <2 x float> @llvm.amdgcn.buffer.load.v2f32(<4 x i32> %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 {{.*}}, i1 {{.*}})
440-
// CHECK: call <4 x float> @llvm.amdgcn.buffer.load.v4f32(<4 x i32> %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 {{.*}}, i1 {{.*}})
441-
442-
// CHECK: call void @llvm.amdgcn.buffer.store.v1f32(<1 x float> %{{.*}}, <4 x i32> %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 {{.*}}, i1 {{.*}})
443-
// CHECK: call void @llvm.amdgcn.buffer.store.v2f32(<2 x float> %{{.*}}, <4 x i32> %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 {{.*}}, i1 {{.*}})
444-
// CHECK: call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %{{.*}}, <4 x i32> %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 {{.*}}, i1 {{.*}})
445-
446-
%r1 = rocdl.buffer.load %rsrc, %vindex, %offset, %glc, %slc : vector<1xf32>
447-
%r2 = rocdl.buffer.load %rsrc, %vindex, %offset, %glc, %slc : vector<2xf32>
448-
%r4 = rocdl.buffer.load %rsrc, %vindex, %offset, %glc, %slc : vector<4xf32>
449-
450-
rocdl.buffer.store %vdata1, %rsrc, %vindex, %offset, %glc, %slc : vector<1xf32>
451-
rocdl.buffer.store %vdata2, %rsrc, %vindex, %offset, %glc, %slc : vector<2xf32>
452-
rocdl.buffer.store %vdata4, %rsrc, %vindex, %offset, %glc, %slc : vector<4xf32>
453-
454-
llvm.return
455-
}
456-
457432
llvm.func @rocdl.raw.buffer(%rsrc : vector<4xi32>,
458433
%offset : i32, %soffset : i32,
459434
%vdata1 : i32,

0 commit comments

Comments
 (0)