[vdi] Fix hipGetSymbol{Address|Size}
- Use symbol value as the qeury key. Compared to the symbol name, the
symbol value is more robust as developers may use unqualified or
qualified identifiers. It also removes the mangling and/or demangling
requirement for the runtime API.
Change-Id: I9d4259f3842612c7cc98551269fc2092d8b5c19e
[ROCm/hip commit: b72196613a]
Этот коммит содержится в:
1 родитель
24cd888b3a
Коммит
5e5f4e23d5
5 files changed
+114
-27
No files matched your search
@@ -717,15 +717,19 @@ hipError_t hipHostAlloc(void** ptr, size_t sizeBytes, unsigned int flags) {
|
||||
};
|
||||
|
||||
|
||||
hipError_t hipMemcpyToSymbol(const void* symbolName, const void* src, size_t count,
|
||||
hipError_t hipMemcpyToSymbol(const void* symbol, const void* src, size_t count,
|
||||
size_t offset, hipMemcpyKind kind) {
|
||||
HIP_INIT_API(hipMemcpyToSymbol, symbolName, src, count, offset, kind);
|
||||
HIP_INIT_API(hipMemcpyToSymbol, symbol, src, count, offset, kind);
|
||||
|
||||
size_t sym_size = 0;
|
||||
hipDeviceptr_t device_ptr = nullptr;
|
||||
|
||||
std::string symbolName;
|
||||
if (!PlatformState::instance().findSymbol(symbol, symbolName)) {
|
||||
HIP_RETURN(hipErrorInvalidSymbol);
|
||||
}
|
||||
/* Get address and size for the global symbol */
|
||||
if (!PlatformState::instance().getGlobalVar(symbolName, ihipGetDevice(), nullptr,
|
||||
if (!PlatformState::instance().getGlobalVar(symbolName.c_str(), ihipGetDevice(), nullptr,
|
||||
&device_ptr, &sym_size)) {
|
||||
HIP_RETURN(hipErrorInvalidSymbol);
|
||||
}
|
||||
@@ -741,15 +745,19 @@ hipError_t hipMemcpyToSymbol(const void* symbolName, const void* src, size_t cou
|
||||
HIP_RETURN(hipMemcpy(device_ptr, src, count, kind));
|
||||
}
|
||||
|
||||
hipError_t hipMemcpyFromSymbol(void* dst, const void* symbolName, size_t count,
|
||||
hipError_t hipMemcpyFromSymbol(void* dst, const void* symbol, size_t count,
|
||||
size_t offset, hipMemcpyKind kind) {
|
||||
HIP_INIT_API(hipMemcpyFromSymbol, symbolName, dst, count, offset, kind);
|
||||
HIP_INIT_API(hipMemcpyFromSymbol, symbol, dst, count, offset, kind);
|
||||
|
||||
size_t sym_size = 0;
|
||||
hipDeviceptr_t device_ptr = nullptr;
|
||||
|
||||
std::string symbolName;
|
||||
if (!PlatformState::instance().findSymbol(symbol, symbolName)) {
|
||||
HIP_RETURN(hipErrorInvalidSymbol);
|
||||
}
|
||||
/* Get address and size for the global symbol */
|
||||
if (!PlatformState::instance().getGlobalVar(symbolName, ihipGetDevice(), nullptr,
|
||||
if (!PlatformState::instance().getGlobalVar(symbolName.c_str(), ihipGetDevice(), nullptr,
|
||||
&device_ptr, &sym_size)) {
|
||||
HIP_RETURN(hipErrorInvalidSymbol);
|
||||
}
|
||||
@@ -765,15 +773,19 @@ hipError_t hipMemcpyFromSymbol(void* dst, const void* symbolName, size_t count,
|
||||
HIP_RETURN(hipMemcpy(dst, device_ptr, count, kind));
|
||||
}
|
||||
|
||||
hipError_t hipMemcpyToSymbolAsync(const void* symbolName, const void* src, size_t count,
|
||||
hipError_t hipMemcpyToSymbolAsync(const void* symbol, const void* src, size_t count,
|
||||
size_t offset, hipMemcpyKind kind, hipStream_t stream) {
|
||||
HIP_INIT_API(hipMemcpyToSymbolAsync, symbolName, src, count, offset, kind, stream);
|
||||
HIP_INIT_API(hipMemcpyToSymbolAsync, symbol, src, count, offset, kind, stream);
|
||||
|
||||
size_t sym_size = 0;
|
||||
hipDeviceptr_t device_ptr = nullptr;
|
||||
|
||||
std::string symbolName;
|
||||
if (!PlatformState::instance().findSymbol(symbol, symbolName)) {
|
||||
HIP_RETURN(hipErrorInvalidSymbol);
|
||||
}
|
||||
/* Get address and size for the global symbol */
|
||||
if (!PlatformState::instance().getGlobalVar(symbolName, ihipGetDevice(), nullptr,
|
||||
if (!PlatformState::instance().getGlobalVar(symbolName.c_str(), ihipGetDevice(), nullptr,
|
||||
&device_ptr, &sym_size)) {
|
||||
HIP_RETURN(hipErrorInvalidSymbol);
|
||||
}
|
||||
@@ -789,15 +801,19 @@ hipError_t hipMemcpyToSymbolAsync(const void* symbolName, const void* src, size_
|
||||
HIP_RETURN(hipMemcpyAsync(device_ptr, src, count, kind, stream));
|
||||
}
|
||||
|
||||
hipError_t hipMemcpyFromSymbolAsync(void* dst, const void* symbolName, size_t count,
|
||||
hipError_t hipMemcpyFromSymbolAsync(void* dst, const void* symbol, size_t count,
|
||||
size_t offset, hipMemcpyKind kind, hipStream_t stream) {
|
||||
HIP_INIT_API(hipMemcpyFromSymbolAsync, symbolName, dst, count, offset, kind, stream);
|
||||
HIP_INIT_API(hipMemcpyFromSymbolAsync, symbol, dst, count, offset, kind, stream);
|
||||
|
||||
size_t sym_size = 0;
|
||||
hipDeviceptr_t device_ptr = nullptr;
|
||||
|
||||
std::string symbolName;
|
||||
if (!PlatformState::instance().findSymbol(symbol, symbolName)) {
|
||||
HIP_RETURN(hipErrorInvalidSymbol);
|
||||
}
|
||||
/* Get address and size for the global symbol */
|
||||
if (!PlatformState::instance().getGlobalVar(symbolName, ihipGetDevice(), nullptr,
|
||||
if (!PlatformState::instance().getGlobalVar(symbolName.c_str(), ihipGetDevice(), nullptr,
|
||||
&device_ptr, &sym_size)) {
|
||||
HIP_RETURN(hipErrorInvalidSymbol);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user