Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion ext/ReactantCUDAExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function threads_to_workgroupsize(threads, ndrange)
end
end

function (obj::KA.Kernel{ReactantBackend})(args...; ndrange=nothing, workgroupsize=nothing)
function ka_with_reactant(ndrange, workgroupsize, obj, args...)
backend = KA.backend(obj)

ndrange, workgroupsize, iterspace, dynamic = KA.launch_config(
Expand Down Expand Up @@ -325,6 +325,14 @@ function (obj::KA.Kernel{ReactantBackend})(args...; ndrange=nothing, workgroupsi
return nothing
end

Reactant.@reactant_overlay @noinline function (obj::KA.Kernel{ReactantBackend})(
args...; ndrange=nothing, workgroupsize=nothing
)
return Reactant.call_with_reactant(
ka_with_reactant, ndrange, workgroupsize, obj, args...
)
end

Adapt.adapt_storage(to::KA.ConstAdaptor, a::CuTracedArray) = Base.Experimental.Const(a)

function recudaconvert(arg)
Expand Down
8 changes: 8 additions & 0 deletions ext/ReactantKernelAbstractionsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,12 @@ function KA.priority!(::ReactantBackend, prio::Symbol)
return nothing
end

function tokw(ndrange, workgroupsize, obj, args...)
@inline obj(args...; ndrange, workgroupsize)
end

function (obj::KA.Kernel{ReactantBackend})(args...; ndrange=nothing, workgroupsize=nothing)
@jit tokw(ndrange, workgroupsize, obj, args...)
end

end
Loading