Fix: Cycles distributed memory toggle could appear on unsupported configurations

The distributed memory access toggle in Cycles preferences would show up
when a user has two GPUs that can access each other's memory, but only one
of them is supported by Cycles.

For example the AMD RX 5700XT and AMD Vega 64 can access each other's
memory, but only the 5700XT is supported by Cycles.

Pull Request: https://projects.blender.org/blender/blender/pulls/140521
This commit is contained in:
Alaska
2025-06-18 16:02:06 +02:00
committed by Brecht Van Lommel
parent cf14be7644
commit 353789c559
3 changed files with 23 additions and 9 deletions

View File

@@ -132,9 +132,7 @@ void device_cuda_info(vector<DeviceInfo> &devices)
continue;
}
int major;
cuDeviceGetAttribute(&major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, num);
if (major < 3) {
if (!cudaSupportsDevice(num)) {
VLOG_INFO << "Ignoring device \"" << name
<< "\", this graphics card is no longer supported.";
continue;
@@ -154,9 +152,11 @@ void device_cuda_info(vector<DeviceInfo> &devices)
/* Check if the device has P2P access to any other device in the system. */
for (int peer_num = 0; peer_num < count && !info.has_peer_memory; peer_num++) {
if (num != peer_num) {
int can_access = 0;
cuDeviceCanAccessPeer(&can_access, num, peer_num);
info.has_peer_memory = (can_access != 0);
if (cudaSupportsDevice(peer_num)) {
int can_access = 0;
cuDeviceCanAccessPeer(&can_access, num, peer_num);
info.has_peer_memory = (can_access != 0);
}
}
}
@@ -188,6 +188,8 @@ void device_cuda_info(vector<DeviceInfo> &devices)
cuDeviceGetAttribute(&preempt_attr, CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED, num);
# ifdef _WIN32
int major;
cuDeviceGetAttribute(&major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, num);
/* The CUDA driver reports compute preemption as not being available on
* Windows 10 even when it is, due to an issue in application profiles.
* Detect case where we expect it to be available and override. */

View File

@@ -48,6 +48,16 @@ const char *cuewCompilerPath();
int cuewCompilerVersion();
# endif /* WITH_CUDA_DYNLOAD */
static inline bool cudaSupportsDevice(const int cudaDevID)
{
int major;
cuDeviceGetAttribute(&major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cudaDevID);
if (major >= 3) {
return true;
}
return false;
}
CCL_NAMESPACE_END
#endif /* WITH_CUDA */

View File

@@ -178,9 +178,11 @@ void device_hip_info(vector<DeviceInfo> &devices)
/* Check if the device has P2P access to any other device in the system. */
for (int peer_num = 0; peer_num < count && !info.has_peer_memory; peer_num++) {
if (num != peer_num) {
int can_access = 0;
hipDeviceCanAccessPeer(&can_access, num, peer_num);
info.has_peer_memory = (can_access != 0);
if (hipSupportsDevice(peer_num)) {
int can_access = 0;
hipDeviceCanAccessPeer(&can_access, num, peer_num);
info.has_peer_memory = (can_access != 0);
}
}
}