removing the workaround for hipMalloc / hipHostMalloc
This commit is contained in:
parent
fc9e5a9435
commit
699ff43685
@ -20,6 +20,8 @@ limitations under the License.
|
|||||||
|
|
||||||
#if TENSORFLOW_USE_ROCM
|
#if TENSORFLOW_USE_ROCM
|
||||||
|
|
||||||
|
#define __HIP_DISABLE_CPP_FUNCTIONS__
|
||||||
|
|
||||||
#include "rocm/include/hip/hip_complex.h"
|
#include "rocm/include/hip/hip_complex.h"
|
||||||
#include "rocm/include/hip/hip_runtime.h"
|
#include "rocm/include/hip/hip_runtime.h"
|
||||||
#include "rocm/include/hiprand/hiprand.h"
|
#include "rocm/include/hiprand/hiprand.h"
|
||||||
|
@ -671,7 +671,7 @@ GpuDriver::ContextGetSharedMemConfig(GpuContext* context) {
|
|||||||
uint64 bytes) {
|
uint64 bytes) {
|
||||||
ScopedActivateContext activated{context};
|
ScopedActivateContext activated{context};
|
||||||
hipDeviceptr_t result = 0;
|
hipDeviceptr_t result = 0;
|
||||||
hipError_t res = tensorflow::wrap::hipMallocVanilla(&result, bytes);
|
hipError_t res = tensorflow::wrap::hipMalloc(&result, bytes);
|
||||||
if (res != hipSuccess) {
|
if (res != hipSuccess) {
|
||||||
LOG(ERROR) << "failed to allocate "
|
LOG(ERROR) << "failed to allocate "
|
||||||
<< port::HumanReadableNumBytes::ToString(bytes) << " (" << bytes
|
<< port::HumanReadableNumBytes::ToString(bytes) << " (" << bytes
|
||||||
@ -717,7 +717,7 @@ GpuDriver::ContextGetSharedMemConfig(GpuContext* context) {
|
|||||||
ScopedActivateContext activation{context};
|
ScopedActivateContext activation{context};
|
||||||
void* host_mem = nullptr;
|
void* host_mem = nullptr;
|
||||||
// "Portable" memory is visible to all ROCM contexts. Safe for our use model.
|
// "Portable" memory is visible to all ROCM contexts. Safe for our use model.
|
||||||
hipError_t res = tensorflow::wrap::hipHostMallocVanilla(
|
hipError_t res = tensorflow::wrap::hipHostMalloc(
|
||||||
&host_mem, bytes, hipHostMallocPortable);
|
&host_mem, bytes, hipHostMallocPortable);
|
||||||
if (res != hipSuccess) {
|
if (res != hipSuccess) {
|
||||||
LOG(ERROR) << "failed to alloc " << bytes
|
LOG(ERROR) << "failed to alloc " << bytes
|
||||||
|
@ -20,6 +20,8 @@ limitations under the License.
|
|||||||
#ifndef TENSORFLOW_STREAM_EXECUTOR_ROCM_ROCM_DRIVER_WRAPPER_H_
|
#ifndef TENSORFLOW_STREAM_EXECUTOR_ROCM_ROCM_DRIVER_WRAPPER_H_
|
||||||
#define TENSORFLOW_STREAM_EXECUTOR_ROCM_ROCM_DRIVER_WRAPPER_H_
|
#define TENSORFLOW_STREAM_EXECUTOR_ROCM_ROCM_DRIVER_WRAPPER_H_
|
||||||
|
|
||||||
|
#define __HIP_DISABLE_CPP_FUNCTIONS__
|
||||||
|
|
||||||
#include "rocm/include/hip/hip_runtime.h"
|
#include "rocm/include/hip/hip_runtime.h"
|
||||||
#include "tensorflow/stream_executor/lib/env.h"
|
#include "tensorflow/stream_executor/lib/env.h"
|
||||||
#include "tensorflow/stream_executor/platform/dso_loader.h"
|
#include "tensorflow/stream_executor/platform/dso_loader.h"
|
||||||
@ -48,21 +50,6 @@ namespace wrap {
|
|||||||
#define TO_STR_(x) #x
|
#define TO_STR_(x) #x
|
||||||
#define TO_STR(x) TO_STR_(x)
|
#define TO_STR(x) TO_STR_(x)
|
||||||
|
|
||||||
// hipMalloc and hipHostMalloc are defined as funtion templates in the
|
|
||||||
// HIP header files, and hence their names get mangled and the attempt
|
|
||||||
// to resolve their name when trying to dynamically load them will fail
|
|
||||||
// Updating the HIP header files to make them C functions is underway.
|
|
||||||
// Until that change flows through, we will workaround the issue by
|
|
||||||
// creating dummy wrappers for them here
|
|
||||||
|
|
||||||
hipError_t hipMallocVanilla(void** ptr, size_t size) {
|
|
||||||
return hipErrorNotInitialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
hipError_t hipHostMallocVanilla(void** ptr, size_t size, unsigned int flags) {
|
|
||||||
return hipErrorNotInitialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define STREAM_EXECUTOR_HIP_WRAP(hipSymbolName) \
|
#define STREAM_EXECUTOR_HIP_WRAP(hipSymbolName) \
|
||||||
template <typename... Args> \
|
template <typename... Args> \
|
||||||
auto hipSymbolName(Args... args)->decltype(::hipSymbolName(args...)) { \
|
auto hipSymbolName(Args... args)->decltype(::hipSymbolName(args...)) { \
|
||||||
@ -107,9 +94,11 @@ hipError_t hipHostMallocVanilla(void** ptr, size_t size, unsigned int flags) {
|
|||||||
__macro(hipGetDeviceCount) \
|
__macro(hipGetDeviceCount) \
|
||||||
__macro(hipGetDeviceProperties) \
|
__macro(hipGetDeviceProperties) \
|
||||||
__macro(hipHostFree) \
|
__macro(hipHostFree) \
|
||||||
|
__macro(hipHostMalloc) \
|
||||||
__macro(hipHostRegister) \
|
__macro(hipHostRegister) \
|
||||||
__macro(hipHostUnregister) \
|
__macro(hipHostUnregister) \
|
||||||
__macro(hipInit) \
|
__macro(hipInit) \
|
||||||
|
__macro(hipMalloc) \
|
||||||
__macro(hipMemGetAddressRange) \
|
__macro(hipMemGetAddressRange) \
|
||||||
__macro(hipMemGetInfo) \
|
__macro(hipMemGetInfo) \
|
||||||
__macro(hipMemcpyDtoD) \
|
__macro(hipMemcpyDtoD) \
|
||||||
|
Loading…
Reference in New Issue
Block a user