CUDA kernel: how to pass an array of functions

Many thanks.

Does it mean that only a constant index is allowed? The following example does not work either.

function pass_func_array2(x::Float32, order::CuArray, fs)
    for i in order
        x = fs[i](x)
        @cuprintln("x = $x")
    end
    nothing
end
@cuda pass_func_array2(3.14f0, CuArray([1, 2, 1]), (CUDA.sin, CUDA.cos))

The order above actually encodes an expression tree, where each integer represents an operation, and I try to execute this tree on GPU. I don’t think it is proper to turn order into a tuple of functions directly since it may be very long (tens or hundreds). Is there any workaround to do what I want in CUDA.jl for now?