Make hipModuleGetGlobal be in HIP runtime so it can be discovered at runtime (#981)
* Make hipModuleGetGlobal be in HIP runtime so it can be discovered at runtime In HIP PR #929, quite a few HIP public APIs were made as inline functions with hidden visibility. It was necessary to support applications with shared libraries with GPU kernels launched via hipLaunchKernelGGL(), after HIP runtime is initialized. In empirical tests, the implementation has been proved to be a bit too excessive, especially for hipModuleGetGlobal(). The function is used by another type of client applications which relies on the existence of this function within HIP runtime so global symbols from HSA code objects loaded dynamically at runtime can be retrieved programmtically. This commit moves hipModuleGetGlobal() back to src/hip_module.cpp, and makes it visible and not inline, to fulfill requirements for applications aforementioned. It does not change the behavior of applications depending on hipLaunchKernelGGL(). * Add HIP_INIT_API into the implementation of hipModuleGetGlobal Address review comments. * Fix failing HIP unit tests
This commit is contained in:
committed by
Maneesh Gupta
parent
f9f4cee347
commit
04915cea2f
@@ -282,6 +282,16 @@ hipError_t hipHccModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
|
||||
localWorkSizeZ, sharedMemBytes, hStream, kernelParams, extra, startEvent, stopEvent, 0));
|
||||
}
|
||||
|
||||
hipError_t hipModuleGetGlobal(hipDeviceptr_t* dptr, size_t* bytes,
|
||||
hipModule_t hmod, const char* name) {
|
||||
HIP_INIT_API(hipModuleGetGlobal, dptr, bytes, hmod, name);
|
||||
if (!dptr || !bytes || !hmod) return hipErrorInvalidValue;
|
||||
|
||||
if (!name) return hipErrorNotInitialized;
|
||||
|
||||
return hip_impl::read_agent_global_from_module(dptr, bytes, hmod, name);
|
||||
}
|
||||
|
||||
namespace hip_impl {
|
||||
hsa_executable_t executable_for(hipModule_t hmod) {
|
||||
return hmod->executable;
|
||||
|
||||
Reference in New Issue
Block a user