diff options
author | Brecht Van Lommel <brecht> | 2021-11-04 22:29:07 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-11-04 22:34:21 +0300 |
commit | 4960ad420bcfd79db2884ec7a42c2bf01c1c2b85 (patch) | |
tree | 0d89983b58c5aca4c7fa254fc5e69ccb932160a6 /intern/cycles/device/hip/device_impl.cpp | |
parent | 36f5198282d3e91b11d9db488705a852377edd31 (diff) |
Cycles: add code to check for supported HIP device architectures
RDNA2 only for now to be conservative, but testing more hardware is underway.
Ref T92393
Differential Revision: https://developer.blender.org/D12958
Diffstat (limited to 'intern/cycles/device/hip/device_impl.cpp')
-rw-r--r-- | intern/cycles/device/hip/device_impl.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/intern/cycles/device/hip/device_impl.cpp b/intern/cycles/device/hip/device_impl.cpp index a71fc4b888b..db93ecd8474 100644 --- a/intern/cycles/device/hip/device_impl.cpp +++ b/intern/cycles/device/hip/device_impl.cpp @@ -146,12 +146,18 @@ HIPDevice::~HIPDevice() bool HIPDevice::support_device(const uint /*kernel_features*/) { - int major, minor; - hipDeviceGetAttribute(&major, hipDeviceAttributeComputeCapabilityMajor, hipDevId); - hipDeviceGetAttribute(&minor, hipDeviceAttributeComputeCapabilityMinor, hipDevId); + if (hipSupportsDevice(hipDevId)) { + return true; + } + else { + /* We only support Navi and above. */ + hipDeviceProp_t props; + hipGetDeviceProperties(&props, hipDevId); - // TODO : (Arya) What versions do we plan to support? - return true; + set_error(string_printf("HIP backend requires AMD RDNA2 graphics card or up, but found %s.", + props.name)); + return false; + } } bool HIPDevice::check_peer_access(Device *peer_device) @@ -391,8 +397,9 @@ bool HIPDevice::load_kernels(const uint kernel_features) return false; /* check if GPU is supported */ - if (!support_device(kernel_features)) + if (!support_device(kernel_features)) { return false; + } /* get kernel */ const char *kernel_name = "kernel"; |