From efd63a4bc723a7d048e5c6c6e26b93fe51ccfbf1 Mon Sep 17 00:00:00 2001 From: Umang Yadav Date: Tue, 1 Oct 2024 11:33:10 +0000 Subject: [PATCH] refactor based on daniel's comments --- .../GPUToROCDL/LowerGpuOpsToROCDLOps.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/external/llvm-project/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp b/external/llvm-project/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp index eb2d87f09f98..417ec10894b7 100644 --- a/external/llvm-project/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp +++ b/external/llvm-project/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp @@ -219,7 +219,6 @@ struct LowerGpuOpsToROCDLOpsPass gpu::GPUModuleOp m = getOperation(); MLIRContext *ctx = m.getContext(); ArrayAttr targets = m.getTargetsAttr(); - FailureOr maybeChipset; if (chipset == "infer") { if (!targets) { emitError(UnknownLoc::get(ctx), @@ -233,18 +232,12 @@ struct LowerGpuOpsToROCDLOpsPass } const ROCDL::ROCDLTargetAttr targetAttr = mlir::dyn_cast(targets.getValue().front()); - maybeChipset = amdgpu::Chipset::parse(targetAttr.getChip()); - if (failed(maybeChipset)) { - emitError(UnknownLoc::get(ctx), - "Invalid chipset name: " + targetAttr.getChip()); - return signalPassFailure(); - } - } else { - maybeChipset = amdgpu::Chipset::parse(chipset); - if (failed(maybeChipset)) { - emitError(UnknownLoc::get(ctx), "Invalid chipset name: " + chipset); - return signalPassFailure(); - } + chipset = targetAttr.getChip().str(); + } + FailureOr maybeChipset = amdgpu::Chipset::parse(chipset); + if (failed(maybeChipset)) { + emitError(UnknownLoc::get(ctx), "Invalid chipset name: " + chipset); + return signalPassFailure(); } auto llvmDataLayout = m->getAttrOfType(