From 303df5dd2e0a9e06d1c81c07500a8104e316a43f Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 18 May 2018 14:34:14 -0400
Subject: [PATCH] P4 to Git Change 1556942 by yaxunl@yaxunl-lc8 on 2018/05/18
14:25:12
SWDEV-145570 - [HIP] Change fat binary magic number and clang-offload-bundler target name to match clang
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#11 edit
---
api/hip/hip_platform.cpp | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/api/hip/hip_platform.cpp b/api/hip/hip_platform.cpp
index 386d711275..4ffcc3da87 100644
--- a/api/hip/hip_platform.cpp
+++ b/api/hip/hip_platform.cpp
@@ -29,7 +29,7 @@ THE SOFTWARE.
#include
#include "elfio.hpp"
-constexpr unsigned __cudaFatMAGIC2 = 0x466243b1;
+constexpr unsigned __hipFatMAGIC2 = 0x48495046; // "HIPF"
struct __CudaFatBinaryWrapper {
unsigned int magic;
@@ -39,7 +39,7 @@ struct __CudaFatBinaryWrapper {
};
#define CLANG_OFFLOAD_BUNDLER_MAGIC_STR "__CLANG_OFFLOAD_BUNDLE__"
-#define OPENMP_AMDGCN_AMDHSA_TRIPLE "openmp-amdgcn--amdhsa"
+#define HIP_AMDGCN_AMDHSA_TRIPLE "hip-amdgcn-amd-amdhsa"
#define HCC_AMDGCN_AMDHSA_TRIPLE "hcc-amdgcn-amd-amdhsa-"
struct __ClangOffloadBundleDesc {
@@ -60,7 +60,7 @@ extern "C" hipModule_t __hipRegisterFatBinary(const void* data)
HIP_INIT();
const __CudaFatBinaryWrapper* fbwrapper = reinterpret_cast(data);
- if (fbwrapper->magic != __cudaFatMAGIC2 || fbwrapper->version != 1) {
+ if (fbwrapper->magic != __hipFatMAGIC2 || fbwrapper->version != 1) {
return nullptr;
}
std::string magic((char*)fbwrapper->binary, sizeof(CLANG_OFFLOAD_BUNDLER_MAGIC_STR) - 1);
@@ -78,12 +78,12 @@ extern "C" hipModule_t __hipRegisterFatBinary(const void* data)
desc = reinterpret_cast(
reinterpret_cast(&desc->triple[0]) + desc->tripleSize)) {
- std::string triple(desc->triple, sizeof(OPENMP_AMDGCN_AMDHSA_TRIPLE) - 1);
- if (triple.compare(OPENMP_AMDGCN_AMDHSA_TRIPLE))
+ std::string triple(desc->triple, sizeof(HIP_AMDGCN_AMDHSA_TRIPLE) - 1);
+ if (triple.compare(HIP_AMDGCN_AMDHSA_TRIPLE))
continue;
- std::string target(desc->triple + sizeof(OPENMP_AMDGCN_AMDHSA_TRIPLE),
- desc->tripleSize - sizeof(OPENMP_AMDGCN_AMDHSA_TRIPLE));
+ std::string target(desc->triple + sizeof(HIP_AMDGCN_AMDHSA_TRIPLE),
+ desc->tripleSize - sizeof(HIP_AMDGCN_AMDHSA_TRIPLE));
if (target.compare(hip::getCurrentContext()->devices()[0]->info().name_))
continue;