Fix #119959: Enabling "Distribute memory between devices" for Cycles results in error

With the switch to using the primary CUDA context it became possible
for peer access between CUDA devices to already have been enabled for
that context, either by a previous Cycles session or third-party library,
thus causing the call to `cuCtxEnablePeerAccess` to return
`CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED`. This is not a failure
state however, so just needs to be handled like a success return value.

Pull Request: https://projects.blender.org/blender/blender/pulls/120255
This commit is contained in:
Patrick Mours
2024-04-15 12:17:32 +02:00
committed by Patrick Mours
parent a772c84341
commit 33d7fa8cb3

View File

@@ -187,7 +187,7 @@ bool CUDADevice::check_peer_access(Device *peer_device)
{
const CUDAContextScope scope(this);
CUresult result = cuCtxEnablePeerAccess(peer_device_cuda->cuContext, 0);
if (result != CUDA_SUCCESS) {
if (result != CUDA_SUCCESS && result != CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED) {
set_error(string_printf("Failed to enable peer access on CUDA context (%s)",
cuewErrorString(result)));
return false;
@@ -196,7 +196,7 @@ bool CUDADevice::check_peer_access(Device *peer_device)
{
const CUDAContextScope scope(peer_device_cuda);
CUresult result = cuCtxEnablePeerAccess(cuContext, 0);
if (result != CUDA_SUCCESS) {
if (result != CUDA_SUCCESS && result != CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED) {
set_error(string_printf("Failed to enable peer access on CUDA context (%s)",
cuewErrorString(result)));
return false;