Support hipFuncGetAttributes with hip-clang+Hcc RT

Fix issues of missing kernel function symbols and missing argument list via
using __hipRegister* functions.
Then the following tests can pass,
directed_tests/runtimeApi/module/hipFuncGetAttributes
directed_tests/runtimeApi/module/hipExtLaunchMultiKernelMultiDevice
directed_tests/gcc/LaunchKernel

Change-Id: I52135b61e8283eb4f9f10f77895151e4e55418d9


[ROCm/clr commit: 4a113bb669]
This commit is contained in:
Tao Sang
2020-03-25 18:47:28 -04:00
parent 0333a3c226
commit 8218ede5e8
5 changed files with 67 additions and 13 deletions
+9 -5
View File
@@ -19,6 +19,8 @@
#include <hsa/hsa_ven_amd_loader.h>
#include <amd_comgr.h>
#include "hc.hpp"
#include "hip_hcc_internal.h"
#include "trace_helper.h"
#include <link.h>
@@ -944,14 +946,16 @@ public:
auto it0 = get_functions(agent).find(function_address);
if (it0 == get_functions(agent).cend()) {
hip_throw(std::runtime_error{
if (it0 != get_functions(agent).cend()) return it0->second;
// For hip-clang compiler + Hcc RT
hipFunction_t f = ihipGetDeviceFunction((const void*)function_address);
if (f) return reinterpret_cast<Kernel_descriptor&>(*f);
hip_throw(std::runtime_error{
"No device code available for function: " +
std::string(name(function_address)) +
", for agent: " + name(agent)});
}
return it0->second;
}
const std::vector<std::pair<std::size_t, std::size_t>>&