SWDEV-427855 - Revert "SWDEV-427855 - hipamd change for profiler and TF fix"

This reverts commit 7478e90727.

Reason for revert: <Need rocprofiler changes to avoid PSDB failures>

Change-Id: I856b7ea30744f1b7bb099b6adbce2155201be539


[ROCm/clr commit: 57cb840058]
このコミットが含まれているのは:
Rahul Garg
2023-11-16 00:20:54 -05:00
コミット e1889b77b4
10個のファイルの変更381行の追加538行の削除
+10 -36
ファイルの表示
@@ -22,33 +22,23 @@
#include "hip_internal.hpp"
#undef hipChooseDevice
#undef hipDeviceProp_t
hipError_t hipChooseDevice(int* device, const hipDeviceProp_t* properties) {
HIP_INIT_API(hipChooseDevice, device, properties);
template <typename DeviceProp>
hipError_t ihipChooseDevice(int* device, const DeviceProp* properties) {
if (device == nullptr || properties == nullptr) {
return hipErrorInvalidValue;
HIP_RETURN(hipErrorInvalidValue);
}
*device = 0;
cl_uint maxMatchedCount = 0;
int count = 0;
IHIP_RETURN_ONFAIL(ihipDeviceGetCount(&count));
HIP_RETURN_ONFAIL(ihipDeviceGetCount(&count));
for (cl_int i = 0; i < count; ++i) {
DeviceProp currentProp = {0};
hipDeviceProp_t currentProp = {0};
cl_uint validPropCount = 0;
cl_uint matchedCount = 0;
hipError_t err = hipSuccess;
if constexpr (std::is_same_v<DeviceProp, hipDeviceProp_tR0600>){
err = ihipGetDeviceProperties(&currentProp, i);
}
else {
err = hipGetDevicePropertiesR0000(&currentProp, i);
}
hipError_t err = ihipGetDeviceProperties(&currentProp, i);
if (properties->major != 0) {
validPropCount++;
if (currentProp.major >= properties->major) {
@@ -140,25 +130,9 @@ hipError_t ihipChooseDevice(int* device, const DeviceProp* properties) {
}
}
return hipSuccess;
}
hipError_t hipChooseDeviceR0600(int* device, const hipDeviceProp_tR0600* properties) {
HIP_INIT_API(hipChooseDeviceR0600, device, properties);
HIP_RETURN(ihipChooseDevice(device, properties));
}
hipError_t hipChooseDeviceR0000(int* device, const hipDeviceProp_tR0000* properties) {
HIP_INIT_API(hipChooseDeviceR0000, device, properties);
HIP_RETURN(ihipChooseDevice(device, properties));
HIP_RETURN(hipSuccess);
}
extern "C" hipError_t hipChooseDevice(int* device, const hipDeviceProp_tR0000* properties);
hipError_t hipChooseDevice(int* device, const hipDeviceProp_tR0000* properties) {
return hipChooseDeviceR0000(device, properties);
}
hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device) {
HIP_INIT_API(hipDeviceGetAttribute, pi, attr, device);
@@ -174,7 +148,7 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
}
// FIXME: should we cache the props, or just select from deviceHandle->info_?
hipDeviceProp_tR0600 prop = {0};
hipDeviceProp_t prop = {0};
HIP_RETURN_ONFAIL(ihipGetDeviceProperties(&prop, device));
constexpr auto int32_max = static_cast<uint64_t>(std::numeric_limits<int32_t>::max());
@@ -466,7 +440,7 @@ hipError_t hipDeviceGetByPCIBusId(int* device, const char* pciBusIdstr) {
HIP_RETURN_ONFAIL(ihipDeviceGetCount(&count));
for (cl_int i = 0; i < count; i++) {
hipDevice_t dev;
hipDeviceProp_tR0600 prop;
hipDeviceProp_t prop;
HIP_RETURN_ONFAIL(ihipDeviceGet(&dev, i));
HIP_RETURN_ONFAIL(ihipGetDeviceProperties(&prop, dev));
@@ -506,7 +480,7 @@ hipError_t hipDeviceGetLimit(size_t* pValue, hipLimit_t limit) {
switch (limit) {
case hipLimitMallocHeapSize:
hipDeviceProp_tR0600 prop;
hipDeviceProp_t prop;
HIP_RETURN_ONFAIL(ihipGetDeviceProperties(&prop, ihipGetDevice()));
*pValue = prop.totalGlobalMem;
break;
@@ -535,7 +509,7 @@ hipError_t hipDeviceGetPCIBusId(char* pciBusId, int len, int device) {
HIP_RETURN(hipErrorInvalidValue);
}
hipDeviceProp_tR0600 prop;
hipDeviceProp_t prop;
HIP_RETURN_ONFAIL(ihipGetDeviceProperties(&prop, device));
snprintf(pciBusId, len, "%04x:%02x:%02x.0", prop.pciDomainID, prop.pciBusID, prop.pciDeviceID);