SWDEV-446992 - Request can be for bytes OR dptr OR both.
Change-Id: Ib479c744b90125b74d99cbf18b7f4b8cf765bf1c
[ROCm/clr commit: 09328f45b3]
Этот коммит содержится в:
коммит произвёл
Jaydeepkumar Patel
родитель
0f8a9567e6
Коммит
c4239ed8e8
@@ -96,8 +96,12 @@ public:
|
||||
hipError_t getManagedVarPointer(std::string name, void** pointer, size_t* size_ptr) const {
|
||||
auto it = vars_.find(name);
|
||||
if (it != vars_.end() && it->second->getVarKind() == Var::DVK_Managed) {
|
||||
*pointer = it->second->getManagedVarPtr();
|
||||
*size_ptr = it->second->getSize();
|
||||
if (pointer != nullptr) {
|
||||
*pointer = it->second->getManagedVarPtr();
|
||||
}
|
||||
if (size_ptr != nullptr) {
|
||||
*size_ptr = it->second->getSize();
|
||||
}
|
||||
}
|
||||
return hipSuccess;
|
||||
}
|
||||
|
||||
@@ -92,10 +92,6 @@ hipError_t hipModuleGetGlobal(hipDeviceptr_t* dptr, size_t* bytes, hipModule_t h
|
||||
const char* name) {
|
||||
HIP_INIT_API(hipModuleGetGlobal, dptr, bytes, hmod, name);
|
||||
|
||||
if (dptr == nullptr || bytes == nullptr) {
|
||||
// If either is nullptr, ignore it
|
||||
HIP_RETURN(hipSuccess);
|
||||
}
|
||||
if ((dptr == nullptr && bytes == nullptr) || name == nullptr || strlen(name) == 0) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
@@ -788,7 +788,7 @@ hipError_t PlatformState::getDynGlobalVar(const char* hostVar, hipModule_t hmod,
|
||||
hipDeviceptr_t* dev_ptr, size_t* size_ptr) {
|
||||
amd::ScopedLock lock(lock_);
|
||||
|
||||
if (hostVar == nullptr || dev_ptr == nullptr || size_ptr == nullptr) {
|
||||
if (hostVar == nullptr) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
|
||||
@@ -797,14 +797,20 @@ hipError_t PlatformState::getDynGlobalVar(const char* hostVar, hipModule_t hmod,
|
||||
LogPrintfError("Cannot find the module: 0x%x", hmod);
|
||||
return hipErrorNotFound;
|
||||
}
|
||||
*dev_ptr = nullptr;
|
||||
if (dev_ptr) {
|
||||
*dev_ptr = nullptr;
|
||||
}
|
||||
IHIP_RETURN_ONFAIL(it->second->getManagedVarPointer(hostVar, dev_ptr, size_ptr));
|
||||
// if dev_ptr is nullptr, hostvar is not in managed variable list
|
||||
if (*dev_ptr == nullptr) {
|
||||
if ((dev_ptr && *dev_ptr == nullptr) || (size_ptr && *size_ptr == 0)) {
|
||||
hip::DeviceVar* dvar = nullptr;
|
||||
IHIP_RETURN_ONFAIL(it->second->getDeviceVar(&dvar, hostVar));
|
||||
*dev_ptr = dvar->device_ptr();
|
||||
*size_ptr = dvar->size();
|
||||
if (dev_ptr != nullptr) {
|
||||
*dev_ptr = dvar->device_ptr();
|
||||
}
|
||||
if (size_ptr != nullptr) {
|
||||
*size_ptr = dvar->size();
|
||||
}
|
||||
}
|
||||
return hipSuccess;
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user