Support defaultDriver test with Clang+Hcc Runtime

Fix the following issues:
1.Ignore hidden arguments of kernel functions.
2.Look up both origial function name and function name with .kd postfix
when argments are retrived from module.
3.Addition, fix compiling issue of LaunchKernel test app.

Change-Id: I9400943f2f02433cb4409b19c0cac3626c2bc454


[ROCm/clr commit: eb8c4d1ce2]
This commit is contained in:
Tao Sang committed 2020-02-15 19:29:13 -05:00
1 parent ca7c148089
commit 53e62f704d
3 files changed
+40 -9

No files matched your search

+13 -3
View File
@@ -1030,19 +1030,29 @@ hipError_t ihipModuleGetFunction(TlsData *tls, hipFunction_t* func, hipModule_t
if (!*func) return hipErrorInvalidValue;
std::string name_str(name);
std::string namekd_str(name_str + ".kd");
auto kernel = find_kernel_by_name(hmod->executable, name_str.c_str(), agent);
if (kernel.handle == 0u) {
name_str.append(".kd");
kernel = find_kernel_by_name(hmod->executable, name_str.c_str(), agent);
kernel = find_kernel_by_name(hmod->executable, namekd_str.c_str(), agent);
}
if (kernel.handle == 0u) return hipErrorNotFound;
auto it = hmod->kernargs.find(name_str); //Look up args from the original name
if (it == hmod->kernargs.end()) {
it = hmod->kernargs.find(namekd_str); //Look up args from .kd name
if (it == hmod->kernargs.end()) {
return hipErrorNotFound;
}
}
// TODO: refactor the whole ihipThisThat, which is a mess and yields the
// below, due to hipFunction_t being a pointer to ihipModuleSymbol_t.
func[0][0] = *static_cast<hipFunction_t>(
Kernel_descriptor{kernel_object(kernel), name_str, hmod->kernargs[name_str]});
Kernel_descriptor{kernel_object(kernel), name_str, it->second});
return hipSuccess;
}