Fix __HIP_DEVICE_COMPILE__ not defined when hip/math_functions.h is included
This fixes build failure in TensorFlow 1.8 for HCC
This commit is contained in:
@@ -27,6 +27,7 @@ THE SOFTWARE.
|
||||
// paths to provide a consistent include env and avoid "missing symbol" errors that only appears
|
||||
// on NVCC path:
|
||||
|
||||
#include <hip/hip_common.h>
|
||||
|
||||
#if defined(__HIP_PLATFORM_HCC__) && !defined(__HIP_PLATFORM_NVCC__)
|
||||
#include <hip/hcc_detail/math_functions.h>
|
||||
|
||||
@@ -31,6 +31,20 @@ THE SOFTWARE.
|
||||
// declartions.
|
||||
|
||||
#include <hip/math_functions.h>
|
||||
|
||||
// Test __HIP_DEVICE_COMPILE__ is defined after math_functions.h
|
||||
// is included.
|
||||
//
|
||||
__device__ __host__ inline void throw_std_bad_alloc()
|
||||
{
|
||||
#ifndef __HIP_DEVICE_COMPILE__
|
||||
throw std::bad_alloc();
|
||||
#else
|
||||
std::size_t huge = static_cast<std::size_t>(-1);
|
||||
new int[huge];
|
||||
#endif
|
||||
}
|
||||
|
||||
#include <hip/hip_runtime.h>
|
||||
#include "test_common.h"
|
||||
|
||||
|
||||
مرجع در شماره جدید
Block a user