P4 to Git Change 1787806 by yaxunl@yaxunl-lc10 on 2019/05/27 10:53:56
SWDEV-145570 - Support loading fat binary generated through --genco by hipModuleLoad. hip-clang --genco generates fat binary instead of code object. To support that we need to extract code object from fat binary in hipModuleLoadData. This is needed for hipRTC since multiple GPU archs may be passed. Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_module.cpp#27 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#31 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.cpp#42 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#308 edit
This commit is contained in:
@@ -93,8 +93,16 @@ hipError_t hipModuleLoadData(hipModule_t *module, const void *image)
|
||||
HIP_RETURN(ihipModuleLoadData(module, image));
|
||||
}
|
||||
|
||||
extern bool __hipExtractCodeObjectFromFatBinary(const void* data,
|
||||
const std::vector<const char*>& devices,
|
||||
std::vector<std::pair<const void*, size_t>>& code_objs);
|
||||
|
||||
hipError_t ihipModuleLoadData(hipModule_t *module, const void *image)
|
||||
{
|
||||
std::vector<std::pair<const void*, size_t>> code_objs;
|
||||
if (__hipExtractCodeObjectFromFatBinary(image, {hip::getCurrentContext()->devices()[0]->info().name_}, code_objs))
|
||||
image = code_objs[0].first;
|
||||
|
||||
amd::Program* program = new amd::Program(*hip::getCurrentContext());
|
||||
if (program == NULL) {
|
||||
return hipErrorOutOfMemory;
|
||||
|
||||
Viittaa uudesa ongelmassa
Block a user