reimplement HIP_INIT as hip_impl::hip_init(), add hip_init() to some of the inlined API (#966)
* reimplement HIP_INIT as a function, expose it as hip_impl::hip_init() so that it could be called from hipLaunchKernelGGL and other inlined HIP functions * Don't call hip_init from ihipPreLaunchKernel
This commit is contained in:
committed by
Maneesh Gupta
szülő
b1752fc9a6
commit
24d08beef8
@@ -189,6 +189,7 @@ inline
|
||||
void hipLaunchKernelGGL(F kernel, const dim3& numBlocks, const dim3& dimBlocks,
|
||||
std::uint32_t sharedMemBytes, hipStream_t stream,
|
||||
Args... args) {
|
||||
hip_impl::hip_init();
|
||||
auto kernarg = hip_impl::make_kernarg(
|
||||
kernel, std::tuple<Args...>{std::move(args)...});
|
||||
std::size_t kernarg_size = kernarg.size();
|
||||
@@ -212,4 +213,4 @@ inline void hipLaunchKernel(F kernel, const dim3& numBlocks, const dim3& dimBloc
|
||||
std::uint32_t groupMemBytes, hipStream_t stream, Args... args) {
|
||||
hipLaunchKernelGGL(kernel, numBlocks, dimBlocks, groupMemBytes, stream, hipLaunchParm{},
|
||||
std::move(args)...);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,10 @@ THE SOFTWARE.
|
||||
#define __dparm(x)
|
||||
#endif
|
||||
|
||||
namespace hip_impl {
|
||||
hipError_t hip_init();
|
||||
} // namespace hip_impl
|
||||
|
||||
// Structure definitions:
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -1396,7 +1400,7 @@ inline
|
||||
__attribute__((visibility("hidden")))
|
||||
hipError_t hipGetSymbolAddress(void** devPtr, const void* symbolName) {
|
||||
//HIP_INIT_API(hipGetSymbolAddress, devPtr, symbolName);
|
||||
|
||||
hip_impl::hip_init();
|
||||
size_t size = 0;
|
||||
return hipModuleGetGlobal(devPtr, &size, 0, (const char*)symbolName);
|
||||
}
|
||||
@@ -1416,7 +1420,7 @@ inline
|
||||
__attribute__((visibility("hidden")))
|
||||
hipError_t hipGetSymbolSize(size_t* size, const void* symbolName) {
|
||||
// HIP_INIT_API(hipGetSymbolSize, size, symbolName);
|
||||
|
||||
hip_impl::hip_init();
|
||||
void* devPtr = nullptr;
|
||||
return hipModuleGetGlobal(&devPtr, size, 0, (const char*)symbolName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user