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
This commit is contained in:
Tao Sang
2020-02-15 18:41:15 -05:00
vanhempi 9bdc203a99
commit eb8c4d1ce2
3 muutettua tiedostoa jossa 40 lisäystä ja 9 poistoa
+13 -3
Näytä tiedosto
@@ -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;
}