JuliaGPU / JuliaGPU/KernelAbstractions.jl

Enzyme integration likely causes divergent kernels

Open
#584 0 comments 0 reactions 0 assignees View on GitHub
Enzyme
Dominant language
Julia
Stars
523
Forks
88
Avg merge
1d 11h
Merged PRs (30d)
25

Description

While looking at #583 I noticed that the `aug_fwd` kernel looks like:

```
function aug_fwd(
ctx,
f::FT,
::Val{ModifiedBetween},
subtape,
::Val{TapeType},
args...,
) where {ModifiedBetween, FT, TapeType}
# A2 = Const{Nothing} -- since f->Nothing
forward, _ = EnzymeCore.autodiff_deferred_thunk(
ReverseSplitModified(ReverseSplitWithPrimal, Val(ModifiedBetween)),
TapeType,
Const{Core.Typeof(f)},
Const{Nothing},
Const{Core.Typeof(ctx)},
map(Core.Typeof, args)...,
)

# On the GPU: F is a per thread function
# On the GPU: subtape::Vector
if __validindex(ctx)
I = __index_Global_Linear(ctx)
subtape[I] = forward(Const(f), Const(ctx), args...)[1]
end
return nothing
end
```

This will create divergent execution of barrier operations https://github.com/JuliaGPU/KernelAbstractions.jl/pull/558#issue-2815921036
Likely this is also broken with `@kernel unsafe_indicies=true`

cc: @michel2323

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the aug_fwd kernel and its EnzymeCore.autodiff_deferred_thunk call, then compare barrier execution with the behavior described in PR #558. Check the related @kernel unsafe_indicies=true case if applicable; done means the affected kernels no longer produce divergent barrier execution and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.