Skip to content

KernelInterface - #624

Draft
christiangnrd wants to merge 3 commits into
mainfrom
interface
Draft

KernelInterface#624
christiangnrd wants to merge 3 commits into
mainfrom
interface

Conversation

@christiangnrd

@christiangnrd christiangnrd commented Aug 22, 2026

Copy link
Copy Markdown
Member

Do not merge until KernelInterface has been reviewed and interface fully decided

@christiangnrd
christiangnrd marked this pull request as draft August 22, 2026 18:35
@github-actions

Copy link
Copy Markdown
Contributor

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.

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
christiangnrd force-pushed the interface branch 3 times, most recently from ad71026 to c267caa Compare August 22, 2026 19:17
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.72093% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.49%. Comparing base (073f366) to head (8bb33ae).

Files with missing lines Patch % Lines
src/oneAPIKernels.jl 60.86% 18 Missing ⚠️
src/oneAPIKernelsOld.jl 91.89% 9 Missing ⚠️
src/compiler/compilation.jl 87.50% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant