GPU Programming
Kernel syntax, the `GPU` effect, and what works today.
GPU Programming
Sounio aims to make GPU compute a first-class part of the language, not an afterthought.
At the surface level, this shows up as:
kernel fn ...for GPU kernelswith GPUfor host functions that perform GPU operations (launch, device memory, sync, …)
What Works Today (Compiler Reality)
The compiler accepts kernel fn syntax and type-checks kernels as functions.
For example, this is valid and should type-check:
kernel fn noop(a: &[i32]) {
// A minimal kernel (no GPU intrinsics used).
}
fn main() with IO {
println("GPU docs: kernel syntax parses and type-checks.")
}
Spec vs Implementation
The full GPU programming model in Sounio includes:
- kernel launch APIs
- device memory allocation and transfers
- GPU intrinsics like thread/block IDs and synchronization
Some of these are feature-dependent and may require external toolchains (CUDA, Metal, SPIR-V) to actually execute kernels on real hardware.
When in doubt:
- read the stdlib GPU modules under
stdlib/gpu/ - consult
spec/LANGUAGE_SPECIFICATION.md(GPU section) - prefer compiler fixtures and tests as the source of “what compiles today”