[CUDA GRAPH] CudaerrorInvalidvalue using Conditional Nodes combined with Green context

Hi everyone,

Environment:

Driver version: 595.71.05
CUDA version: 13.2
Red Hat 8
NVIDIA A30

I may have overlooked it in the documentation, but I couldn’t find any information online about using conditional nodes together with a green context.

When I create a conditional node using the manual API, I get a cudaErrorInvalidValue.

In the following example, as soon as I instantiate a green context (ai_gctx != NULL), I get this error. The example below shows what I’m currently trying to do


/**
*                  PREVIOUS WORK HERE
**/

            checkCudaErrors(cudaGraphCreate(&ao_conditionalGraph, 0));

            cudaGraphConditionalHandle handle;
            checkCudaErrors(cudaGraphConditionalHandleCreate(&handle, ao_conditionalGraph));

           cudaGraphNode_t setHandleNode;
            void *kernelArgs[2];
            kernelArgs[0] = &handle;
            kernelArgs[1] = &ai_isReferenceBufferSet;

            cudaGraphNodeParams kparams = {cudaGraphNodeTypeKernel};
            kparams.kernel.func = (void*) setStabilizationHandle;
            kparams.kernel.gridDim = dim3(1, 1, 1);
            kparams.kernel.blockDim = dim3(1, 1, 1);
            kparams.kernel.sharedMemBytes = 0;
            kparams.kernel.kernelParams = kernelArgs;
            kparams.kernel.extra = nullptr;
            
           // Works
            if (ai_gctx)
                kparams.kernel.ctx = ai_gctx;
            
            checkCudaErrors(cudaGraphAddNode(
                &setHandleNode,
                ao_conditionalGraph,
                NULL,
                NULL,
                0,
                &kparams));   
cudaGraphNode_t conditionalNode;

            cudaGraphNodeParams cParams = {};
            cParams.type = cudaGraphNodeTypeConditional;
            cParams.conditional.handle = handle;
            cParams.conditional.type = cudaGraphCondTypeIf;
            cParams.conditional.size = 1;

            if (ai_gctx)
                cParams.conditional.ctx = ai_gctx;

       // This cudaGraphAddNode(...) returns CudaErrorInvalidValue if ai_gctx != NULL 

                checkCudaErrors(cudaGraphAddNode(&conditionalNode,
                                        ao_conditionalGraph,
                                        &setHandleNode,
                                        nullptr,
                                        1,
                                        &cParams));

Weirdly enough, conditional nodes does have a .ctx parameter, setting it seems to raise an error however.
Additionally, I tried doing the same thing using the capture API, and in that case I get the same error when calling cudaGraphInstantiate().

Does anyone have experience using both of these features together: conditional nodes and Runtime API green contexts, and managed to make it work?

Thanks!