Skip to content

Latest commit

 

History

191 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KernelForge.jl

A pure-Julia GPU primitives library that is flexible — every primitive takes an arbitrary operator and an arbitrary element type, your own structs and comparators included; cross-architecture — one implementation runs on both NVIDIA and AMD through KernelAbstractions; and performant — matching, or coming close to, the hand-tuned vendor libraries (CUB / cuBLAS on NVIDIA, rocPRIM / rocBLAS on AMD).

NVIDIA A100 (Ampere, 80 GB) — vs CUB / cuBLAS

matvec — A100 vecmat — A100
scan — A100 mapreduce — A100
sort — A100

AMD MI300A (CDNA3, ROCm 6.4) — vs rocPRIM / rocBLAS

matvec — MI300A vecmat — MI300A
scan — MI300A mapreduce — MI300A
sort — MI300A
NVIDIA A40 (Ampere) — vs CUB / cuBLAS, plus copy bandwidth
matvec — A40 vecmat — A40
scan — A40 mapreduce — A40
copy bandwidth — A40

Each figure states its own op, GPU and metric. Forge = KernelForge, AK = AcceleratedKernels; a hatched bar runs off the top of its panel and is labelled with its real value. More GPUs (A40, RTX 1000, MI300X) and the raw CSV data live in the KernelForge-benchmarks repo.

Links

Installation

using Pkg
Pkg.add("KernelForge")

Quick start

using KernelForge, CUDA   # or AMDGPU

x = CUDA.rand(Float32, 10^6)

# Reduction with a custom map + operator
total = KernelForge.mapreduce(abs2, +, x)      # sum of squares

# Prefix scan (supports non-commutative ops)
dst = similar(x)
KernelForge.scan!(+, dst, x)                    # cumulative sum

# Matrix–vector product
A = CUDA.rand(Float32, 1000, 500)
v = CUDA.rand(Float32, 500)
y = KernelForge.matvec(A, v)                    # y ≈ A * v

# Radix sort, in place
KernelForge.sort!(x)

Features

  • Map-reduce with custom functions and operators, supporting arbitrary dimensions and multidimensional arrays
  • Prefix scan supporting non-commutative operations
  • Matrix-vector operations with customizable element-wise and reduction operations
  • Matrix-matrix product (gemm) with customizable element-wise, reduction and epilogue operations, all four transpose states, and an opt-in tensor-core path
  • Searchfindfirst, findlast, argmax, argmin on GPU arrays
  • Vectorized copy with configurable load/store widths
  • Views and strided arrays supported throughout

Backends

CUDA (NVIDIA) and AMDGPU (AMD) via weak dependencies; the backend is selected through KernelAbstractions extensions. Tested on NVIDIA A100, A40, RTX 1000 and AMD MI300A, MI300X.

Sponsors

KernelForge.jl is an open-source project maintained in my personal time. If this package is useful to you — especially in a production or HPC setting — you can support its development and maintenance via GitHub Sponsors.

Corporate sponsors receive priority support on issues and an acknowledgment in the documentation.

Thanks to the people who support KernelForge.jl!

License

MIT

About

No description, website, or topics provided.

Resources

Stars

25 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages