[llvm] [AMDGPU] Add an asm directive to track code_object_version (PR #76267)
Emma Pilkington via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 8 19:01:37 PST 2024
================
@@ -123,45 +124,32 @@ bool isHsaAbi(const MCSubtargetInfo &STI) {
return STI.getTargetTriple().getOS() == Triple::AMDHSA;
}
-std::optional<uint8_t> getHsaAbiVersion(const MCSubtargetInfo *STI) {
- if (STI && STI->getTargetTriple().getOS() != Triple::AMDHSA)
- return std::nullopt;
-
- switch (AmdhsaCodeObjectVersion) {
- case 4:
- return ELF::ELFABIVERSION_AMDGPU_HSA_V4;
- case 5:
- return ELF::ELFABIVERSION_AMDGPU_HSA_V5;
- default:
- report_fatal_error(Twine("Unsupported AMDHSA Code Object Version ") +
- Twine(AmdhsaCodeObjectVersion));
+unsigned getCodeObjectVersion(const Module &M) {
+ if (auto Ver = mdconst::extract_or_null<ConstantInt>(
+ M.getModuleFlag("amdgpu_code_object_version"))) {
----------------
epilk wrote:
Okay, I'll plan to do the auto-upgrade rename in a follow up.
https://github.com/llvm/llvm-project/pull/76267
More information about the llvm-commits
mailing list