# DiffEqGPU throws InvalidIR Error for simple example

**URL:** <https://discourse.julialang.org/t/diffeqgpu-throws-invalidir-error-for-simple-example/94579>\
**Category:** General Usage\
**Tags:** diffeq, differentialequation\
**Created:** [February 13, 2023, 6:33pm UTC](https://discourse.julialang.org/t/diffeqgpu-throws-invalidir-error-for-simple-example/94579 "2023-02-13T18:33:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![roflmaostc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roflmaostc/32/30123_2.png) [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Post date:** [February 13, 2023, 6:33pm UTC](https://discourse.julialang.org/t/diffeqgpu-throws-invalidir-error-for-simple-example/94579/1 "2023-02-13T18:33:00Z")

</div>

Hi,  
my minimal example for [DiffEqGPU.jl](https://github.com/SciML/DiffEqGPU.jl) does not work unfortunately.

The MWE is (copy paste in Pluto):

```julia
# ╔═╡ fd1a977c-abca-11ed-2e82-315cc1b1716b
using DifferentialEquations, Zygote, CUDA,DiffEqGPU, StaticArrays

# ╔═╡ f54cc390-c4d9-4ae9-a221-2858c51c510b
function k(x)
	sum(abs2, x)
end

# ╔═╡ 48e32a20-a4b8-45da-baec-e7f96f51c3b0
function f(z, _p, s)
	p = z[1:2] 
	v = z[3:4]
	dz12 = p .^ 2
	dz34 = v .^ 2
	return SVector{4}(dz12[1], dz12[2], dz34[1], dz34[2])
end

# ╔═╡ 06d08079-25e0-4c6f-9288-077ecc636f84
z0 = @SVector [0.0f0, 0.0f0, 0.0f0, 2.0f0]

# ╔═╡ 1e7f5534-47ab-4499-9406-852b6645e75e
sspan = (0f0, 100f0)

# ╔═╡ 5789d73f-ece1-46b8-94fe-2f729f9cff7a
f(z0, nothing, 1f0)

# ╔═╡ 57523dc7-cf9d-45d2-92f8-a060c8077db0
prob = ODEProblem(f, z0, sspan)

# ╔═╡ 108dccdd-9baf-4ae7-8155-95b6e0c25af3
@time sol = solve(prob, Tsit5());

# ╔═╡ 46c2884f-2a52-42c9-92c0-d685e39d9a7a
eprob = EnsembleProblem(prob, safetycopy = false)

# ╔═╡ 3a104348-bb0d-4a3a-ad0e-62f3c29c7d63
@time esol = solve(eprob, GPUTsit5(), EnsembleGPUArray(), trajectories=10_000)

```

The CPU version works but the GPU version throws that error.

I tried quite a few different versions of my code (in-place, without StaticArray, …) and none of them worked.  
Is there something completely flawed with my approach?

Best,

Felix

> **Error Trace.**
>
> ```julia
> InvalidIRError: compiling kernel #gpu_gpu_kernel_oop(KernelAbstractions.CompilerMetadata{KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.DynamicCheck, Nothing, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, KernelAbstractions.NDIteration.NDRange{1, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.DynamicSize, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}}}, typeof(Main.var"workspace#39".f), CUDA.CuDeviceMatrix{Float32, 1}, CUDA.CuDeviceMatrix{Float32, 1}, CUDA.CuDeviceMatrix{SciMLBase.NullParameters, 1}, Float32) resulted in invalid LLVM IR
> 
> Reason: unsupported call through a literal pointer (call to ijl_alloc_array_1d)
> 
> Stacktrace:
> 
> [1] Array
> 
> @ ./boot.jl:459
> 
> [2] Array
> 
> @ ./boot.jl:468
> 
> [3] similar
> 
> @ ./abstractarray.jl:806
> 
> [4] similar
> 
> @ ./subarray.jl:65
> 
> [5] similar
> 
> @ ./abstractarray.jl:795
> 
> [6] _unsafe_getindex
> 
> @ ./multidimensional.jl:887
> 
> [7] multiple call sites
> 
> @ unknown:0
> 
> Reason: unsupported dynamic function invocation (call to print)
> 
> Stacktrace:
> 
> [1] print_to_string
> 
> @ ./strings/io.jl:144
> 
> Reason: unsupported call through a literal pointer (call to ijl_array_grow_end)
> 
> Stacktrace:
> 
> [1] _growend!
> 
> @ ./array.jl:1011
> 
> [2] resize!
> 
> @ ./array.jl:1236
> 
> [3] print_to_string
> 
> @ ./strings/io.jl:146
> 
> Reason: unsupported call through a literal pointer (call to ijl_array_del_end)
> 
> Stacktrace:
> 
> [1] _deleteend!
> 
> @ ./array.jl:1020
> 
> [2] resize!
> 
> @ ./array.jl:1241
> 
> [3] print_to_string
> 
> @ ./strings/io.jl:146
> 
> Reason: unsupported call through a literal pointer (call to ijl_array_to_string)
> 
> Stacktrace:
> 
> [1] String
> 
> @ ./strings/string.jl:55
> 
> [2] print_to_string
> 
> @ ./strings/io.jl:146
> 
> Reason: unsupported call through a literal pointer (call to ijl_alloc_string)
> 
> Stacktrace:
> 
> [1] _string_n
> 
> @ ./strings/string.jl:78
> 
> [2] StringVector
> 
> @ ./iobuffer.jl:31
> 
> [3] #IOBuffer#423
> 
> @ ./iobuffer.jl:114
> 
> [4] print_to_string
> 
> @ ./strings/io.jl:142
> 
> Reason: unsupported call through a literal pointer (call to ijl_string_to_array)
> 
> Stacktrace:
> 
> [1] unsafe_wrap
> 
> @ ./strings/string.jl:89
> 
> [2] StringVector
> 
> @ ./iobuffer.jl:31
> 
> [3] #IOBuffer#423
> 
> @ ./iobuffer.jl:114
> 
> [4] print_to_string
> 
> @ ./strings/io.jl:142
> 
> Reason: unsupported call through a literal pointer (call to ijl_alloc_array_1d)
> 
> Stacktrace:
> 
> [1] Array
> 
> @ ./boot.jl:459
> 
> [2] Array
> 
> @ ./boot.jl:468
> 
> [3] Array
> 
> @ ./boot.jl:476
> 
> [4] similar
> 
> @ ./abstractarray.jl:841
> 
> [5] similar
> 
> @ ./abstractarray.jl:840
> 
> [6] similar
> 
> @ ./broadcast.jl:212
> 
> [7] similar
> 
> @ ./broadcast.jl:211
> 
> [8] copy
> 
> @ ./broadcast.jl:885
> 
> [9] materialize
> 
> @ ./broadcast.jl:860
> 
> [10] f
> 
> @ ~/.julia/pluto_notebooks/Fascinating journal.jl#==#48e32a20-a4b8-45da-baec-e7f96f51c3b0:4
> 
> [11] macro expansion
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/DiffEqGPU.jl:31
> 
> [12] gpu_gpu_kernel_oop
> 
> @ ~/.julia/packages/KernelAbstractions/C8flJ/src/macros.jl:81
> 
> [13] gpu_gpu_kernel_oop
> 
> @ ./none:0
> 
> Reason: unsupported call through a literal pointer (call to ijl_array_copy)
> 
> Stacktrace:
> 
> [1] copy
> 
> @ ./array.jl:369
> 
> [2] unaliascopy
> 
> @ ./abstractarray.jl:1443
> 
> [3] unalias
> 
> @ ./abstractarray.jl:1427
> 
> [4] broadcast_unalias
> 
> @ ./broadcast.jl:934
> 
> [5] preprocess
> 
> @ ./broadcast.jl:941
> 
> [6] preprocess_args (repeats 2 times)
> 
> @ ./broadcast.jl:943
> 
> [7] preprocess
> 
> @ ./broadcast.jl:940
> 
> [8] copyto!
> 
> @ ./broadcast.jl:957
> 
> [9] copyto!
> 
> @ ./broadcast.jl:913
> 
> [10] copy
> 
> @ ./broadcast.jl:885
> 
> [11] materialize
> 
> @ ./broadcast.jl:860
> 
> [12] f
> 
> @ ~/.julia/pluto_notebooks/Fascinating journal.jl#==#48e32a20-a4b8-45da-baec-e7f96f51c3b0:4
> 
> [13] macro expansion
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/DiffEqGPU.jl:31
> 
> [14] gpu_gpu_kernel_oop
> 
> @ ~/.julia/packages/KernelAbstractions/C8flJ/src/macros.jl:81
> 
> [15] gpu_gpu_kernel_oop
> 
> @ ./none:0
> 
> Reason: unsupported call through a literal pointer (call to ijl_alloc_array_1d)
> 
> Stacktrace:
> 
> [1] Array
> 
> @ ./boot.jl:459
> 
> [2] Array
> 
> @ ./boot.jl:468
> 
> [3] Array
> 
> @ ./boot.jl:476
> 
> [4] similar
> 
> @ ./abstractarray.jl:841
> 
> [5] similar
> 
> @ ./abstractarray.jl:840
> 
> [6] similar
> 
> @ ./broadcast.jl:212
> 
> [7] similar
> 
> @ ./broadcast.jl:211
> 
> [8] copy
> 
> @ ./broadcast.jl:885
> 
> [9] materialize
> 
> @ ./broadcast.jl:860
> 
> [10] f
> 
> @ ~/.julia/pluto_notebooks/Fascinating journal.jl#==#48e32a20-a4b8-45da-baec-e7f96f51c3b0:5
> 
> [11] macro expansion
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/DiffEqGPU.jl:31
> 
> [12] gpu_gpu_kernel_oop
> 
> @ ~/.julia/packages/KernelAbstractions/C8flJ/src/macros.jl:81
> 
> [13] gpu_gpu_kernel_oop
> 
> @ ./none:0
> 
> Reason: unsupported call through a literal pointer (call to ijl_array_copy)
> 
> Stacktrace:
> 
> [1] copy
> 
> @ ./array.jl:369
> 
> [2] unaliascopy
> 
> @ ./abstractarray.jl:1443
> 
> [3] unalias
> 
> @ ./abstractarray.jl:1427
> 
> [4] broadcast_unalias
> 
> @ ./broadcast.jl:934
> 
> [5] preprocess
> 
> @ ./broadcast.jl:941
> 
> [6] preprocess_args (repeats 2 times)
> 
> @ ./broadcast.jl:943
> 
> [7] preprocess
> 
> @ ./broadcast.jl:940
> 
> [8] copyto!
> 
> @ ./broadcast.jl:957
> 
> [9] copyto!
> 
> @ ./broadcast.jl:913
> 
> [10] copy
> 
> @ ./broadcast.jl:885
> 
> [11] materialize
> 
> @ ./broadcast.jl:860
> 
> [12] f
> 
> @ ~/.julia/pluto_notebooks/Fascinating journal.jl#==#48e32a20-a4b8-45da-baec-e7f96f51c3b0:5
> 
> [13] macro expansion
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/DiffEqGPU.jl:31
> 
> [14] gpu_gpu_kernel_oop
> 
> @ ~/.julia/packages/KernelAbstractions/C8flJ/src/macros.jl:81
> 
> [15] gpu_gpu_kernel_oop
> 
> @ ./none:0
> 
> Hint: catch this exception as `err` and call `code_typed(err; interactive = true)` to introspect the erronous code with Cthulhu.jl
> 
> check_ir(::GPUCompiler.CompilerJob{GPUCompiler.PTXCompilerTarget, CUDA.CUDACompilerParams, GPUCompiler.FunctionSpec{typeof(DiffEqGPU.gpu_gpu_kernel_oop), Tuple{KernelAbstractions.CompilerMetadata{KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.DynamicCheck, Nothing, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, KernelAbstractions.NDIteration.NDRange{1, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.DynamicSize, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}}}, typeof(Main.var"workspace#39".f), CUDA.CuDeviceMatrix{Float32, 1}, CUDA.CuDeviceMatrix{Float32, 1}, CUDA.CuDeviceMatrix{SciMLBase.NullParameters, 1}, Float32}}}, ::LLVM.Module)@validation.jl:141
> macro expansion@driver.jl:418[inlined]
> macro expansion@TimerOutput.jl:253[inlined]
> macro expansion@driver.jl:416[inlined]
> var"#emit_asm#120"(::Bool, ::Bool, ::LLVM.API.LLVMCodeGenFileType, ::typeof(GPUCompiler.emit_asm), ::GPUCompiler.CompilerJob, ::LLVM.Module)@utils.jl:83
> cufunction_compile(::GPUCompiler.CompilerJob, ::LLVM.Context)@execution.jl:355
> #228@execution.jl:348[inlined]
> JuliaContext(::CUDA.var"#228#229"{GPUCompiler.CompilerJob{GPUCompiler.PTXCompilerTarget, CUDA.CUDACompilerParams, GPUCompiler.FunctionSpec{typeof(DiffEqGPU.gpu_gpu_kernel_oop), Tuple{KernelAbstractions.CompilerMetadata{KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.DynamicCheck, Nothing, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, KernelAbstractions.NDIteration.NDRange{1, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.DynamicSize, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}}}, typeof(Main.var"workspace#39".f), CUDA.CuDeviceMatrix{Float32, 1}, CUDA.CuDeviceMatrix{Float32, 1}, CUDA.CuDeviceMatrix{SciMLBase.NullParameters, 1}, Float32}}}})@driver.jl:76
> cufunction_compile(::GPUCompiler.CompilerJob)@execution.jl:347
> cached_compilation(::Dict{UInt64, Any}, ::GPUCompiler.CompilerJob, ::typeof(CUDA.cufunction_compile), ::typeof(CUDA.cufunction_link))@cache.jl:90
> var"#cufunction#225"(::Nothing, ::Bool, ::Base.Pairs{Symbol, Nothing, Tuple{Symbol}, NamedTuple{(:maxthreads,), Tuple{Nothing}}}, ::typeof(CUDA.cufunction), ::typeof(DiffEqGPU.gpu_gpu_kernel_oop), ::Type{Tuple{KernelAbstractions.CompilerMetadata{KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.DynamicCheck, Nothing, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, KernelAbstractions.NDIteration.NDRange{1, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.DynamicSize, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}}}, typeof(Main.var"workspace#39".f), CUDA.CuDeviceMatrix{Float32, 1}, CUDA.CuDeviceMatrix{Float32, 1}, CUDA.CuDeviceMatrix{SciMLBase.NullParameters, 1}, Float32}})@execution.jl:300
> macro expansion@execution.jl:102[inlined]
> var"#_#23"(::Int64, ::CUDAKernels.CudaEvent, ::Int64, ::Function, ::KernelAbstractions.Kernel{CUDAKernels.CUDADevice{false, false}, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.DynamicSize, typeof(DiffEqGPU.gpu_gpu_kernel_oop)}, ::Function, ::Vararg{Any})@CUDAKernels.jl:283
> (::DiffEqGPU.var"#67#71"{typeof(Main.var"workspace#39".f), typeof(DiffEqGPU.gpu_kernel_oop)})(::CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, ::CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, ::CUDA.CuArray{SciMLBase.NullParameters, 2, CUDA.Mem.DeviceBuffer}, ::Float32)@DiffEqGPU.jl:832
> ODEFunction@scimlfunctions.jl:2096[inlined]
> initialize!(::OrdinaryDiffEq.ODEIntegrator{OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, true, CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, Nothing, Float32, CUDA.CuArray{SciMLBase.NullParameters, 2, CUDA.Mem.DeviceBuffer}, Float32, Float32, Float32, Float32, Vector{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}}, SciMLBase.ODESolution{Float32, 3, Vector{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}}, Nothing, Nothing, Vector{Float32}, Vector{Vector{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}}}, SciMLBase.ODEProblem{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, Tuple{Float32, Float32}, true, CUDA.CuArray{SciMLBase.NullParameters, 2, CUDA.Mem.DeviceBuffer}, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, DiffEqGPU.var"#67#71"{typeof(Main.var"workspace#39".f), typeof(DiffEqGPU.gpu_kernel_oop)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.InterpolationData{SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, DiffEqGPU.var"#67#71"{typeof(Main.var"workspace#39".f), typeof(DiffEqGPU.gpu_kernel_oop)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Vector{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}}, Vector{Float32}, Vector{Vector{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}}}, OrdinaryDiffEq.Tsit5Cache{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}, DiffEqBase.DEStats, Nothing}, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, DiffEqGPU.var"#67#71"{typeof(Main.var"workspace#39".f), typeof(DiffEqGPU.gpu_kernel_oop)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, OrdinaryDiffEq.Tsit5Cache{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.DEOptions{Float32, Float32, Float32, Float32, OrdinaryDiffEq.PIController{Rational{Int64}}, typeof(DiffEqGPU.diffeqgpunorm), typeof(LinearAlgebra.opnorm), Nothing, SciMLBase.CallbackSet{Tuple{}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), DiffEqGPU.var"#15#21", DataStructures.BinaryHeap{Float32, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float32, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, Float32, Nothing, OrdinaryDiffEq.DefaultInit}, ::OrdinaryDiffEq.Tsit5Cache{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})@low_order_rk_perform_step.jl:766
> var"#__init#624"(::Tuple{}, ::Tuple{}, ::Tuple{}, ::Nothing, ::Bool, ::Bool, ::Bool, ::Nothing, ::Nothing, ::Bool, ::Bool, ::Float32, ::Nothing, ::Float32, ::Bool, ::Bool, ::Rational{Int64}, ::Nothing, ::Nothing, ::Rational{Int64}, ::Int64, ::Int64, ::Int64, ::Nothing, ::Nothing, ::Rational{Int64}, ::Nothing, ::Bool, ::Int64, ::Int64, ::typeof(DiffEqGPU.diffeqgpunorm), ::typeof(LinearAlgebra.opnorm), ::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), ::DiffEqGPU.var"#15#21", ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Int64, ::String, ::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), ::Nothing, ::Bool, ::Bool, ::Bool, ::Bool, ::OrdinaryDiffEq.DefaultInit, ::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:default_set,), Tuple{Bool}}}, ::typeof(SciMLBase.__init), ::SciMLBase.ODEProblem{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, Tuple{Float32, Float32}, true, CUDA.CuArray{SciMLBase.NullParameters, 2, CUDA.Mem.DeviceBuffer}, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, DiffEqGPU.var"#67#71"{typeof(Main.var"workspace#39".f), typeof(DiffEqGPU.gpu_kernel_oop)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ::OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::Tuple{}, ::Tuple{}, ::Tuple{}, ::Type{Val{true}})@solve.jl:499
> #__solve#623@solve.jl:5[inlined]
> var"#__solve#1"(::Bool, ::Base.Pairs{Symbol, Any, NTuple{4, Symbol}, NamedTuple{(:adaptive, :unstable_check, :callback, :internalnorm), Tuple{Bool, DiffEqGPU.var"#15#21", Nothing, typeof(DiffEqGPU.diffeqgpunorm)}}}, ::typeof(SciMLBase.__solve), ::SciMLBase.ODEProblem{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, Tuple{Float32, Float32}, true, CUDA.CuArray{SciMLBase.NullParameters, 2, CUDA.Mem.DeviceBuffer}, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, DiffEqGPU.var"#67#71"{typeof(Main.var"workspace#39".f), typeof(DiffEqGPU.gpu_kernel_oop)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ::DiffEqGPU.GPUTsit5)@default_solve.jl:9
> #solve_call#22@solve.jl:494[inlined]
> var"#solve_up#29"(::Base.Pairs{Symbol, Any, NTuple{5, Symbol}, NamedTuple{(:adaptive, :unstable_check, :callback, :merge_callbacks, :internalnorm), Tuple{Bool, DiffEqGPU.var"#15#21", Nothing, Bool, typeof(DiffEqGPU.diffeqgpunorm)}}}, ::typeof(DiffEqBase.solve_up), ::SciMLBase.ODEProblem{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, Tuple{Float32, Float32}, true, CUDA.CuArray{SciMLBase.NullParameters, 2, CUDA.Mem.DeviceBuffer}, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, DiffEqGPU.var"#67#71"{typeof(Main.var"workspace#39".f), typeof(DiffEqGPU.gpu_kernel_oop)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ::Nothing, ::CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, ::CUDA.CuArray{SciMLBase.NullParameters, 2, CUDA.Mem.DeviceBuffer}, ::DiffEqGPU.GPUTsit5)@solve.jl:915
> var"#solve#27"(::Nothing, ::Nothing, ::Nothing, ::Val{true}, ::Base.Pairs{Symbol, Any, NTuple{5, Symbol}, NamedTuple{(:adaptive, :unstable_check, :callback, :merge_callbacks, :internalnorm), Tuple{Bool, DiffEqGPU.var"#15#21", Nothing, Bool, typeof(DiffEqGPU.diffeqgpunorm)}}}, ::typeof(CommonSolve.solve), ::SciMLBase.ODEProblem{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, Tuple{Float32, Float32}, true, CUDA.CuArray{SciMLBase.NullParameters, 2, CUDA.Mem.DeviceBuffer}, SciMLBase.ODEFunction{true, SciMLBase.FullSpecialize, DiffEqGPU.var"#67#71"{typeof(Main.var"workspace#39".f), typeof(DiffEqGPU.gpu_kernel_oop)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ::DiffEqGPU.GPUTsit5)@solve.jl:825
> var"#batch_solve_up#44"(::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:adaptive, :unstable_check), Tuple{Bool, DiffEqGPU.var"#15#21"}}}, ::typeof(DiffEqGPU.batch_solve_up), ::SciMLBase.EnsembleProblem{SciMLBase.ODEProblem{StaticArraysCore.SVector{4, Float32}, Tuple{Float32, Float32}, false, SciMLBase.NullParameters, SciMLBase.ODEFunction{false, SciMLBase.AutoSpecialize, typeof(Main.var"workspace#39".f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, typeof(SciMLBase.DEFAULT_PROB_FUNC), typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, ::Vector{SciMLBase.ODEProblem{StaticArraysCore.SVector{4, Float32}, Tuple{Float32, Float32}, false, SciMLBase.NullParameters, SciMLBase.ODEFunction{false, SciMLBase.AutoSpecialize, typeof(Main.var"workspace#39".f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}}, ::DiffEqGPU.GPUTsit5, ::DiffEqGPU.EnsembleGPUArray, ::UnitRange{Int64}, ::Matrix{Float32}, ::Matrix{SciMLBase.NullParameters})@DiffEqGPU.jl:733
> var"#batch_solve#22"(::Base.Pairs{Symbol, DiffEqGPU.var"#15#21", Tuple{Symbol}, NamedTuple{(:unstable_check,), Tuple{DiffEqGPU.var"#15#21"}}}, ::typeof(DiffEqGPU.batch_solve), ::SciMLBase.EnsembleProblem{SciMLBase.ODEProblem{StaticArraysCore.SVector{4, Float32}, Tuple{Float32, Float32}, false, SciMLBase.NullParameters, SciMLBase.ODEFunction{false, SciMLBase.AutoSpecialize, typeof(Main.var"workspace#39".f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, typeof(SciMLBase.DEFAULT_PROB_FUNC), typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, ::DiffEqGPU.GPUTsit5, ::DiffEqGPU.EnsembleGPUArray, ::UnitRange{Int64}, ::Bool)@DiffEqGPU.jl:671
> macro expansion@timing.jl:382[inlined]
> var"#__solve#10"(::Int64, ::Int64, ::Function, ::Bool, ::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(SciMLBase.__solve), ::SciMLBase.EnsembleProblem{SciMLBase.ODEProblem{StaticArraysCore.SVector{4, Float32}, Tuple{Float32, Float32}, false, SciMLBase.NullParameters, SciMLBase.ODEFunction{false, SciMLBase.AutoSpecialize, typeof(Main.var"workspace#39".f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, typeof(SciMLBase.DEFAULT_PROB_FUNC), typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, ::DiffEqGPU.GPUTsit5, ::DiffEqGPU.EnsembleGPUArray)@DiffEqGPU.jl:523
> #solve#30@solve.jl:931[inlined]
> macro expansion@Local: 262[inlined]
> top-level scope@Local: 1[inlined]
> ``
> 
> ```

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [February 13, 2023, 9:10pm UTC](https://discourse.julialang.org/t/diffeqgpu-throws-invalidir-error-for-simple-example/94579/2 "2023-02-13T21:10:35Z")

</div>

> [@roflmaostc](#):
>
> Is there something completely flawed with my approach?

You cannot use broadcast within a kernel. That’s an issue with CUDA.jl itself. Remove that broadcast and it’ll be fine.

---

<div class="post-metadata">

**Author:** ![roflmaostc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roflmaostc/32/30123_2.png) [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Post date:** [February 14, 2023, 9:15am UTC](https://discourse.julialang.org/t/diffeqgpu-throws-invalidir-error-for-simple-example/94579/3 "2023-02-14T09:15:30Z")

</div>

Thanks, didn’t know that!

But how does DiffEqGPU work anyway? Normally, expressions such as `dx[1] = f[1]` are slow because of scalar indexing? Is there some source transformation happening?

The code above works now but I hit another error when I let the derivative calculate by Zygote. It seems to work, when `k` does not have the if-else:

```julia
# ╔═╡ 86c49c4b-063e-4d77-bc74-ce1e0dc0a8db
using DifferentialEquations, Zygote, CUDA,DiffEqGPU, StaticArrays

# ╔═╡ 03d6c977-856e-43f7-837c-3f8ce44bc111
function k(x)
	if x[1] > 1
		return 0 * sum(x)
	else
		sum(abs2, x)
	end
end

# ╔═╡ bc2f4393-70e2-4a9b-8d70-484b816a357a
function f(z, _p, s)
	p = z[1] 
	v = z[2]
	
	dz = gradient(k, z)[1]
	dz1 = dz[1]
	dz2 = dz[2]
	return SVector{2}(dz1, dz2)
end

# ╔═╡ 2a5d0bca-5be9-4d29-8b3c-4b81617c21bf
z0 = @SVector [1.0f0, 0.0f0]

# ╔═╡ cad23d51-edb3-4435-a1aa-942103b04eec
sspan = (0f0, 2f0)

# ╔═╡ 53fccbbb-0783-4937-8e71-b611d5e778d3
prob = ODEProblem(f, z0, sspan)

# ╔═╡ 50d47c1f-c969-4095-aa96-82e238eddebf
@time sol = solve(prob, Tsit5());

# ╔═╡ 027428f7-6626-4add-b4e2-dc913996ebb4
eprob = EnsembleProblem(prob, safetycopy = false)

# ╔═╡ b54c7a05-9bed-44b9-ba1c-be09445d1a00
CUDA.@time esol2 = solve(eprob, Tsit5(),trajectories=100_000)

# ╔═╡ fc010780-2092-42aa-960b-c099abfc3ab4
CUDA.@time esol = solve(eprob, GPUTsit5(), EnsembleGPUKernel(), trajectories=100_000)

```

> **New Error**
>
> ```julia
> InvalidIRError: compiling kernel #atsit5_kernel(CUDA.CuDeviceVector{SciMLBase.ODEProblem{StaticArraysCore.SVector{2, Float32}, Tuple{Float32, Float32}, false, SciMLBase.NullParameters, SciMLBase.ODEFunction{false, SciMLBase.AutoSpecialize, typeof(Main.var"workspace#49".f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, 1}, CUDA.CuDeviceMatrix{StaticArraysCore.SVector{2, Float32}, 1}, CUDA.CuDeviceMatrix{Float32, 1}, Float32, SciMLBase.CallbackSet{Tuple{}, Tuple{}}, Nothing, Float32, Float32, Nothing, Val{false}) resulted in invalid LLVM IR
> 
> Reason: unsupported dynamic function invocation (call to >)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:154
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to <)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:155
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to *)
> 
> Stacktrace:
> 
> [1] *
> 
> @ ./operators.jl:591
> 
> [2] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:157
> 
> [3] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:157
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to *)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:158
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:158
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:158
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to *)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:159
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:159
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to *)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:160
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:160
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:160
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to *)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:161
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:161
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to *)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:162
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:162
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:162
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to *)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:163
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:163
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to *)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:164
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:164
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:164
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to *)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:165
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:165
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:166
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:166
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to *)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:167
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:167
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:168
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:168
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to *)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:170
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:170
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to broadcasted(f, gs::Zygote.Grads, gss::Union{Zygote.Grads, AbstractDict}...) in Zygote at /home/felix/.julia/packages/Zygote/g2w9o/src/compiler/interface.jl:348)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:172
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to broadcasted)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:172
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to materialize)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:172
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to *)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:172
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported call through a literal pointer (call to ijl_alloc_array_1d)
> 
> Stacktrace:
> 
> [1] Array
> 
> @ ./boot.jl:459
> 
> [2] IdDict
> 
> @ ./iddict.jl:30
> 
> [3] map
> 
> @ ~/.julia/packages/Zygote/g2w9o/src/compiler/interface.jl:364
> 
> [4] broadcasted
> 
> @ ~/.julia/packages/Zygote/g2w9o/src/compiler/interface.jl:350
> 
> [5] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:172
> 
> [6] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to map!(f, gsout::Zygote.Grads, gss::Union{Zygote.Grads, AbstractDict}...) in Zygote at /home/felix/.julia/packages/Zygote/g2w9o/src/compiler/interface.jl:368)
> 
> Stacktrace:
> 
> [1] map
> 
> @ ~/.julia/packages/Zygote/g2w9o/src/compiler/interface.jl:365
> 
> [2] broadcasted
> 
> @ ~/.julia/packages/Zygote/g2w9o/src/compiler/interface.jl:350
> 
> [3] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:172
> 
> [4] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to ODE_DEFAULT_NORM)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:173
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to iszero)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:175
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to ^)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:178
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to ^)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:179
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to /)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:179
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to >)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:182
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to /)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:185
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to min)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:185
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to max)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:185
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to max)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:186
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to /)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:187
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to abs)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:188
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to -)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:188
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to min)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:188
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to setproperty!)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:191
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to setproperty!)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:192
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to setproperty!)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:193
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to setproperty!)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:194
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to setproperty!)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:195
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to setproperty!)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:196
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to setproperty!)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:197
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to setproperty!)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:200
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to setproperty!)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:201
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to setproperty!)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:202
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to setproperty!)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:204
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to -)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:206
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to <)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:206
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to +)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:218
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to setproperty!)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:218
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to /)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:183
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to min)
> 
> Stacktrace:
> 
> [1] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:183
> 
> [2] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to gradient(f, args...) in Zygote at /home/felix/.julia/packages/Zygote/g2w9o/src/compiler/interface.jl:95)
> 
> Stacktrace:
> 
> [1] f
> 
> @ ~/.julia/pluto_notebooks/Mini computation.jl#==#bc2f4393-70e2-4a9b-8d70-484b816a357a:5
> 
> [2] ODEFunction
> 
> @ ~/.julia/packages/SciMLBase/hLrpl/src/scimlfunctions.jl:2096
> 
> [3] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:146
> 
> [4] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported call to an unknown function (call to jl_f_getfield)
> 
> Stacktrace:
> 
> [1] getindex
> 
> @ ./tuple.jl:29
> 
> [2] f
> 
> @ ~/.julia/pluto_notebooks/Mini computation.jl#==#bc2f4393-70e2-4a9b-8d70-484b816a357a:5
> 
> [3] ODEFunction
> 
> @ ~/.julia/packages/SciMLBase/hLrpl/src/scimlfunctions.jl:2096
> 
> [4] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:146
> 
> [5] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to getindex)
> 
> Stacktrace:
> 
> [1] f
> 
> @ ~/.julia/pluto_notebooks/Mini computation.jl#==#bc2f4393-70e2-4a9b-8d70-484b816a357a:6
> 
> [2] ODEFunction
> 
> @ ~/.julia/packages/SciMLBase/hLrpl/src/scimlfunctions.jl:2096
> 
> [3] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:146
> 
> [4] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to getindex)
> 
> Stacktrace:
> 
> [1] f
> 
> @ ~/.julia/pluto_notebooks/Mini computation.jl#==#bc2f4393-70e2-4a9b-8d70-484b816a357a:7
> 
> [2] ODEFunction
> 
> @ ~/.julia/packages/SciMLBase/hLrpl/src/scimlfunctions.jl:2096
> 
> [3] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:146
> 
> [4] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Reason: unsupported dynamic function invocation (call to StaticArraysCore.SVector{2})
> 
> Stacktrace:
> 
> [1] f
> 
> @ ~/.julia/pluto_notebooks/Mini computation.jl#==#bc2f4393-70e2-4a9b-8d70-484b816a357a:8
> 
> [2] ODEFunction
> 
> @ ~/.julia/packages/SciMLBase/hLrpl/src/scimlfunctions.jl:2096
> 
> [3] step!
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:146
> 
> [4] atsit5_kernel
> 
> @ ~/.julia/packages/DiffEqGPU/2OsE7/src/perform_step/gpu_tsit5_perform_step.jl:269
> 
> Hint: catch this exception as `err` and call `code_typed(err; interactive = true)` to introspect the erronous code with Cthulhu.jl
> 
> check_ir(::GPUCompiler.CompilerJob{GPUCompiler.PTXCompilerTarget, CUDA.CUDACompilerParams, GPUCompiler.FunctionSpec{typeof(DiffEqGPU.atsit5_kernel), Tuple{CUDA.CuDeviceVector{SciMLBase.ODEProblem{StaticArraysCore.SVector{2, Float32}, Tuple{Float32, Float32}, false, SciMLBase.NullParameters, SciMLBase.ODEFunction{false, SciMLBase.AutoSpecialize, typeof(Main.var"workspace#49".f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, 1}, CUDA.CuDeviceMatrix{StaticArraysCore.SVector{2, Float32}, 1}, CUDA.CuDeviceMatrix{Float32, 1}, Float32, SciMLBase.CallbackSet{Tuple{}, Tuple{}}, Nothing, Float32, Float32, Nothing, Val{false}}}}, ::LLVM.Module)@validation.jl:141
> macro expansion@driver.jl:418[inlined]
> macro expansion@TimerOutput.jl:253[inlined]
> macro expansion@driver.jl:416[inlined]
> var"#emit_asm#120"(::Bool, ::Bool, ::LLVM.API.LLVMCodeGenFileType, ::typeof(GPUCompiler.emit_asm), ::GPUCompiler.CompilerJob, ::LLVM.Module)@utils.jl:83
> cufunction_compile(::GPUCompiler.CompilerJob, ::LLVM.Context)@execution.jl:355
> #228@execution.jl:348[inlined]
> JuliaContext(::CUDA.var"#228#229"{GPUCompiler.CompilerJob{GPUCompiler.PTXCompilerTarget, CUDA.CUDACompilerParams, GPUCompiler.FunctionSpec{typeof(DiffEqGPU.atsit5_kernel), Tuple{CUDA.CuDeviceVector{SciMLBase.ODEProblem{StaticArraysCore.SVector{2, Float32}, Tuple{Float32, Float32}, false, SciMLBase.NullParameters, SciMLBase.ODEFunction{false, SciMLBase.AutoSpecialize, typeof(Main.var"workspace#49".f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, 1}, CUDA.CuDeviceMatrix{StaticArraysCore.SVector{2, Float32}, 1}, CUDA.CuDeviceMatrix{Float32, 1}, Float32, SciMLBase.CallbackSet{Tuple{}, Tuple{}}, Nothing, Float32, Float32, Nothing, Val{false}}}}})@driver.jl:76
> cufunction_compile(::GPUCompiler.CompilerJob)@execution.jl:347
> cached_compilation(::Dict{UInt64, Any}, ::GPUCompiler.CompilerJob, ::typeof(CUDA.cufunction_compile), ::typeof(CUDA.cufunction_link))@cache.jl:90
> var"#cufunction#225"(::Nothing, ::Bool, ::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(CUDA.cufunction), ::typeof(DiffEqGPU.atsit5_kernel), ::Type{Tuple{CUDA.CuDeviceVector{SciMLBase.ODEProblem{StaticArraysCore.SVector{2, Float32}, Tuple{Float32, Float32}, false, SciMLBase.NullParameters, SciMLBase.ODEFunction{false, SciMLBase.AutoSpecialize, typeof(Main.var"workspace#49".f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, 1}, CU::Vector{SciMLBase.ODEProblem{StaticArraysCore.SVector{2, Float32}, Tuple{Float32, Float32}, false, SciMLBase.NullParameters, SciMLBase.ODEFunction{false, SciMLBase.AutoSpecialize, typeof(Main.var"workspace#49".f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}}, ::DiffEqGPU.GPUTsit5, ::DiffEqGPU.EnsembleGPUKernel, ::UnitRange{Int64}, ::Bool)@DiffEqGPU.jl:691
> var"#batch_solve#22"(::Base.Pairs{Symbol, DiffEqGPU.var"#15#21", Tuple{Symbol}, NamedTuple{(:unstable_check,), Tuple{DiffEqGPU.var"#15#21"}}}, ::typeof(DiffEqGPU.batch_solve), ::SciMLBase.EnsembleProblem{SciMLBase.ODEProblem{StaticArraysCore.SVector{2, Float32}, Tuple{Float32, Float32}, false, SciMLBase.NullParameters, SciMLBase.ODEFunction{false, SciMLBase.AutoSpecialize, typeof(Main.var"workspace#49".f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, typeof(SciMLBase.DEFAULT_PROB_FUNC), typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, ::DiffEqGPU.GPUTsit5, ::DiffEqGPU.EnsembleGPUKernel, ::UnitRange{Int64}, ::Bool)@DiffEqGPU.jl:637
> macro expansion@timing.jl:382[inlined]
> var"#__solve#10"(::Int64, ::Int64, ::Function, ::Bool, ::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(SciMLBase.__solve), ::SciMLBase.EnsembleProblem{SciMLBase.ODEProblem{StaticArraysCore.SVector{2, Float32}, Tuple{Float32, Float32}, false, SciMLBase.NullParameters, SciMLBase.ODEFunction{false, SciMLBase.AutoSpecialize, typeof(Main.var"workspace#49".f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, typeof(SciMLBase.DEFAULT_PROB_FUNC), typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, ::DiffEqGPU.GPUTsit5, ::DiffEqGPU.EnsembleGPUKernel)@DiffEqGPU.jl:523
> #solve#30@solve.jl:931[inlined]
> macro expansion@Local: 25[inlined]
> macro expansion@Local: 583[inlined]
> top-level scope@Local: 1[inlined]
> 
> ```

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [February 14, 2023, 4:56pm UTC](https://discourse.julialang.org/t/diffeqgpu-throws-invalidir-error-for-simple-example/94579/4 "2023-02-14T16:56:16Z")

</div>

> [@roflmaostc](#):
>
> But how does DiffEqGPU work anyway? Normally, expressions such as `dx[1] = f[1]` are slow because of scalar indexing? Is there some source transformation happening?

There is a source transformation happening. How it works will be detailed in a paper soon.
