Skip to content

Commit 4c18e8a

Browse files
committed
Address review comments from fabian and update error strings in the tests
1 parent 693afaa commit 4c18e8a

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,25 +219,24 @@ struct LowerGpuOpsToROCDLOpsPass
219219
gpu::GPUModuleOp m = getOperation();
220220
MLIRContext *ctx = m.getContext();
221221

222-
ArrayAttr targets = m.getTargetsAttr();
223222
if (chipset == "infer") {
223+
ArrayAttr targets = m.getTargetsAttr();
224224
if (!targets) {
225-
m->emitError("ROCDLTargetAttr is empty on GPU module");
225+
m->emitError("there are no target attributes to infer");
226226
return signalPassFailure();
227227
}
228228
if (targets.size() != 1) {
229-
m->emitError("ROCDLTargetAttrs has more specified more than one "
230-
"gpu-arch on GPU module");
229+
m->emitError("expected a single target attribute");
231230
return signalPassFailure();
232231
}
233-
const ROCDL::ROCDLTargetAttr targetAttr =
234-
mlir::dyn_cast<ROCDL::ROCDLTargetAttr>(targets.getValue().front());
232+
ROCDL::ROCDLTargetAttr targetAttr =
233+
dyn_cast<ROCDL::ROCDLTargetAttr>(targets[0]);
235234
chipset = targetAttr.getChip().str();
236235
}
237236

238237
FailureOr<amdgpu::Chipset> maybeChipset = amdgpu::Chipset::parse(chipset);
239238
if (failed(maybeChipset)) {
240-
m->emitError("Invalid chipset name: " + chipset);
239+
m->emitError("invalid chipset name: " + chipset);
241240
return signalPassFailure();
242241
}
243242

mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl-infer-target.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ gpu.module @test_module [#rocdl.target<O = 3, chip = "gfx90a">] {
1313

1414
// -----
1515

16-
// expected-error@below {{ROCDLTargetAttr is empty on GPU module}}
16+
// expected-error@below {{there are no target attributes to infer}}
1717
gpu.module @test_module {
1818
gpu.func @kernel_func() kernel {
1919
gpu.return
@@ -22,7 +22,7 @@ gpu.module @test_module {
2222

2323
// -----
2424

25-
// expected-error@below {{Invalid chipset name: gfx90a,gfx900}}
25+
// expected-error@below {{invalid chipset name: gfx90a,gfx900}}
2626
gpu.module @test_module [#rocdl.target<O = 3, chip = "gfx90a,gfx900">] {
2727
gpu.func @kernel_func() kernel {
2828
gpu.return

0 commit comments

Comments
 (0)