P4 to Git Change 1596023 by skudchad@skudchad_test2_win_opencl on 2018/08/20 18:40:38
SWDEV-145570 - [HIP] Fixes to HIP env var logic ReviewBoardURL = http://ocltc.amd.com/reviews/r/15653/diff/ Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_device.cpp#16 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_internal.hpp#15 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#18 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#225 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#311 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#105 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#96 edit
This commit is contained in:
@@ -96,10 +96,8 @@ hipError_t ihipDeviceGetCount(int* count) {
|
|||||||
return hipErrorInvalidValue;
|
return hipErrorInvalidValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* deviceHandle = g_devices[0]->devices()[0];
|
|
||||||
|
|
||||||
// Get all available devices
|
// Get all available devices
|
||||||
*count = deviceHandle->isOrdinalValid() ? g_devices.size() : 0;
|
*count = g_devices.size();
|
||||||
|
|
||||||
return hipSuccess;
|
return hipSuccess;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,10 +29,9 @@ THE SOFTWARE.
|
|||||||
#include <stack>
|
#include <stack>
|
||||||
|
|
||||||
#define HIP_INIT() \
|
#define HIP_INIT() \
|
||||||
std::call_once(hip::g_ihipInitialized, hip::init); \
|
std::call_once(hip::g_ihipInitialized, hip::init); \
|
||||||
assert(g_devices.size() > 0); \
|
if (hip::g_context == nullptr && g_devices.size() > 0) { \
|
||||||
if (hip::g_context == nullptr) { \
|
hip::g_context = g_devices[0]; \
|
||||||
hip::g_context = g_devices[0]; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This macro should be called at the beginning of every HIP API.
|
// This macro should be called at the beginning of every HIP API.
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ extern "C" hipModule_t __hipRegisterFatBinary(const void* data)
|
|||||||
{
|
{
|
||||||
HIP_INIT();
|
HIP_INIT();
|
||||||
|
|
||||||
|
if(g_devices.empty()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
const __CudaFatBinaryWrapper* fbwrapper = reinterpret_cast<const __CudaFatBinaryWrapper*>(data);
|
const __CudaFatBinaryWrapper* fbwrapper = reinterpret_cast<const __CudaFatBinaryWrapper*>(data);
|
||||||
if (fbwrapper->magic != __hipFatMAGIC2 || fbwrapper->version != 1) {
|
if (fbwrapper->magic != __hipFatMAGIC2 || fbwrapper->version != 1) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user