Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
08f36b4
[WIP] QR decomposition.
vaijira Apr 18, 2026
5e61bba
Adding optimized baht_tsqr.
vaijira May 2, 2026
1a3d256
cxlippy (#237)
louisfd Apr 30, 2026
cb5a843
rename flag to heavy (#239)
louisfd May 1, 2026
c7b58b2
Attention: Tile refactor (#234)
louisfd May 1, 2026
7f37cc7
fix precision for topk (#240)
Sublime12 May 1, 2026
04b6a2a
STD: Move replicated tma stuff (#242)
louisfd May 1, 2026
230cd95
STD: Remove vectorization generic from tile (#241)
louisfd May 1, 2026
fbde200
hide vec smem (#243)
louisfd May 1, 2026
2a2c0e1
Feat/expose reference (#244)
louisfd May 1, 2026
da3cc89
expose ref on most kernels (#245)
louisfd May 1, 2026
49ec29c
Add progress to exposed benchmark CPU reference (#246)
louisfd May 2, 2026
6cd130c
Add large-size RFFT/IRFFT support (#238)
g1ibby May 4, 2026
20dfdbd
Small refactor in tile attention, add a bench (#247)
louisfd May 4, 2026
745693d
Update version to 0.2.0-pre.5 (#249)
laggui May 5, 2026
0559580
Refactor/tile/softmax (#251)
louisfd May 5, 2026
a35a474
Feat/interpolate (#250)
SamuelBelanger May 6, 2026
fefe20b
Support virtual padding in RFFT/IRFFT launches (#248)
g1ibby May 6, 2026
7be6ba4
refactor benchmark for less boilerplate (#252)
louisfd May 6, 2026
0dae6e5
minor (#255)
louisfd May 7, 2026
13186f6
Add simple tiled layout (#253)
Sublime12 May 7, 2026
42a2d92
Update version to 0.2.0 (#257)
laggui May 7, 2026
baca496
Add publish-cubek-interpolate
laggui May 7, 2026
df602a2
Fix crate name
laggui May 7, 2026
11eeaed
Feat/interpolation modes (#254)
SamuelBelanger May 7, 2026
407b474
Bump version to 0.3.0-pre.1 (#259)
laggui May 8, 2026
d117138
edit cubecl dependencies to point to the correct revision (#261)
SamuelBelanger May 8, 2026
ddc7094
Validate rhs layout for `fused_gemv_unit_perpendicular` (#262)
AdrianEddy May 8, 2026
b5fc6a8
Tile: refactor file tree for better cohesion (#258)
louisfd May 8, 2026
61fc99c
Feat/pool (#263)
SamuelBelanger May 11, 2026
3a105ec
Refactor test suites to test benchmarks (#260)
louisfd May 11, 2026
0b1aecf
Feat/pool benchmarks (#264)
SamuelBelanger May 11, 2026
d1ac161
WIP: Refactor stage as tile (#265)
louisfd May 12, 2026
d123e81
Refactor stage as tile pt. 2 (#266)
louisfd May 12, 2026
48408bd
Refactor tile as stage pt. 3 (#267)
louisfd May 13, 2026
43f9c6f
Generalization of gemv_plane_parallel to gemm (pt 1) (#269)
louisfd May 14, 2026
e5b75f3
Skeleton for attention backward (#281)
louisfd May 19, 2026
bf09148
refactor: Update to reference refactor (#279)
wingertge May 19, 2026
da0b472
Fix/matmul/smem bust (#283)
louisfd May 20, 2026
3e4de01
CPU Gemm (#271)
louisfd May 20, 2026
cd75f21
Feat/interpolate refactor (#285)
SamuelBelanger May 20, 2026
7f3b637
Refactor stage as tile (pt 3) (#282)
louisfd May 21, 2026
7ccdfa7
Attention: Naive backward implementation (#286)
louisfd May 21, 2026
3472701
Fix nearest floor and exact (#288)
SamuelBelanger May 21, 2026
72d7d11
Fix complex FFT test (#289)
louisfd May 21, 2026
3e7e88c
Add tiled layout for tensor (#268)
Sublime12 May 21, 2026
ab21e40
Interpolate kernel refactor (#292)
SamuelBelanger May 22, 2026
5fbd36c
fix tma (#291)
louisfd May 23, 2026
928c7a7
Update CubeCL
nathanielsimard May 25, 2026
19f026f
refactor: Add lifetime to view (#290)
wingertge May 26, 2026
aa0311d
fix(matmul): prevent zero stage size in plane selector (#293)
AdrianEddy May 29, 2026
bf6540b
Tiled layout: tiles as a Space + View, built on cubecl's tiled layout…
louisfd May 29, 2026
315f9a9
Refactor/nearest value computation (#296)
SamuelBelanger Jun 1, 2026
05a1924
Fix/shared memory (#297)
SamuelBelanger Jun 3, 2026
49f3232
Feat/interpolate auto tune (#298)
SamuelBelanger Jun 3, 2026
3bb7824
remove elem_acc autotune key (#299)
SamuelBelanger Jun 4, 2026
c3f3820
feat(reduce): add logical any all reductions (#302)
zhan-wei-919 Jun 8, 2026
70e049a
cubek-tile (#300)
louisfd Jun 8, 2026
7474678
Fix/interpolate nearest vectorization (#301)
SamuelBelanger Jun 8, 2026
b6324f2
More representative naming in quantize/dequantize kernels and remove …
ThierryCantin-Demers Jun 9, 2026
cbe5ca5
Tiling: Tiles type refactor, cpu matmul (#305)
louisfd Jun 10, 2026
937f76b
Matmul: File refactor, routines with their launch (#306)
louisfd Jun 10, 2026
8a6b911
refactor(reduce): require output precision for Any / All (#304)
zhan-wei-919 Jun 10, 2026
80bf595
Layout request (wip concept but mergeable now) (#307)
louisfd Jun 11, 2026
6938626
chore: bump previous supported Rust version to 1.95 (#328)
syl20bnr Jun 12, 2026
7890772
update cubecl (#325)
louisfd Jun 12, 2026
cb1c64b
Feat/cubek resample (#324)
SamuelBelanger Jun 12, 2026
7c186c6
Expose public complex FFT (cfft) (#327)
LucaCappelletti94 Jun 15, 2026
1efad2c
Clamp inferred Cube reduce width to the shared-memory limit for ArgTo…
LucaCappelletti94 Jun 15, 2026
bba5b8d
add benchmark for gemm cpu and some fix (#329)
louisfd Jun 15, 2026
4f3fd3e
Update cubecl revs (#338)
nathanielsimard Jun 15, 2026
e76d2dc
prettier walk over (#343)
louisfd Jun 16, 2026
06fd307
Update cubecl
nathanielsimard Jun 16, 2026
e1b7278
Feat/cubek resample interpolation modes (#341)
SamuelBelanger Jun 16, 2026
81fc211
Feat/Naive implementation for tiled dequantize (#344)
ThierryCantin-Demers Jun 16, 2026
fdf3d83
Matmul: fix highly permuted not calling into contiguous in some versi…
louisfd Jun 16, 2026
f66771a
CpuGemm: Multiple planes (#342)
louisfd Jun 17, 2026
d402fdc
update cubecl & fix previous pr (#349)
louisfd Jun 17, 2026
acb4ae5
Tile: minor refactoring (#350)
louisfd Jun 17, 2026
667a818
Feat/dequantize tiled view (#348)
ThierryCantin-Demers Jun 17, 2026
382b599
update cubecl (#354)
louisfd Jun 18, 2026
6016543
Run float Gemm on GPU for all operand layouts by normalizing to the D…
LucaCappelletti94 Jun 22, 2026
96d44c1
minor launch refactor (#371)
louisfd Jun 22, 2026
903ea1d
add all crates to test runs (#376)
ThierryCantin-Demers Jun 22, 2026
4d5eb62
Feat/resample window (#351)
SamuelBelanger Jun 22, 2026
9d547d5
Add support for f64 #198 (#333)
vaijira Jun 22, 2026
0e1f572
update cubecl (#377)
louisfd Jun 22, 2026
5c54983
Fix quantized matmul GEMV reading wrong elements from a packed operan…
LucaCappelletti94 Jun 22, 2026
db1fcc6
Refactor/resamle tile size (#378)
SamuelBelanger Jun 23, 2026
f71922a
Tile Arg Launch builder (#379)
louisfd Jun 23, 2026
54c565b
Perf/cpu gemm/instruction (#381)
louisfd Jun 23, 2026
a9abcf9
fix a test (#380)
louisfd Jun 23, 2026
ebbbae3
Update to new cubecl syntax.
vaijira Jun 28, 2026
8ec4699
Merge branch 'tracel-ai:main' into linalg
vaijira Jun 28, 2026
ef44e7c
Added mgs algorithm.
vaijira Jun 30, 2026
be5b80c
Refactor following blueprint guide.
vaijira Jul 3, 2026
4e15620
Add QR benchmark support.
vaijira Jul 3, 2026
b5f84b6
Simplify and let only baht_tsqr qr algorithm.
vaijira Jul 4, 2026
108a2ca
Remove unneeded f64 casting.
vaijira Jul 4, 2026
ab2436d
Parallelize baht_tsqr panel kernels and tune matmul strategies (3-6x …
vaijira Jul 4, 2026
3a9c5f6
Merge branch 'main' into linalg
vaijira Jul 7, 2026
8460bce
Merge branch 'main' into linalg
vaijira Jul 11, 2026
8f1ba5c
Harden cubek-linalg QR launch path and speed it up 3-29%
vaijira Jul 11, 2026
9870d63
Add plane_sum support.
vaijira Jul 11, 2026
5946838
Vectorize the QR Q^T update; 1.5-2.5% faster end to end
vaijira Jul 21, 2026
e072e6d
Stage build_t_tsqr's T and Gram in shared memory; 10% off the kernel
vaijira Jul 21, 2026
3bace8a
Add an opt-in tf32 path for the QR trailing updates; up to 1.9x
vaijira Jul 21, 2026
5bfd2a9
Merge branch 'main' into linalg
vaijira Jul 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ cubek-fft = { path = "../crates/cubek-fft", version = "=0.3.0-pre.1", features =
cubek-interpolate = { path = "../crates/cubek-interpolate", version = "=0.3.0-pre.1", features = [
"benchmarks",
] }
cubek-linalg = { path = "../crates/cubek-linalg", version = "=0.3.0-pre.1", features = [
"benchmarks",
] }
cubek-matmul = { path = "../crates/cubek-matmul", version = "=0.3.0-pre.1", features = [
"benchmarks",
] }
Expand Down Expand Up @@ -139,3 +142,7 @@ name = "fft"
[[bench]]
harness = false
name = "quantized_matmul"

[[bench]]
harness = false
name = "qr"
1 change: 1 addition & 0 deletions benchmarks/benches/qr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
benchmarks::run_bench!(qr);
2 changes: 2 additions & 0 deletions benchmarks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub use cubek_attention::eval::forward::benchmarks as attention;
pub use cubek_convolution::eval::benchmarks as conv2d;
pub use cubek_fft::eval::benchmarks as fft;
pub use cubek_interpolate::eval::benchmarks as interpolate;
pub use cubek_linalg::eval::benchmarks as qr;
pub use cubek_matmul::eval::benchmarks::gemm;
pub use cubek_matmul::eval::benchmarks::gemm_cpu;
pub use cubek_matmul::eval::benchmarks::gemm_cpu_tiled;
Expand Down Expand Up @@ -38,6 +39,7 @@ pub fn all() -> &'static [&'static dyn BenchmarkCategory] {
&crate::interpolate::Category,
&crate::memcpy_async::Category,
&crate::pool::Category,
&crate::qr::Category,
&crate::quantized_matmul::Category,
&crate::reduce::Category,
&crate::split_k::Category,
Expand Down
36 changes: 36 additions & 0 deletions crates/cubek-linalg/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[package]
authors = [
"Jorge Perez Burgos <vaijira@gmail.com>",
]
categories = ["science", "mathematics", "algorithms"]
description = "CubeK: Linear Algebra Kernels"
edition.workspace = true
keywords = []
license.workspace = true
name = "cubek-linalg"
readme.workspace = true
repository = "https://github.com/tracel-ai/cubek/tree/main/crates/cubek-linalg"
version.workspace = true

[features]
default = ["std", "cubecl/default"]
std = ["cubecl/std", "thiserror/std"]
# Enables `pub mod eval::benchmarks` — catalogue of QR benchmark problems /
# strategies consumed by the benchmark registry.
benchmarks = ["dep:cubek-test-utils", "cubecl/test-runtime"]

[dependencies]
cubecl = { workspace = true, features = ["stdlib"] }
cubecl-common = { workspace = true }
cubek-std = { path = "../cubek-std", version = "=0.3.0-pre.1", default-features = false }
cubek-matmul = { path = "../cubek-matmul", version = "=0.3.0-pre.1", default-features = false }
cubek-test-utils = { path = "../cubek-test-utils", version = "=0.3.0-pre.1", default-features = false, optional = true }

thiserror = { workspace = true }

[dev-dependencies]
cubecl = { workspace = true, features = ["test-runtime"] }
cubecl-common = { workspace = true }
cubek-test-utils = { path = "../cubek-test-utils", version = "=0.3.0-pre.1", default-features = false }
num-traits = { workspace = true }
paste = "1.0"
75 changes: 75 additions & 0 deletions crates/cubek-linalg/examples/profile_qr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
//! Minimal driver for profiling the QR decomposition under nsys/ncu.
//!
//! Run with:
//! ```sh
//! cargo build --release -p cubek-linalg --example profile_qr --features cubecl/cuda
//! nsys profile --stats=true target/release/examples/profile_qr [m] [n] [iters] [dtype]
//! ```
//!
//! `dtype` is `f32` (default) or `f64`; pass a 5th arg `tf32` to opt the
//! trailing-update GEMMs into tensor cores (see `BahtTsqrStrategy`).

use cubecl::prelude::*;
use cubecl::std::tensor::TensorHandle;
use cubecl::{Runtime, TestRuntime, future};

fn run<E: Float + CubeElement>(m: usize, n: usize, iters: usize, label: &str, allow_tf32: bool) {
let client = TestRuntime::client(&Default::default());

// Col-major pseudo-random data, same layout the tests use.
let mut state = 0x2545F4914F6CDD1Du64;
let data: Vec<E> = (0..m * n)
.map(|_| {
state ^= state << 13;
state ^= state >> 7;
state ^= state << 17;
let v = (state as f64 / u64::MAX as f64) - 0.5;
<E as num_traits::NumCast>::from(v).unwrap()
})
.collect();
let handle = client.create_from_slice(E::as_bytes(&data));
let a = TensorHandle::<TestRuntime>::new(
handle,
vec![m, n],
vec![1, m],
E::as_type_native_unchecked(),
);

let strategy = cubek_linalg::routines::BahtTsqrStrategy { allow_tf32 };

// Warmup (JIT compilation).
cubek_linalg::qr_with_strategy::<TestRuntime, E>(&client, &a, strategy).unwrap();
future::block_on(client.sync()).unwrap();

let mut times_ms = Vec::with_capacity(iters);
for i in 0..iters {
let start = std::time::Instant::now();
cubek_linalg::qr_with_strategy::<TestRuntime, E>(&client, &a, strategy).unwrap();
future::block_on(client.sync()).unwrap();
let elapsed = start.elapsed();
times_ms.push(elapsed.as_secs_f64() * 1e3);
println!("iter {i}: {elapsed:?}");
}

times_ms.sort_by(|x, y| x.partial_cmp(y).unwrap());
let mean: f64 = times_ms.iter().sum::<f64>() / times_ms.len() as f64;
let median = times_ms[times_ms.len() / 2];
println!("{m}x{n} {label}: mean {mean:.3} ms, median {median:.3} ms");
}

fn main() {
let mut args = std::env::args().skip(1);
let m: usize = args.next().and_then(|a| a.parse().ok()).unwrap_or(2048);
let n: usize = args.next().and_then(|a| a.parse().ok()).unwrap_or(2048);
let iters: usize = args.next().and_then(|a| a.parse().ok()).unwrap_or(3);
let dtype = args.next().unwrap_or_else(|| "f32".to_string());
// Optional 5th arg: `tf32` opts the trailing-update GEMMs into tensor cores.
let allow_tf32 = args.next().as_deref() == Some("tf32");
let label = if allow_tf32 { "tf32" } else { "full" };

match dtype.as_str() {
"f64" => run::<f64>(m, n, iters, &format!("f64/{label}"), allow_tf32),
"f32" => run::<f32>(m, n, iters, &format!("f32/{label}"), allow_tf32),
other => panic!("unsupported dtype `{other}`; use f32 or f64"),
}
}
Loading
Loading