diff options
author | Joseph Huber <huberjn@outlook.com> | 2025-07-21 14:38:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-21 14:38:03 -0500 |
commit | b53be5f4b2d25aabcd676319a054f251cb0752b2 (patch) | |
tree | b2678085cf37dc4e47307c60d88a4095038fa792 /llvm/lib/Object/ELFObjectFile.cpp | |
parent | 8f9ed788740fd00836195b30061ad161b2055d8c (diff) | |
download | llvm-b53be5f4b2d25aabcd676319a054f251cb0752b2.zip llvm-b53be5f4b2d25aabcd676319a054f251cb0752b2.tar.gz llvm-b53be5f4b2d25aabcd676319a054f251cb0752b2.tar.bz2 |
[LLVM] Update CUDA ELF flags for their new ABI (#149534)
Summary:
We rely on these flags to do things in the runtime and print the
contents of binaries correctly. CUDA updated their ABI encoding recently
and we didn't handle that. it's a new ABI entirely so we just select on
it when it shows up.
Fixes: https://github.com/llvm/llvm-project/issues/148703
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/ELFObjectFile.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index 5597d7d..0919c6a 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -620,7 +620,9 @@ StringRef ELFObjectFileBase::getAMDGPUCPUName() const { StringRef ELFObjectFileBase::getNVPTXCPUName() const { assert(getEMachine() == ELF::EM_CUDA); - unsigned SM = getPlatformFlags() & ELF::EF_CUDA_SM; + unsigned SM = getEIdentABIVersion() == ELF::ELFABIVERSION_CUDA_V1 + ? getPlatformFlags() & ELF::EF_CUDA_SM + : getPlatformFlags() & ELF::EF_CUDA_SM_MASK; switch (SM) { // Fermi architecture. @@ -679,7 +681,18 @@ StringRef ELFObjectFileBase::getNVPTXCPUName() const { // Hopper architecture. case ELF::EF_CUDA_SM90: - return getPlatformFlags() & ELF::EF_CUDA_ACCELERATORS ? "sm_90a" : "sm_90"; + return getPlatformFlags() & ELF::EF_CUDA_ACCELERATORS_V1 ? "sm_90a" + : "sm_90"; + + // Blackwell architecture. + case ELF::EF_CUDA_SM100: + return getPlatformFlags() & ELF::EF_CUDA_ACCELERATORS ? "sm_100a" + : "sm_100"; + + // Rubin architecture. + case ELF::EF_CUDA_SM120: + return getPlatformFlags() & ELF::EF_CUDA_ACCELERATORS ? "sm_120a" + : "sm_120"; default: llvm_unreachable("Unknown EF_CUDA_SM value"); } |