Skip to content

Commit

Permalink
Address review comments from fabian and update error strings in the t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
umangyadav committed Oct 4, 2024
1 parent 693afaa commit 4c18e8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,25 +219,24 @@ struct LowerGpuOpsToROCDLOpsPass
gpu::GPUModuleOp m = getOperation();
MLIRContext *ctx = m.getContext();

ArrayAttr targets = m.getTargetsAttr();
if (chipset == "infer") {
ArrayAttr targets = m.getTargetsAttr();
if (!targets) {
m->emitError("ROCDLTargetAttr is empty on GPU module");
m->emitError("there are no target attributes to infer");
return signalPassFailure();
}
if (targets.size() != 1) {
m->emitError("ROCDLTargetAttrs has more specified more than one "
"gpu-arch on GPU module");
m->emitError("expected a single target attribute");
return signalPassFailure();
}
const ROCDL::ROCDLTargetAttr targetAttr =
mlir::dyn_cast<ROCDL::ROCDLTargetAttr>(targets.getValue().front());
ROCDL::ROCDLTargetAttr targetAttr =
dyn_cast<ROCDL::ROCDLTargetAttr>(targets[0]);
chipset = targetAttr.getChip().str();
}

FailureOr<amdgpu::Chipset> maybeChipset = amdgpu::Chipset::parse(chipset);
if (failed(maybeChipset)) {
m->emitError("Invalid chipset name: " + chipset);
m->emitError("invalid chipset name: " + chipset);
return signalPassFailure();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gpu.module @test_module [#rocdl.target<O = 3, chip = "gfx90a">] {

// -----

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

// -----

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

0 comments on commit 4c18e8a

Please sign in to comment.