[Openmp-commits] [openmp] [OpenMP] Enable automatic unified shared memory on MI300A. (PR #77512)
Joseph Huber via Openmp-commits
openmp-commits at lists.llvm.org
Fri Jan 12 12:54:27 PST 2024
================
@@ -3039,30 +3130,15 @@ struct AMDGPUPluginTy final : public GenericPluginTy {
std::optional<StringRef> Processor = ElfOrErr->tryGetCPUName();
for (hsa_agent_t Agent : KernelAgents) {
- std::string Target;
- auto Err = utils::iterateAgentISAs(Agent, [&](hsa_isa_t ISA) {
- uint32_t Length;
- hsa_status_t Status;
- Status = hsa_isa_get_info_alt(ISA, HSA_ISA_INFO_NAME_LENGTH, &Length);
- if (Status != HSA_STATUS_SUCCESS)
- return Status;
-
- llvm::SmallVector<char> ISAName(Length);
- Status = hsa_isa_get_info_alt(ISA, HSA_ISA_INFO_NAME, ISAName.begin());
- if (Status != HSA_STATUS_SUCCESS)
- return Status;
-
- llvm::StringRef TripleTarget(ISAName.begin(), Length);
- if (TripleTarget.consume_front("amdgcn-amd-amdhsa"))
- Target = TripleTarget.ltrim('-').rtrim('\0').str();
- return HSA_STATUS_SUCCESS;
- });
- if (Err)
- return std::move(Err);
+ auto TargeTripleAndFeaturesOrError =
+ utils::getTargetTripleAndFeatures(Agent);
+ if (!TargeTripleAndFeaturesOrError)
+ return TargeTripleAndFeaturesOrError.takeError();
+ StringRef TargeTripleAndFeatures(*TargeTripleAndFeaturesOrError);
----------------
jhuber6 wrote:
Shouldn't need this intermediate, std::string implicitly converts to StringRef.
https://github.com/llvm/llvm-project/pull/77512
More information about the Openmp-commits
mailing list