Commit 0235d283 by Peter Yeh Committed by masahi

[RUNTIME] Add device query for AMD GcnArch (#4341)

* add gcnArch query

* kGcnArch query for cuda is a no-op
parent 1e2c525b
......@@ -42,7 +42,8 @@ enum DeviceAttrKind : int {
kDeviceName = 5,
kMaxClockRate = 6,
kMultiProcessorCount = 7,
kMaxThreadDimensions = 8
kMaxThreadDimensions = 8,
kGcnArch = 9
};
/*! \brief Number of bytes each allocation must align to */
......
......@@ -174,7 +174,7 @@ inline int DetectROCMComputeVersion(const std::string& target) {
TVMRetValue val;
api->GetAttr(tvm_ctx, tvm::runtime::kExist, &val);
if (val.operator int() == 1) {
tvm::runtime::DeviceAPI::Get(tvm_ctx)->GetAttr(tvm_ctx, tvm::runtime::kComputeVersion, &val);
tvm::runtime::DeviceAPI::Get(tvm_ctx)->GetAttr(tvm_ctx, tvm::runtime::kGcnArch, &val);
return val.operator int();
}
}
......
......@@ -105,6 +105,7 @@ class CUDADeviceAPI final : public DeviceAPI {
*rv = ss.str();
return;
}
case kGcnArch: return;
}
*rv = value;
}
......
......@@ -63,6 +63,7 @@ void MetalWorkspace::GetAttr(
case kMultiProcessorCount: return;
case kMaxThreadDimensions: return;
case kExist: break;
case kGcnArch: return;
}
}
......
......@@ -114,6 +114,7 @@ void OpenCLWorkspace::GetAttr(
*rv = ss.str();
break;
}
case kGcnArch: return;
}
}
......
......@@ -117,6 +117,7 @@ void OpenGLWorkspace::GetAttr(
case kMaxClockRate: return;
case kMultiProcessorCount: return;
case kMaxThreadDimensions: return;
case kGcnArch: return;
}
}
......
......@@ -26,9 +26,10 @@
#include <dmlc/logging.h>
#include <dmlc/thread_local.h>
#include <tvm/runtime/registry.h>
#include <hip/hip_runtime_api.h>
#include <hsa/hsa.h>
#include <tvm/runtime/registry.h>
#include "../../../include/tvm/runtime/device_api.h"
#include "rocm_common.h"
namespace tvm {
......@@ -62,16 +63,17 @@ class ROCMDeviceAPI final : public DeviceAPI {
break;
}
case kMaxSharedMemoryPerBlock: return;
case kComputeVersion: {
case kComputeVersion:
case kDeviceName: return;
case kMaxClockRate: return;
case kMultiProcessorCount: return;
case kMaxThreadDimensions: return;
case kGcnArch: {
hipDeviceProp_t prop;
ROCM_CALL(hipGetDeviceProperties(&prop, ctx.device_id));
*rv = prop.gcnArch;
return;
}
case kDeviceName: return;
case kMaxClockRate: return;
case kMultiProcessorCount: return;
case kMaxThreadDimensions: return;
}
*rv = value;
}
......
......@@ -398,6 +398,8 @@ void VulkanDeviceAPI::GetAttr(TVMContext ctx, DeviceAttrKind kind, TVMRetValue*
break;
case kMaxThreadDimensions:
break;
case kGcnArch:
return;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment