Don't duplicate embedded code objects (#1991)

If the code object is embedded in an already mapped file, and the
lifetime of the mapped file exceeds the lifetime of the executable,
we do not need to make a copy of the binary.

This allows the ROCR to present the code object URI as
file:///path/to/file#offset=X&size=Y.

[ROCm/hip commit: 9de5e90ab5]
This commit is contained in:
lmoriche
2020-04-06 03:07:35 -07:00
committed by GitHub
orang tua 57bab41a1c
melakukan 20be734e5e
4 mengubah file dengan 30 tambahan dan 9 penghapusan
+3 -3
Melihat File
@@ -89,9 +89,9 @@ __hipRegisterFatBinary(const void* data)
reinterpret_cast<uintptr_t>(header) + desc->offset), desc->size};
if (HIP_DUMP_CODE_OBJECT)
__hipDumpCodeObject(image);
module->executable = hip_impl::get_program_state().load_executable(image.data(), image.size(),
module->executable,
agent);
module->executable = hip_impl::get_program_state().load_executable_no_copy(
reinterpret_cast<const char*>(header) + desc->offset, desc->size,
module->executable, agent);
if (module->executable.handle) {
modules->at(deviceId) = module;