Skip to content

Add optional single-thread cutoff for small level-3 problems#942

Draft
jeffhammond wants to merge 1 commit into
flame:masterfrom
jeffhammond:feature/small-matrix-mt
Draft

Add optional single-thread cutoff for small level-3 problems#942
jeffhammond wants to merge 1 commit into
flame:masterfrom
jeffhammond:feature/small-matrix-mt

Conversation

@jeffhammond

Copy link
Copy Markdown
Member

Below a work threshold (mnk), thread-spawn and barrier overhead dominates tiny GEMMs -- e.g. 16x16x16 runs ~10x slower with many threads than with one. Add a size-gated cutoff to the native and SUP level-3 thread decorators that forces a single thread when mnk < BLIS_SMALL_MT_THRESHOLD. The threshold is precision-aware: single-precision real GEMM uses a larger register tile (8x12 vs 6x8) so its small matrices have too few micro-tiles to parallelize, and its crossover is ~8x higher than double's.

Opt-in: define BLIS_SMALL_MT_THRESHOLD (e.g. 200000) to enable; undefined leaves behavior unchanged. Threading policy only -- results are identical.

Below a work threshold (m*n*k), thread-spawn and barrier overhead dominates
tiny GEMMs -- e.g. 16x16x16 runs ~10x slower with many threads than with
one. Add a size-gated cutoff to the native and SUP level-3 thread
decorators that forces a single thread when m*n*k < BLIS_SMALL_MT_THRESHOLD.
The threshold is precision-aware: single-precision real GEMM uses a larger
register tile (8x12 vs 6x8) so its small matrices have too few micro-tiles
to parallelize, and its crossover is ~8x higher than double's.

Opt-in: define BLIS_SMALL_MT_THRESHOLD (e.g. 200000) to enable; undefined
leaves behavior unchanged. Threading policy only -- results are identical.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jeffhammond
jeffhammond marked this pull request as draft July 16, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant