Let hip-clang support --genco

Cette révision appartient à :
Yaxun Sam Liu
2018-11-13 22:28:00 -05:00
Parent dc5aea4b03
révision 450f093231
6 fichiers modifiés avec 165 ajouts et 37 suppressions
+7
Voir le fichier
@@ -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);