From 7d49dcc03006f93728e53d4e02f1d46a9cafcb15 Mon Sep 17 00:00:00 2001 From: Aditya Atluri Date: Mon, 27 Mar 2017 11:00:39 -0500 Subject: [PATCH] Re-enabled metadata parsing in HIP Change-Id: If8caa844571cb8581450df9ffdb76e2445c75f13 --- CMakeLists.txt | 4 ++-- bin/hipcc | 3 ++- src/hip_module.cpp | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16f43d38c5..dcecaa8d2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -190,11 +190,11 @@ if(HIP_PLATFORM STREQUAL "hcc") execute_process(COMMAND ${HCC_HOME}/bin/hcc-config --ldflags OUTPUT_VARIABLE HCC_LD_FLAGS) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${HCC_LD_FLAGS} -Wl,-Bsymbolic") -# find_package(LLVM HINTS "/opt/rocm/llvm") + find_package(LLVM HINTS ${HCC_HOME}/compiler/lib/cmake) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --amdgpu-target=gfx701 --amdgpu-target=gfx801 --amdgpu-target=gfx802 --amdgpu-target=gfx803 --amdgpu-target=gfx900") add_library(hip_hcc SHARED ${SOURCE_FILES_RUNTIME}) target_link_libraries(hip_hcc PRIVATE hc_am) -# target_link_libraries(hip_hcc PUBLIC LLVMAMDGPUUtils) + target_link_libraries(hip_hcc PUBLIC LLVMAMDGPUUtils) add_library(hip_hcc_static STATIC ${SOURCE_FILES_RUNTIME}) target_link_libraries(hip_hcc_static PRIVATE hc_am) add_dependencies(hip_hcc_static hip_hcc) diff --git a/bin/hipcc b/bin/hipcc index a08d5c952b..3dd8c2d60b 100755 --- a/bin/hipcc +++ b/bin/hipcc @@ -129,7 +129,8 @@ if ($HIP_PLATFORM eq "hcc") { $HIPCXXFLAGS .= " -Wno-deprecated-register"; $HIPLDFLAGS .= " -lsupc++"; - $HIPLDFLAGS .= " -L$HSA_PATH/lib -L$ROCM_PATH/lib -lhsa-runtime64 -lhc_am -lhsakmt";# `${LLVM_HOME}/bin/llvm-config --ldflags --libs`"; + $HIPLDFLAGS .= " -L$HSA_PATH/lib -L$ROCM_PATH/lib -lhsa-runtime64 -lhc_am -lhsakmt "; + $HIPLDFLAGS .= " -L$HCC_HOME/compiler/lib -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMMC -lLLVMCore -lLLVMSupport "; # Add trace marker library: # TODO - once we cleanly separate the HIP API headers from HIP library headers this logic should move to CMakebuild option - apps do not need to see the marker library. diff --git a/src/hip_module.cpp b/src/hip_module.cpp index 3bca2090ff..dc0a681c6d 100644 --- a/src/hip_module.cpp +++ b/src/hip_module.cpp @@ -202,7 +202,7 @@ hipError_t hipModuleLoad(hipModule_t *module, const char *fname){ (*module)->size = size; in.seekg(0, std::ios::beg); std::copy(std::istreambuf_iterator(in), std::istreambuf_iterator(), ptr); -/* Enable for metadata implementation + Elf *e = elf_memory((char*)p, size); if(elf_kind(e) != ELF_K_ELF){ return ihipLogStatus(hipErrorInvalidValue); @@ -251,7 +251,7 @@ hipError_t hipModuleLoad(hipModule_t *module, const char *fname){ } } } -*/ + status = hsa_code_object_deserialize(ptr, size, NULL, &(*module)->object); if(status != HSA_STATUS_SUCCESS){