Introduce ihipModuleGetGlobal

This commit is contained in:
Michael Kuron
2018-11-06 09:54:34 +01:00
parent 8049cdafab
commit 4da2d92281
3 changed files with 14 additions and 6 deletions
@@ -2360,6 +2360,9 @@ hipError_t hipFuncGetAttributes(hipFuncAttributes* attr, const void* func);
hipError_t hipModuleGetGlobal(hipDeviceptr_t* dptr, size_t* bytes, hipModule_t hmod,
const char* name);
hipError_t ihipModuleGetGlobal(hipDeviceptr_t* dptr, size_t* bytes, hipModule_t hmod,
const char* name);
hipError_t hipModuleGetTexRef(textureReference** texRef, hipModule_t hmod, const char* name);
/**
* @brief builds module from code object which resides in host memory. Image is pointer to that
+3 -3
View File
@@ -953,7 +953,7 @@ inline hipDeviceptr_t agent_address_for_symbol(const char* symbolName) {
#if __hcc_workweek__ >= 17481
size_t byte_cnt = 0u;
hipModuleGetGlobal(&r, &byte_cnt, 0, symbolName);
ihipModuleGetGlobal(&r, &byte_cnt, 0, symbolName);
#else
auto ctx = ihipGetTlsDefaultCtx();
auto acc = ctx->getDevice()->_acc;
@@ -1104,7 +1104,7 @@ hipError_t hipGetSymbolAddress(void** devPtr, const void* symbolName) {
HIP_INIT_SPECIAL_API((TRACE_MCMD), devPtr, symbolName);
size_t size = 0;
return hipModuleGetGlobal(devPtr, &size, 0, static_cast<const char*>(symbolName));
return ihipModuleGetGlobal(devPtr, &size, 0, static_cast<const char*>(symbolName));
}
@@ -1112,7 +1112,7 @@ hipError_t hipGetSymbolSize(size_t* size, const void* symbolName) {
HIP_INIT_SPECIAL_API((TRACE_MCMD), size, symbolName);
void* devPtr = nullptr;
return hipModuleGetGlobal(&devPtr, size, 0, static_cast<const char*>(symbolName));
return ihipModuleGetGlobal(&devPtr, size, 0, static_cast<const char*>(symbolName));
}
+8 -3
View File
@@ -463,14 +463,19 @@ hipError_t hipModuleGetGlobal(hipDeviceptr_t* dptr, size_t* bytes, hipModule_t h
const char* name) {
HIP_INIT_API(dptr, bytes, hmod, name);
if (!dptr || !bytes) return ihipLogStatus(hipErrorInvalidValue);
return ihipLogStatus(ihipModuleGetGlobal(dptr, bytes, hmod, name));
}
if (!name) return ihipLogStatus(hipErrorNotInitialized);
hipError_t ihipModuleGetGlobal(hipDeviceptr_t* dptr, size_t* bytes, hipModule_t hmod,
const char* name) {
if (!dptr || !bytes) return hipErrorInvalidValue;
if (!name) return hipErrorNotInitialized;
const auto r = hmod ? read_agent_global_from_module(dptr, bytes, hmod, name)
: read_agent_global_from_process(dptr, bytes, name);
return ihipLogStatus(r);
return r;
}
namespace