Skip to content

Add matmul_supported, UnsupportedConfigError, and negative plan caching - #11

Merged
AntonOresten merged 1 commit into
mainfrom
matmul-supported
Aug 7, 2026
Merged

AntonOresten merged 1 commit into
mainfrom
matmul-supported

Conversation

@AntonOresten

Copy link
Copy Markdown
Member

The routing surface: let a caller ask whether cuBLASLt can serve a matmul before committing to it, cheaply and repeatedly.

  • UnsupportedConfigError — typed replacement for the string-matched ArgumentError when the heuristic finds no algorithm. cuBLASLt reports "no algorithm" in two spellings (an empty heuristic result, or NOT_SUPPORTED thrown by the heuristic call itself, depending on configuration and architecture); both now become this one exception.
  • matmul_supported(D, A, B; kws...) -> Bool — same signature as matmul!, no launch. A router can pick between cuBLASLt and a fallback without try/catch. The probe builds the plan and leaves it in the cache, so a true answer makes the following matmul! free of heuristic cost. Malformed arguments still throw: false strictly means cuBLASLt has no algorithm, never you called this wrong.
  • Negative plan caching — an UnsupportedConfigError is memoized alongside plans: it's a stable fact about this device and this library, reached only after a full (not cheap) heuristic query. Argument errors are not cached.
  • Unbounded cache — the 256-entry bound evicted wholesale, so a workload with 257 live configurations thrashed permanently, rebuilding every plan on every call. One entry per distinct configuration is bounded by the program's shape diversity, and a plan is a handful of host-side descriptors. empty_plan_cache! remains.
  • Workspace docs — spell out the caller-supplied-workspace contract as the graph-capture seam: plan.workspace_size is known before any launch, so a caller carves bytes from its own arena and the apply is allocation-free.

New test/cache.jl covers the probe, the negative cache (on devices below CC 10.0, via an MXFP8 request), and the caller-supplied-workspace contract (reuse across applies, slab views, too-small rejection). Verified locally on RTX 6000 Ada (CC 8.9): new tests 19/19, existing plan/matmul/compute_types suites clean.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.17647% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/cache.jl 90.00% 1 Missing ⚠️
src/plan.jl 93.33% 1 Missing ⚠️
src/types.jl 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

The routing surface: let a caller ask whether cuBLASLt can serve a
matmul before committing to it, cheaply and repeatedly.

- `UnsupportedConfigError`: typed replacement for the string-matched
  ArgumentError when the heuristic finds no algorithm. Both spellings of
  "no algorithm" (empty heuristic result, NOT_SUPPORTED from the call
  itself) now become this one exception.
- `matmul_supported(D, A, B; kws...) -> Bool`: same signature as
  matmul!, no launch. Builds the plan and leaves it in the cache, so a
  `true` answer makes the following matmul! free of heuristic cost.
  Malformed arguments still throw — `false` strictly means "no
  algorithm exists".
- Plan cache reworked: negative results (UnsupportedConfigError) are
  memoized alongside plans — "no algorithm" is a stable fact reached
  only after a full heuristic query. The 256-entry bound with wholesale
  eviction is gone; a workload with 257 live configurations previously
  thrashed permanently.
- Workspace docs: spell out the caller-supplied-workspace contract as
  the graph-capture seam (plan.workspace_size known before any launch,
  apply becomes allocation-free).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@AntonOresten
AntonOresten merged commit 59e0c99 into main Aug 7, 2026
3 checks passed
@AntonOresten
AntonOresten deleted the matmul-supported branch August 8, 2026 13:04
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