Let hip-clang support --genco

[ROCm/clr commit: 988dcd1e4a]
This commit is contained in:
Yaxun Sam Liu committed 2018-11-27 15:55:50 -05:00
1 parent 44c2f4cae1
commit f2e2eb68e7
6 files changed
+165 -37

No files matched your search

+7
View File
@@ -48,6 +48,7 @@ THE SOFTWARE.
#include <utility>
#include <vector>
#include "../include/hip/hcc_detail/code_object_bundle.hpp"
#include "hip_fatbin.h"
// TODO Use Pool APIs from HCC to get memory regions.
using namespace ELFIO;
@@ -556,6 +557,12 @@ hipError_t ihipModuleLoadData(hipModule_t* module, const void* image) {
auto ctx = ihipGetTlsDefaultCtx();
if (!ctx) return hipErrorInvalidContext;
// try extracting code object from image as fatbin.
char name[64] = {};
hsa_agent_get_info(this_agent(), HSA_AGENT_INFO_NAME, name);
if (auto *code_obj = __hipExtractCodeObjectFromFatBinary(image, name))
image = code_obj;
hsa_executable_create_alt(HSA_PROFILE_FULL, HSA_DEFAULT_FLOAT_ROUNDING_MODE_DEFAULT, nullptr,
&(*module)->executable);