add error checking for code object loading

[ROCm/hip commit: 6ecd303d94]
This commit is contained in:
Siu Chi Chan
2019-11-28 14:00:48 -05:00
parent f1544b621d
commit 7aee8f9803
+11 -5
View File
@@ -398,13 +398,19 @@ public:
move(file), move(tmp));
}
hsa_code_object_reader_create_from_memory(
it->first.data(), it->first.size(), it->second.get());
auto check_hsa_error = [](hsa_status_t s) {
if (s != HSA_STATUS_SUCCESS) {
hip_throw(std::runtime_error{"error when loading code object"});
}
};
hsa_executable_load_agent_code_object(
executable, agent, *it->second, nullptr, nullptr);
check_hsa_error(hsa_code_object_reader_create_from_memory(
it->first.data(), it->first.size(), it->second.get()));
hsa_executable_freeze(executable, nullptr);
check_hsa_error(hsa_executable_load_agent_code_object(
executable, agent, *it->second, nullptr, nullptr));
check_hsa_error(hsa_executable_freeze(executable, nullptr));
}