Repository navigation
What is the role of CubeK? #6422
|
What is the role of CubeK? Does it built-in into burn already or if I want higher performance I need to use it separately(using it in my burn code like using an implemented CubeCL kernel)? Will CubeK kernel faster than original burn(if they are separate) when doing same things(matmul, attention, etc.)? |
Replies: 1 comment 3 replies
|
CubeK is the kernel library behind Burn's CubeCL backends, so you're already using it. So for the same op there's no "Burn vs CubeK" speed difference: it's the same kernel. With the default You'd only use CubeK directly if you write your own CubeCL kernels, or a CubeCL program that doesn't go through Burn tensors. It's on crates.io as One setting worth knowing: CubeK reads a [matmul]
allow_tf32 = false |
CubeK is the kernel library behind Burn's CubeCL backends, so you're already using it.
burn-cuda,burn-rocm,burn-wgpu(Vulkan/Metal/WebGPU) andburn-cpuare all built onburn-cubecl, and that crate calls CubeK for matmul, convolution, attention, reductions, random sampling and quantization. For example,tensor.matmul()on the CUDA backend ends up incubek::matmul::launch::launch_ref. The NdArray, LibTorch and Candle backends don't use it.So for the same op there's no "Burn vs CubeK" speed difference: it's the same kernel. With the default
autotunefeature, Burn benchmarks CubeK's variants on your device the first time it sees a given shape and keeps the fastest. For attention, it uses C…