KernelInterface - #624
Draft
christiangnrd wants to merge 3 commits into
Draft
Conversation
christiangnrd
marked this pull request as draft
August 22, 2026 18:35
Contributor
|
Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/src/oneAPIKernels.jl b/src/oneAPIKernels.jl
index 841ec92..87255b9 100644
--- a/src/oneAPIKernels.jl
+++ b/src/oneAPIKernels.jl
@@ -69,12 +69,12 @@ end
KI.argconvert(::oneAPIBackend, arg) = kernel_convert(arg)
-function KI.kernel_function(::oneAPIBackend, f::F, tt::TT=Tuple{}; name = nothing, kwargs...) where {F,TT}
+function KI.kernel_function(::oneAPIBackend, f::F, tt::TT = Tuple{}; name = nothing, kwargs...) where {F, TT}
kern = zefunction(f, tt; name, kwargs...)
- KI.Kernel{oneAPIBackend, typeof(kern)}(oneAPIBackend(), kern)
+ return KI.Kernel{oneAPIBackend, typeof(kern)}(oneAPIBackend(), kern)
end
-function (obj::KI.Kernel{oneAPIBackend})(args...; numworkgroups=(), workgroupsize=(), ndrange=(), max_work_group_size=typemax(Int))
+function (obj::KI.Kernel{oneAPIBackend})(args...; numworkgroups = (), workgroupsize = (), ndrange = (), max_work_group_size = typemax(Int))
KI.check_launch_args(numworkgroups, workgroupsize, ndrange)
prod(ndrange) == 0 && return nothing
@@ -97,12 +97,12 @@ function (obj::KI.Kernel{oneAPIBackend})(args...; numworkgroups = 1, workgroupsi
return nothing
end
-function KI.kernel_max_work_group_size(kernel::KI.Kernel{<:oneAPIBackend}; max_work_items::Int=typemax(Int))::Int
+function KI.kernel_max_work_group_size(kernel::KI.Kernel{<:oneAPIBackend}; max_work_items::Int = typemax(Int))::Int
group_size = oneAPI.launch_configuration(kernel.kern)
- Int(min(group_size, max_work_items))
+ return Int(min(group_size, max_work_items))
end
function KI.max_work_group_size(::oneAPIBackend)::Int
- oneAPI.oneL0.compute_properties(device()).maxTotalGroupSize
+ return oneAPI.oneL0.compute_properties(device()).maxTotalGroupSize
end
function KI.sub_group_size(::oneAPIBackend)::Int
sg_sizes = oneAPI.oneL0.compute_properties(device()).subGroupSizes
@@ -117,7 +117,7 @@ function KI.sub_group_size(::oneAPIBackend)::Int
end
end
function KI.multiprocessor_count(::oneAPIBackend)::Int
- oneAPI.oneL0.properties(device()).numSlices
+ return oneAPI.oneL0.properties(device()).numSlices
end
function KI.shfl_down_types(::oneAPIBackend)
@@ -187,7 +187,7 @@ end
sub_group_barrier(SPIRVIntrinsics.LOCAL_MEM_FENCE | SPIRVIntrinsics.GLOBAL_MEM_FENCE)
end
-@device_override function KI.shfl_down(val::T, offset::Integer) where T
+@device_override function KI.shfl_down(val::T, offset::Integer) where {T}
sub_group_shuffle(val, get_sub_group_local_id() + offset)
end
diff --git a/src/oneAPIKernelsOld.jl b/src/oneAPIKernelsOld.jl
index ebbf6f0..055c898 100644
--- a/src/oneAPIKernelsOld.jl
+++ b/src/oneAPIKernelsOld.jl
@@ -41,7 +41,7 @@ Adapt.adapt_storage(::KA.CPU, a::oneArray) = convert(Array, a)
## Memory Operations
function KA.copyto!(::oneAPIBackend, A, B)
- copyto!(A, B)
+ return copyto!(A, B)
# TODO: Address device to host copies in jl being synchronizing
end
@@ -67,11 +67,13 @@ end
## Kernel Launch
function KA.mkcontext(kernel::KA.Kernel{oneAPIBackend}, _ndrange, iterspace)
- KA.CompilerMetadata{KA.ndrange(kernel), KA.DynamicCheck}(_ndrange, iterspace)
+ return KA.CompilerMetadata{KA.ndrange(kernel), KA.DynamicCheck}(_ndrange, iterspace)
end
-function KA.mkcontext(kernel::KA.Kernel{oneAPIBackend}, I, _ndrange, iterspace,
- ::Dynamic) where Dynamic
- KA.CompilerMetadata{KA.ndrange(kernel), Dynamic}(I, _ndrange, iterspace)
+function KA.mkcontext(
+ kernel::KA.Kernel{oneAPIBackend}, I, _ndrange, iterspace,
+ ::Dynamic
+ ) where {Dynamic}
+ return KA.CompilerMetadata{KA.ndrange(kernel), Dynamic}(I, _ndrange, iterspace)
end
function KA.launch_config(kernel::KA.Kernel{oneAPIBackend}, ndrange, workgroupsize)
@@ -79,7 +81,7 @@ function KA.launch_config(kernel::KA.Kernel{oneAPIBackend}, ndrange, workgroupsi
ndrange = (ndrange,)
end
if workgroupsize isa Integer
- workgroupsize = (workgroupsize, )
+ workgroupsize = (workgroupsize,)
end
# partition checked that the ndrange's agreed
@@ -88,7 +90,7 @@ function KA.launch_config(kernel::KA.Kernel{oneAPIBackend}, ndrange, workgroupsi
end
iterspace, dynamic = if KA.workgroupsize(kernel) <: KA.DynamicSize &&
- workgroupsize === nothing
+ workgroupsize === nothing
# use ndrange as preliminary workgroupsize for autotuning
KA.partition(kernel, ndrange, ndrange)
else
@@ -107,7 +109,7 @@ function threads_to_workgroupsize(threads, ndrange)
end
end
-function (obj::KA.Kernel{oneAPIBackend})(args...; ndrange=nothing, workgroupsize=nothing)
+function (obj::KA.Kernel{oneAPIBackend})(args...; ndrange = nothing, workgroupsize = nothing)
backend = KA.backend(obj)
ndrange, workgroupsize, iterspace, dynamic = KA.launch_config(obj, ndrange, workgroupsize)
diff --git a/src/utils.jl b/src/utils.jl
index f49de6c..29bf032 100644
--- a/src/utils.jl
+++ b/src/utils.jl
@@ -31,13 +31,15 @@ function versioninfo(io::IO=stdout)
get_module(name::Symbol) = (name, getfield(OpenCL, name))
function get_module(pkg::Tuple{String, String})
id = Base.PkgId(Base.UUID(pkg[1]), pkg[2])
- (pkg[2], get(Base.loaded_modules, id, nothing))
+ return (pkg[2], get(Base.loaded_modules, id, nothing))
end
println(io, "Julia packages:")
println(io, "- oneAPI.jl: $(Base.pkgversion(oneAPI))")
- for pkg in [:GPUArrays, :GPUCompiler, ("63c18a36-062a-441e-b654-da1e3ab1ce7c", "KernelAbstractions"),
- :KernelInterface, :LLVM, :SPIRVIntrinsics]
+ for pkg in [
+ :GPUArrays, :GPUCompiler, ("63c18a36-062a-441e-b654-da1e3ab1ce7c", "KernelAbstractions"),
+ :KernelInterface, :LLVM, :SPIRVIntrinsics,
+ ]
name, mod = get_module(pkg)
isnothing(mod) || println(io, "- $(name): $(Base.pkgversion(mod))")
end |
christiangnrd
force-pushed
the
interface
branch
3 times, most recently
from
August 22, 2026 19:17
ad71026 to
c267caa
Compare
christiangnrd
force-pushed
the
interface
branch
from
August 22, 2026 19:31
c267caa to
fa0662b
Compare
christiangnrd
force-pushed
the
interface
branch
from
August 22, 2026 19:54
fa0662b to
8bb33ae
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #624 +/- ##
==========================================
- Coverage 81.18% 80.49% -0.69%
==========================================
Files 50 51 +1
Lines 3571 3651 +80
==========================================
+ Hits 2899 2939 +40
- Misses 672 712 +40 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Do not merge until KernelInterface has been reviewed and interface fully decided