JuliaGPU / JuliaGPU/KernelAbstractions.jl

Dynamic parallelism

Open
#442 1 comment 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

I am trying to set up a dynamic kernel wherein a KA kernel launches a CUDA kernel. The final objective would be to have dynamic parallelism using only kernel abstractions. This is a MWE showing the comparison between launching the parent kernel with CUDA or with KA

the child kernel

function child!(a)
    i = threadIdx().x
    @inbounds a[i] = i
    return nothing
end

CUDA implementation (runs)

function parent!(a)
    @cuda dynamic=true threads=10 blocks=1 child!(a)
    return nothing
end

a = CuArray(zeros(10))

kernel! = @cuda launch=false maxthreads=10 always_inline=true parent!(a)

kernel!(a; threads=1, blocks=1)

KA implementation

@kernel function parent!(a)
    @cuda dynamic=true threads=10 blocks=1 children!(a)
end

a = CuArray(zeros(10))

kernel! = parent!(CUDA.CUDABackend(), 1, 1)
 
kernel!(a)

returns

JIT session error: Symbols not found: [ cudaGetErrorString ]
JIT session error: Failed to materialize symbols: { (JuliaOJIT, { julia_throw_device_cuerror_3299 }) }
JIT session error: Failed to materialize symbols: { (JuliaOJIT, { julia_#_#14_3295 }) }
JIT session error: Symbols not found: [ cudaGetErrorString ]
JIT session error: Failed to materialize symbols: { (JuliaOJIT, { julia_throw_device_cuerror_3306 }) }
ERROR: a CUDA error was thrown during kernel execution: invalid configuration argument (code 9, cudaErrorInvalidConfiguration)
ERROR: a exception was thrown during kernel execution.
Stacktrace:
 [1] throw_device_cuerror at /home/ssilvest/.julia/packages/CUDA/35NC6/src/device/intrinsics/dynamic_parallelism.jl:20
 [2] #launch#950 at /home/ssilvest/.julia/packages/CUDA/35NC6/src/device/intrinsics/dynamic_parallelism.jl:27
 [3] launch at /home/ssilvest/.julia/packages/CUDA/35NC6/src/device/intrinsics/dynamic_parallelism.jl:65
 [4] #868 at /home/ssilvest/.julia/packages/CUDA/35NC6/lib/cudadrv/execution.jl:136
 [5] macro expansion at /home/ssilvest/.julia/packages/CUDA/35NC6/lib/cudadrv/execution.jl:95
 [6] macro expansion at ./none:0
 [7] convert_arguments at ./none:0
 [8] #cudacall#867 at /home/ssilvest/.julia/packages/CUDA/35NC6/lib/cudadrv/execution.jl:135
 [9] cudacall at /home/ssilvest/.julia/packages/CUDA/35NC6/lib/cudadrv/execution.jl:134
 [10] macro expansion at /home/ssilvest/.julia/packages/CUDA/35NC6/src/compiler/execution.jl:219
 [11] macro expansion at ./none:0
 [12] #call#1045 at ./none:0
 [13] call at ./none:0
 [14] #_#1061 at /home/ssilvest/.julia/packages/CUDA/35NC6/src/compiler/execution.jl:371
 [15] DeviceKernel at /home/ssilvest/.julia/packages/CUDA/35NC6/src/compiler/execution.jl:371
 [16] macro expansion at /home/ssilvest/.julia/packages/CUDA/35NC6/src/compiler/execution.jl:88
 [17] macro expansion at /home/ssilvest/test.jl:46
 [18] gpu_parent! at /home/ssilvest/.julia/packages/KernelAbstractions/WoCk1/src/macros.jl:90
 [19] gpu_parent! at ./none:0

Is this expected?
I guess it might be a problem of KA setting up maxthreads=1 in the kernel call

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

Reproduce the provided MWE comparing the CUDA parent! launch with the KernelAbstractions @kernel parent! on CUDA.CUDABackend(). Start at the generated gpu_parent! call in the stack trace and compare its launch configuration with the direct CUDA version. Done means establishing whether dynamic parallelism is supported through this path and clearly recording the expected behavior or required change.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend, hpc
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.