From 108a41f7e248ddecfbc1d1401f711e39978a82d2 Mon Sep 17 00:00:00 2001 From: Alex Voicu Date: Tue, 26 Nov 2024 14:19:49 +0000 Subject: [PATCH] Handle AMDGPU `flat_work_group_size` reverse translation. --- lib/SPIRV/SPIRVReader.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/SPIRV/SPIRVReader.cpp b/lib/SPIRV/SPIRVReader.cpp index 9d8b0fff..385c5790 100644 --- a/lib/SPIRV/SPIRVReader.cpp +++ b/lib/SPIRV/SPIRVReader.cpp @@ -4636,12 +4636,8 @@ bool SPIRVToLLVM::transMetadata() { // Generate metadata for reqd_work_group_size if (auto *EM = BF->getExecutionMode(ExecutionModeLocalSize)) { - if (M->getTargetTriple() == "amdgcn-amd-amdhsa") - F->addFnAttr("amdgpu-flat-work-group-size", - "1," + llvm::utostr(EM->getLiterals().front())); - else - F->setMetadata(kSPIR2MD::WGSize, - getMDNodeStringIntVec(Context, EM->getLiterals())); + F->setMetadata(kSPIR2MD::WGSize, + getMDNodeStringIntVec(Context, EM->getLiterals())); } // Generate metadata for work_group_size_hint if (auto *EM = BF->getExecutionMode(ExecutionModeLocalSizeHint)) { @@ -4682,8 +4678,12 @@ bool SPIRVToLLVM::transMetadata() { } // Generate metadata for max_work_group_size if (auto *EM = BF->getExecutionMode(ExecutionModeMaxWorkgroupSizeINTEL)) { - F->setMetadata(kSPIR2MD::MaxWGSize, - getMDNodeStringIntVec(Context, EM->getLiterals())); + if (M->getTargetTriple() == "amdgcn-amd-amdhsa") + F->addFnAttr("amdgpu-flat-work-group-size", + "1," + llvm::utostr(EM->getLiterals().front())); + else + F->setMetadata(kSPIR2MD::MaxWGSize, + getMDNodeStringIntVec(Context, EM->getLiterals())); } // Generate metadata for no_global_work_offset if (BF->getExecutionMode(ExecutionModeNoGlobalOffsetINTEL)) {