Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Unreleased

### Added

- Criterion benchmarks (`crates/eschalign/benches/`): `kernels` (score per
backend, mode and read length; row-major against reference-major; a 64-read
`map_reads` chunk) and `gpu` (`score_batch`, int against half2; needs
`--features gpu` and a device, skips without one). `criterion` is a
dev-dependency only; the library is still std-only.

## 0.3.0

### Changed
Expand Down
5 changes: 4 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ beside wall — the lessons of benchmarking on BeeGFS, where the first arm to
touch a file pays to page it in. Output goes to node-local scratch and is
deleted. The numbers carried over from escapepod-rs are in `benchmarks/README.md`.
`crates/eschalign/examples/{long_read_probe,gpu_score_probe}.rs` are the
kernel-level probes; keep them re-runnable. Benchmark output belongs under
kernel-level probes; keep them re-runnable. `cargo bench -p eschalign --bench
kernels` (and `--bench gpu` with `--features gpu`) are the criterion versions,
for a before/after with a confidence interval (`benchmarks/README.md`).
Benchmark output belongs under
`results/` or `~/scratch/<topic>/`, never `~/.cache`.

```bash
Expand Down
193 changes: 193 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ Carved out of escapepod-rs 0.31.0. The sections below are that repository's `esc

The harness is `benchmarks/benchmark_align.sh`; see its header for the flags.

Criterion benchmarks (`crates/eschalign/benches/`) give a confidence interval
for kernel changes on the same synthetic 164-reference panel the probes use.
Run them in an allocation, not on the login node; `[profile.bench]` inherits
release, so they match the shipped codegen. Criterion's own output
(`target/criterion`) stays in the build directory, so point `CARGO_TARGET_DIR`
under `~/scratch/<topic>/` and delete it after.

```bash
# CPU: score_all (backend x mode x read length), loop_order, map_reads (64-read chunk)
srun -p rna -c 32 --mem=32G -- pixi run -e dev cargo bench -p eschalign --bench kernels
cargo bench -p eschalign --bench kernels -- score_all/local/avx512 # a filter
# GPU: score_batch, int against half2, local and semi-global
srun -p gpu -A gpu_rbi -c 16 --gres=gpu:1 -- \
pixi run -e dev-gpu cargo bench --features gpu -p eschalign --bench gpu
# compare against a baseline: cargo bench ... -- --save-baseline main, then --baseline main
```

First numbers (2026-10-17, v0.3.0, one thread, 130 nt, local): avx2 8.0e9
cells/s and avx512 1.20e10 on rna; the A30 scores 2.66e11 on the int kernel and
5.68e11 on half2 (20,000-read batches). These agree with the probes below.
`examples/{long_read_probe,gpu_score_probe}.rs` remain the tools for real reads,
very long reads and register counts.

## `eschalign --device gpu`: narrow tail stripe in the half2 kernel (2026-10-17, #13)

The half2 kernel below walked a full, masked 16-row stripe for the end of
Expand Down
1 change: 1 addition & 0 deletions crates/eschalign/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pixi run -e dev-gpu cargo nextest run --features gpu -p eschalign --test gpu_par
- `tests/gpu_parity.rs` (`gpu`) — `scalar::score` by equality, every check on **both kernels** (`set_half2`): the SIMD tests' random generator in both modes and five schemes (the usual three plus a positive mismatch and free gaps, which only the half2 kernel's end-of-reference masking survives), every read length 1–40 around the stripe, a 300-reference panel that splits into groups, the fixture reads against both fixture panels, a batch that straddles `fits_f16` (split between the kernels), and a panel over `MAX_REF_LEN_H2` (int kernel alone). Skips with a message where there is no device.
- `examples/gpu_score_probe.rs` (`gpu`) — times `score_batch` alone on real reads, `auto` (half2 where it applies) or `int`, and prints each kernel's registers and local memory (spills); keep it re-runnable (A30, M1's reads: int 2.6e11 cells/s, ALU-bound; half2 5.5e11 local / 6.1e11 semi-global — `benchmarks/README.md`).
- `examples/long_read_probe.rs` — both score-kernel loop orders, one thread, synthetic reads of 1 k–400 k nt (or `--reads FASTA`) against a synthetic 164-reference panel (or `--reference`); `--split` also times one thread per lane group. The measurement `TRANSPOSED_MIN_READ_LEN` was chosen from; keep it re-runnable (`benchmarks/README.md`).
- `benches/kernels.rs`, `benches/gpu.rs` (`gpu`) — criterion: score per backend/mode/length, the two loop orders, a 64-read `map_reads` chunk, and `score_batch` int against half2. The same synthetic panel as the probes; criterion is a dev-dependency only (the crate stays std-only). Run in an allocation with `CARGO_TARGET_DIR` under scratch (`benchmarks/README.md`).
- `simd/mod.rs`'s own equality tests (`avx2_matches_scalar_random`, `avx512_matches_scalar_random`, `simd_matches_scalar_on_fixture_reads`, `traceback_kernels_match_scalar`, `transposed_matches_scalar_random`, `transposed_matches_row_major_on_fixture_reads`, `dispatch_picks_transposed_above_threshold`) sweep `Backend::available()`, not the dispatch's pick — run on `rna` (Cascade Lake) or the AVX-512 kernels never execute. The transposed random test runs the scalar oracle over 20–56 kb reads, which is why this crate builds at `opt-level = 2` in the dev profile (workspace `Cargo.toml`, `[profile.dev.package.eschalign]`). `mapper::tests::per_group_scores_equal_score_all` pins the per-group API to `score_all`.

## Invariants and traps
Expand Down
11 changes: 11 additions & 0 deletions crates/eschalign/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,19 @@ default = []
gpu = ["dep:cudarc"]

[dev-dependencies]
# Benchmarks only; no plotting or rayon, so nothing extra to build.
criterion = { version = "0.5", default-features = false, features = ["cargo_bench_support"] }
serde_json = "1"

[[bench]]
name = "kernels"
harness = false

[[bench]]
name = "gpu"
harness = false
required-features = ["gpu"]

[[example]]
name = "gpu_score_probe"
required-features = ["gpu"]
Loading
Loading