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
[ROCm/clr commit: 26954707a4]
This commit is contained in:
@@ -224,8 +224,6 @@ Device::~Device() {
|
||||
}
|
||||
}
|
||||
|
||||
bool amd::Device::validOrdinal_ = true;
|
||||
|
||||
bool Device::create() {
|
||||
vaCacheAccess_ = new amd::Monitor("VA Cache Ops Lock", true);
|
||||
if (NULL == vaCacheAccess_) {
|
||||
|
||||
@@ -1591,13 +1591,6 @@ class Device : public RuntimeObject {
|
||||
// P2P devices that are accessible from the current device
|
||||
std::vector<cl_device_id> p2pDevices_;
|
||||
|
||||
//! Check for invalid ordinal passed via environment var
|
||||
bool isOrdinalValid() { return validOrdinal_; }
|
||||
|
||||
//! Write to validOrdinal_
|
||||
static void setvalidOrdinal(bool val) { validOrdinal_ = val; }
|
||||
|
||||
|
||||
protected:
|
||||
//! Enable the specified extension
|
||||
char* getExtensionString();
|
||||
@@ -1608,7 +1601,6 @@ class Device : public RuntimeObject {
|
||||
BlitProgram* blitProgram_; //!< Blit program info
|
||||
static AppProfile appProfile_; //!< application profile
|
||||
HwDebugManager* hwDebugMgr_; //!< Hardware Debug manager
|
||||
static bool validOrdinal_; //!< Valid Ordinal
|
||||
|
||||
private:
|
||||
bool IsTypeMatching(cl_device_type type, bool offlineDevices);
|
||||
|
||||
@@ -1092,13 +1092,9 @@ device::Program* Device::createProgram(amd::option::Options* options) {
|
||||
typedef std::unordered_map<int, bool> requestedDevices_t;
|
||||
|
||||
//! Parses the requested list of devices to be exposed to the user.
|
||||
static void parseRequestedDeviceList(requestedDevices_t& requestedDevices,
|
||||
static void parseRequestedDeviceList(const char* requestedDeviceList,
|
||||
requestedDevices_t& requestedDevices,
|
||||
uint32_t numDevices) {
|
||||
int requestedDeviceCount = 0;
|
||||
|
||||
const char* requestedDeviceList = IS_HIP ? ((HIP_VISIBLE_DEVICES[0] != '\0') ?
|
||||
HIP_VISIBLE_DEVICES : CUDA_VISIBLE_DEVICES)
|
||||
: GPU_DEVICE_ORDINAL;
|
||||
|
||||
char* pch = strtok(const_cast<char*>(requestedDeviceList), ",");
|
||||
while (pch != nullptr) {
|
||||
@@ -1118,18 +1114,12 @@ static void parseRequestedDeviceList(requestedDevices_t& requestedDevices,
|
||||
// Get next token.
|
||||
pch = strtok(nullptr, ",");
|
||||
|
||||
// FIXME Allow atleast one valid deviceId so compilation etc doesnt break
|
||||
// but set validOrdinal_ flag
|
||||
if (!deviceIdValid && (requestedDevices.size() != 0)) {
|
||||
if (!deviceIdValid) {
|
||||
// Exit the loop as anything to the right of invalid deviceId
|
||||
// has to be discarded unless its the first one
|
||||
// has to be discarded
|
||||
break;
|
||||
}
|
||||
|
||||
if (!deviceIdValid && (requestedDevices.size() == 0)) {
|
||||
Device::setvalidOrdinal(false);
|
||||
}
|
||||
|
||||
// Requested device is valid.
|
||||
requestedDevices[currentDeviceIndex] = deviceIdValid;
|
||||
}
|
||||
@@ -1196,16 +1186,14 @@ bool Device::init() {
|
||||
|
||||
uint ordinal = 0;
|
||||
const char* selectDeviceByName = nullptr;
|
||||
const char* requestedDeviceList = IS_HIP ? ((HIP_VISIBLE_DEVICES[0] != '\0') ?
|
||||
HIP_VISIBLE_DEVICES : CUDA_VISIBLE_DEVICES)
|
||||
: GPU_DEVICE_ORDINAL;
|
||||
|
||||
if (IS_HIP) {
|
||||
if (HIP_VISIBLE_DEVICES[0] != '\0' || CUDA_VISIBLE_DEVICES[0] != '\0') {
|
||||
useDeviceList = true;
|
||||
parseRequestedDeviceList(requestedDevices, numDevices);
|
||||
}
|
||||
} else if (GPU_DEVICE_ORDINAL[0] != '\0') {
|
||||
if (requestedDeviceList[0] != '\0') {
|
||||
useDeviceList = true;
|
||||
parseRequestedDeviceList(requestedDevices, numDevices);
|
||||
} else if (!flagIsDefault(GPU_DEVICE_NAME)) {
|
||||
parseRequestedDeviceList(requestedDeviceList, requestedDevices, numDevices);
|
||||
} else if (GPU_DEVICE_NAME[0] != '\0') {
|
||||
selectDeviceByName = GPU_DEVICE_NAME;
|
||||
}
|
||||
|
||||
|
||||
@@ -406,12 +406,11 @@ bool Device::init() {
|
||||
std::unordered_map<int, bool> selectedDevices;
|
||||
bool useDeviceList = false;
|
||||
|
||||
if ((GPU_DEVICE_ORDINAL != '\0') || (HIP_VISIBLE_DEVICES[0] != '\0')
|
||||
|| (CUDA_VISIBLE_DEVICES != '\0')) {
|
||||
std::string ordinals = IS_HIP ? ((HIP_VISIBLE_DEVICES[0] != '\0') ?
|
||||
HIP_VISIBLE_DEVICES : CUDA_VISIBLE_DEVICES)
|
||||
: GPU_DEVICE_ORDINAL;
|
||||
if (ordinals[0] != '\0') {
|
||||
useDeviceList = true;
|
||||
std::string ordinals = IS_HIP ? ((HIP_VISIBLE_DEVICES[0] != '\0') ?
|
||||
HIP_VISIBLE_DEVICES : CUDA_VISIBLE_DEVICES)
|
||||
: GPU_DEVICE_ORDINAL;
|
||||
|
||||
size_t end, pos = 0;
|
||||
do {
|
||||
@@ -421,16 +420,11 @@ bool Device::init() {
|
||||
if (index < 0 || static_cast<size_t>(index) >= gpu_agents_.size()) {
|
||||
deviceIdValid = false;
|
||||
}
|
||||
// FIXME Allow atleast one valid deviceId so compilation etc doesnt break
|
||||
// but set validOrdinal_ flag
|
||||
if (!deviceIdValid && (selectedDevices.size() != 0)) {
|
||||
// Exit the loop as anything to the right of invalid deviceId
|
||||
// has to be discarded unless its the first one
|
||||
break;
|
||||
}
|
||||
|
||||
if (!deviceIdValid && (selectedDevices.size() == 0)) {
|
||||
Device::setvalidOrdinal(false);
|
||||
if (!deviceIdValid) {
|
||||
// Exit the loop as anything to the right of invalid deviceId
|
||||
// has to be discarded
|
||||
break;
|
||||
}
|
||||
|
||||
selectedDevices[index] = deviceIdValid;
|
||||
|
||||
مرجع در شماره جدید
Block a user