diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index ac6a29b58..ab115d5cc 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -26,7 +26,7 @@ steps: Pkg.develop([PackageSpec(; name="KernelAbstractions", path=pwd()), PackageSpec(; name="KernelInterface", path=joinpath(pwd(), "lib", "KernelInterface"))])' || exit 3 echo "--- :julia: Developing CUDA" - julia .buildkite/develop_backend.jl https://github.com/JuliaGPU/CUDA.jl vc/ki-subgroup-ops \ + julia .buildkite/develop_backend.jl https://github.com/JuliaGPU/CUDA.jl main \ CUDACore CUDATools lib/cusolver lib/curand lib/cublas lib/cufft lib/cusparse lib/cupti lib/nvml lib/custatevec lib/cudnn lib/cutensor lib/cutensornet || exit 3 julia -e 'println("+++ :julia: Running tests") @@ -64,7 +64,7 @@ steps: Pkg.develop([PackageSpec(; name="KernelAbstractions", path=pwd()), PackageSpec(; name="KernelInterface", path=joinpath(pwd(), "lib", "KernelInterface"))])' || exit 3 echo "--- :julia: Developing Metal" - julia .buildkite/develop_backend.jl https://github.com/JuliaGPU/Metal.jl vc/ki-subgroup-ops || exit 3 + julia .buildkite/develop_backend.jl https://github.com/JuliaGPU/Metal.jl main || exit 3 julia -e 'println("+++ :julia: Running tests") using Pkg check = joinpath(pwd(), ".buildkite", "check_sources.jl") @@ -102,7 +102,7 @@ steps: julia -e 'println("--- :julia: Developing oneAPI") using Pkg Pkg.add(url="https://github.com/JuliaGPU/AcceleratedKernels.jl", rev="main")' || exit 3 - julia .buildkite/develop_backend.jl https://github.com/JuliaGPU/oneAPI.jl tb/ki-subgroup-ops || exit 3 + julia .buildkite/develop_backend.jl https://github.com/JuliaGPU/oneAPI.jl main || exit 3 julia -e 'println("+++ :julia: Running tests") using Pkg @@ -142,7 +142,7 @@ steps: julia -e 'println("--- :julia: Developing AMDGPU") using Pkg Pkg.add(url="https://github.com/JuliaGPU/AcceleratedKernels.jl", rev="main")' || exit 3 - julia .buildkite/develop_backend.jl https://github.com/JuliaGPU/AMDGPU.jl vc/ki-subgroup-ops || exit 3 + julia .buildkite/develop_backend.jl https://github.com/JuliaGPU/AMDGPU.jl main || exit 3 julia -e 'println("+++ :julia: Running tests") using Pkg @@ -180,7 +180,7 @@ steps: Pkg.develop([PackageSpec(; name="KernelAbstractions", path=pwd()), PackageSpec(; name="KernelInterface", path=joinpath(pwd(), "lib", "KernelInterface"))])' || exit 3 echo "--- :julia: Developing OpenCL" - julia .buildkite/develop_backend.jl https://github.com/JuliaGPU/OpenCL.jl tb/ki-subgroup-ops lib/intrinsics || exit 3 + julia .buildkite/develop_backend.jl https://github.com/JuliaGPU/OpenCL.jl main lib/intrinsics || exit 3 julia -e 'println("+++ :julia: Running tests") using Pkg diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml index f49313b66..38aa9223e 100644 --- a/.github/workflows/TagBot.yml +++ b/.github/workflows/TagBot.yml @@ -13,3 +13,12 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} ssh: ${{ secrets.DOCUMENTER_KEY }} + TagBot-KernelInterface: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' + runs-on: ubuntu-latest + steps: + - uses: JuliaRegistries/TagBot@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ssh: ${{ secrets.DOCUMENTER_KEY }} + subdir: lib/KernelInterface diff --git a/Project.toml b/Project.toml index 674ae8d82..ae8d6eef7 100644 --- a/Project.toml +++ b/Project.toml @@ -43,7 +43,7 @@ StaticArraysExt = "StaticArrays" Adapt = "0.4, 1.0, 2.0, 3.0, 4" Atomix = "1.5" GPUCompiler = "2.13" -GPUToolbox = "3.3.2" +GPUToolbox = "3.3.3" KernelInterface = "0.4" LLVM = "10" LinearAlgebra = "1.6" diff --git a/docs/src/index.md b/docs/src/index.md index 4a117e1b3..79ccb47d1 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -157,8 +157,10 @@ end the CPU backend became an OpenCL backend meant every backend. Use `KernelAbstractions.@device_code_llvm` and `KernelAbstractions.@device_code_typed` instead, which report on the code a backend actually generates; see [Reflection](@ref). -- `KernelAbstractions.GPU` is deprecated: and backends should now subtype `KernelAbstractions.Backend` directly. `GPU` is now an alias of `Backend` and will be removed in a future release. Code dispatching on `::GPU` should dispatch on `::Backend`, on concrete - backend types, or on a capability such as `KernelAbstractions.supports_float64`. +- `KernelAbstractions.GPU` is deprecated, and backends should subtype + `KernelAbstractions.Backend` directly. `GPU` is now an alias of `Backend` and will be + removed in a future release. Code dispatching on `::GPU` should dispatch on `::Backend`, on + concrete backend types, or on a capability such as `KernelAbstractions.supports_float64`. - An exception thrown in a kernel on the `CPU` backend is reported as a `KernelAbstractions.POCL.KernelException` when the kernel has completed, like on GPU backends, and no longer as the original exception (e.g., a `BoundsError`). Depending on @@ -203,11 +205,15 @@ end than with 0.9. - `foreach_index(f, A)` runs `f` once per index of the array `A` without writing a kernel out, and `foreach_index(f, backend, indices)` once per index in a range or `CartesianIndices`. -- KernelInterface 0.4 adds sub-groups: ids, shuffles, votes, reductions and scans, also +- KernelInterface 0.4 extends its sub-groups beyond the ids, `sub_group_barrier` and + `shfl_down` of 0.3: `shfl`, `shfl_up` and `shfl_xor` of any `isbits` value, the votes + `sub_group_any`, `sub_group_all` and `sub_group_ballot`, and reductions and scans, also within segments of a sub-group. They are the low-level API for backends, for kernels - written against KernelInterface and for kernel languages built on it; capability queries - say how a backend forms its sub-groups, whether they may diverge, and which types it can - shuffle. See [Sub-groups](@ref ki_subgroups). + written against KernelInterface and for kernel languages built on it. KernelInterface no + longer promises how work-items form sub-groups: `supports_linear_subgroups` says whether + they are consecutive work-items, and `supports_independent_subgroups` and + `supports_partitionable_subgroups` whether sub-groups and their segments may diverge. See + [Sub-groups](@ref ki_subgroups). - [`@groupreduce`](@ref) and [`@groupscan`](@ref) reduce and scan a value over the workgroup, on every backend. `@groupreduce` uses sub-groups internally where the backend can shuffle the values. See [Reductions and scans](@ref group_collectives). @@ -218,7 +224,7 @@ end 1. The kernels are automatically bounds-checked against either the dynamic or statically provided `ndrange`. -2. Kernels implictly return `nothing` +2. Kernels implicitly return `nothing` ## Contributing Please file any bug reports through Github issues or fixes through a pull diff --git a/src/KernelAbstractions.jl b/src/KernelAbstractions.jl index b7cb5c36d..1548b6509 100644 --- a/src/KernelAbstractions.jl +++ b/src/KernelAbstractions.jl @@ -19,8 +19,8 @@ using KernelInterface: KernelInterface, Backend, get_backend, functional, synchr import KernelInterface as KI export KernelInterface -# `GPU` is deprecated in 0.10: and backends ends now subtype `Backend` directly. Keep the name working for code written -# against 0.9, both `x::GPU` and `struct MyBackend <: GPU`. +# `GPU` is deprecated in 0.10, and backends now subtype `Backend` directly. Keep the name +# working for code written against 0.9, both `x::GPU` and `struct MyBackend <: GPU`. Base.@deprecate_binding GPU Backend """ @@ -85,7 +85,7 @@ end This allows for the following configurations: -1. `cpu={true, false}`: **Deprecated** in KernelAbstractions 0.11; this option is ignored. +1. `cpu={true, false}`: **Deprecated** in KernelAbstractions 0.10; this option is ignored. 2. `inbounds={false, true}`: Enables a forced `@inbounds` macro around the function definition in the case the user is using too many `@inbounds` already in their kernel. Note that this can lead to incorrect results, crashes, etc and is fundamentally unsafe. Be careful! 3. `unsafe_indices={false, true}`: Disables the implicit validation of indices, users must avoid `@index(Global)`. 4. `generated={false, true}`: Turns the kernel into a [generated function](https://docs.julialang.org/en/v1/manual/metaprogramming/#Generated-functions), see *Generated* below. @@ -750,7 +750,7 @@ end # CPU backend include("pocl/pocl.jl") -using .POCL +using .POCL: POCL, POCLBackend export POCLBackend """ diff --git a/src/pocl/pocl.jl b/src/pocl/pocl.jl index 37c3e3b82..ecfe621b4 100644 --- a/src/pocl/pocl.jl +++ b/src/pocl/pocl.jl @@ -96,7 +96,10 @@ function queue() end using GPUCompiler -using LLVM, LLVM.IR, LLVM.Build, LLVM.Interop +using LLVM, LLVM.Build, LLVM.Interop +# not all of LLVM.IR, whose `context` would clash with ours +using LLVM.IR: BasicBlock, ConstantArray, ConstantInt, DILocation, GlobalVariable, LLVMType, + MDNode, MD_invariant_load, MD_tbaa, MemoryEffects, StringAttribute, Value using SPIRV_LLVM_Backend_jll, SPIRV_Tools_jll using Adapt