P4 to Git Change 2005774 by kjayapra@3_HIPWS_P2P_ROCM2 on 2019/09/27 17:54:03
SWDEV-144570 - Adding extern var support for dynamically loaded modules for Texture reference.
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_internal.hpp#43 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_module.cpp#42 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#43 edit
[ROCm/clr commit: fa60a0083f]
This commit is contained in:
1 parent
e3381953aa
commit
e5a3d884a2
3 files changed
+65
-11
No files matched your search
@@ -173,6 +173,11 @@ std::vector< std::pair<hipModule_t, bool> >* PlatformState::unregisterVar(hipMod
|
||||
DeviceVar& dvar = it->second;
|
||||
if ((*dvar.modules)[0].first == hmod) {
|
||||
rmodules = dvar.modules;
|
||||
if (dvar.dyn_undef) {
|
||||
texture<float, hipTextureType1D, hipReadModeElementType>* tex_hptr
|
||||
= reinterpret_cast<texture<float, hipTextureType1D, hipReadModeElementType> *>(dvar.shadowVptr);
|
||||
delete tex_hptr;
|
||||
}
|
||||
vars_.erase(it++);
|
||||
} else {
|
||||
++it;
|
||||
@@ -287,6 +292,22 @@ bool PlatformState::getFuncAttr(const void* hostFunction,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PlatformState::getTexRef(const char* hostVar, textureReference** texRef) {
|
||||
amd::ScopedLock lock(lock_);
|
||||
const auto it = vars_.find(std::string(reinterpret_cast<const char*>(hostVar)));
|
||||
if (it == vars_.cend()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DeviceVar& dvar = it->second;
|
||||
if (!dvar.dyn_undef) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*texRef = reinterpret_cast<textureReference *>(dvar.shadowVptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PlatformState::getGlobalVar(const void* hostVar, int deviceId,
|
||||
hipDeviceptr_t* dev_ptr, size_t* size_ptr) {
|
||||
amd::ScopedLock lock(lock_);
|
||||
@@ -380,7 +401,7 @@ extern "C" void __hipRegisterVar(
|
||||
HIP_INIT();
|
||||
|
||||
PlatformState::DeviceVar dvar{var, std::string{ hostVar }, static_cast<size_t>(size), modules,
|
||||
std::vector<PlatformState::RegisteredVar>{ g_devices.size() } };
|
||||
std::vector<PlatformState::RegisteredVar>{ g_devices.size() }, false };
|
||||
|
||||
PlatformState::instance().registerVar(hostVar, dvar);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user