Merge pull request #748 from mkuron/getsymboladdress
Implement hipGetSymbolAddress and hipGetSymbolSize
[ROCm/clr commit: 40d3184dd1]
This commit is contained in:
@@ -961,7 +961,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;
|
||||
@@ -1106,6 +1106,23 @@ hipError_t hipMemcpyFromSymbolAsync(void* dst, const void* symbolName, size_t co
|
||||
return ihipLogStatus(e);
|
||||
}
|
||||
|
||||
|
||||
hipError_t hipGetSymbolAddress(void** devPtr, const void* symbolName) {
|
||||
HIP_INIT_API(devPtr, symbolName);
|
||||
|
||||
size_t size = 0;
|
||||
return ihipModuleGetGlobal(devPtr, &size, 0, static_cast<const char*>(symbolName));
|
||||
}
|
||||
|
||||
|
||||
hipError_t hipGetSymbolSize(size_t* size, const void* symbolName) {
|
||||
HIP_INIT_API(size, symbolName);
|
||||
|
||||
void* devPtr = nullptr;
|
||||
return ihipModuleGetGlobal(&devPtr, size, 0, static_cast<const char*>(symbolName));
|
||||
}
|
||||
|
||||
|
||||
//---
|
||||
hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind) {
|
||||
HIP_INIT_SPECIAL_API((TRACE_MCMD), dst, src, sizeBytes, kind);
|
||||
|
||||
@@ -472,14 +472,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
|
||||
|
||||
Reference in New Issue
Block a user