JuliaGPU / JuliaGPU/KernelAbstractions.jl

Ranges in kernels

Open
#124 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
523
Forks
88
Avg merge
1d 11h
Merged PRs (30d)
25

Description

using KernelAbstractions
@kernel function f_mwe(dt)
    0.0:dt:1.0
end
version = CUDADevice()
wait(version, f_mwe(version)(0.1;ndrange=10))
InvalidIRError: compiling kernel gpu_f_mwe(Cassette.Context{nametype(CUDACtx),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}}}}},Nothing,KernelAbstractions.var"##PassType#253",Nothing,Cassette.DisableHooks}, typeof(gpu_f_mwe), Float64) resulted in invalid LLVM IR
Reason: unsupported call through a literal pointer (call to jl_alloc_string)
Stacktrace:
 [1] _string_n at strings/string.jl:60
 [2] StringVector at iobuffer.jl:31
 [3] #IOBuffer#331 at iobuffer.jl:114
 [4] print_to_string at strings/io.jl:133
 [5] string at strings/io.jl:174
 [6] StepRangeLen at range.jl:350
 [7] StepRangeLen at twiceprecision.jl:358
 [8] steprangelen_hp at twiceprecision.jl:344
 [9] overdub at C:\Users\accou\.julia\packages\KernelAbstractions\yw9SF\src\compiler.jl:61
 [10] macro expansion at C:\Users\accou\.julia\dev\DiffEqGPU\test\gpu_ode.jl:113
 [11] gpu_f_mwe at C:\Users\accou\.julia\packages\KernelAbstractions\yw9SF\src\macros.jl:80
 [12] overdub at C:\Users\accou\.julia\packages\Cassette\158rp\src\overdub.jl:0
Reason: unsupported call through a literal pointer (call to jl_string_to_array)
Stacktrace:
 [1] unsafe_wrap at strings/string.jl:71
 [2] StringVector at iobuffer.jl:31
 [3] #IOBuffer#331 at iobuffer.jl:114
 [4] print_to_string at strings/io.jl:133
 [5] string at strings/io.jl:174
 [6] StepRangeLen at range.jl:350
 [7] StepRangeLen at twiceprecision.jl:358
 [8] steprangelen_hp at twiceprecision.jl:344
 [9] overdub at C:\Users\accou\.julia\packages\KernelAbstractions\yw9SF\src\compiler.jl:61
 [10] macro expansion at C:\Users\accou\.julia\dev\DiffEqGPU\test\gpu_ode.jl:113
 [11] gpu_f_mwe at C:\Users\accou\.julia\packages\KernelAbstractions\yw9SF\src\macros.jl:80
 [12] overdub at C:\Users\accou\.julia\packages\Cassette\158rp\src\overdub.jl:0
Reason: unsupported call through a literal pointer (call to memset)
Stacktrace:
 [1] fill! at array.jl:428
 [2] #IOBuffer#331 at iobuffer.jl:121
 [3] print_to_string at strings/io.jl:133
 [4] string at strings/io.jl:174
 [5] StepRangeLen at range.jl:350
 [6] StepRangeLen at twiceprecision.jl:358
 [7] steprangelen_hp at twiceprecision.jl:344
 [8] overdub at C:\Users\accou\.julia\packages\KernelAbstractions\yw9SF\src\compiler.jl:61
 [9] macro expansion at C:\Users\accou\.julia\dev\DiffEqGPU\test\gpu_ode.jl:113
 [10] gpu_f_mwe at C:\Users\accou\.julia\packages\KernelAbstractions\yw9SF\src\macros.jl:80
 [11] overdub at C:\Users\accou\.julia\packages\Cassette\158rp\src\overdub.jl:0
Reason: unsupported dynamic function invocation (call to print)
Stacktrace:
 [1] print_to_string at strings/io.jl:135
 [2] string at strings/io.jl:174
 [3] StepRangeLen at range.jl:350
 [4] StepRangeLen at twiceprecision.jl:358
 [5] steprangelen_hp at twiceprecision.jl:344
 [6] overdub at C:\Users\accou\.julia\packages\KernelAbstractions\yw9SF\src\compiler.jl:61
 [7] macro expansion at C:\Users\accou\.julia\dev\DiffEqGPU\test\gpu_ode.jl:113
 [8] gpu_f_mwe at C:\Users\accou\.julia\packages\KernelAbstractions\yw9SF\src\macros.jl:80
 [9] overdub at C:\Users\accou\.julia\packages\Cassette\158rp\src\overdub.jl:0
Reason: unsupported call through a literal pointer (call to jl_array_grow_end)
Stacktrace:
 [1] _growend! at array.jl:892
 [2] resize! at array.jl:1085
 [3] print_to_string at strings/io.jl:137
 [4] string at strings/io.jl:174
 [5] StepRangeLen at range.jl:350
 [6] StepRangeLen at twiceprecision.jl:358
 [7] steprangelen_hp at twiceprecision.jl:344
 [8] overdub at C:\Users\accou\.julia\packages\KernelAbstractions\yw9SF\src\compiler.jl:61
 [9] macro expansion at C:\Users\accou\.julia\dev\DiffEqGPU\test\gpu_ode.jl:113
 [10] gpu_f_mwe at C:\Users\accou\.julia\packages\KernelAbstractions\yw9SF\src\macros.jl:80
 [11] overdub at C:\Users\accou\.julia\packages\Cassette\158rp\src\overdub.jl:0
Reason: unsupported call through a literal pointer (call to jl_array_del_end)
Stacktrace:
 [1] _deleteend! at array.jl:901
 [2] resize! at array.jl:1090
 [3] print_to_string at strings/io.jl:137
 [4] string at strings/io.jl:174
 [5] StepRangeLen at range.jl:350
 [6] StepRangeLen at twiceprecision.jl:358
 [7] steprangelen_hp at twiceprecision.jl:344
 [8] overdub at C:\Users\accou\.julia\packages\KernelAbstractions\yw9SF\src\compiler.jl:61
 [9] macro expansion at C:\Users\accou\.julia\dev\DiffEqGPU\test\gpu_ode.jl:113
 [10] gpu_f_mwe at C:\Users\accou\.julia\packages\KernelAbstractions\yw9SF\src\macros.jl:80
 [11] overdub at C:\Users\accou\.julia\packages\Cassette\158rp\src\overdub.jl:0
Reason: unsupported call through a literal pointer (call to jl_array_to_string)
Stacktrace:
 [1] String at strings/string.jl:39
 [2] print_to_string at strings/io.jl:137
 [3] string at strings/io.jl:174
 [4] St...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the range example in test/gpu_ode.jl and trace the InvalidIRError through KernelAbstractions/src/compiler.jl and src/macros.jl, as shown in the stack trace. Done means the kernel can construct and use 0.0:dt:1.0 on CUDA without invalid LLVM IR.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.