Skip to content

Add optional TBLIS CPU contraction provider - #1343

Closed
Ryo-wtnb11 wants to merge 2 commits into
tensor4all:mainfrom
Ryo-wtnb11:feature/issue-1332-tblis-cpu
Closed

Add optional TBLIS CPU contraction provider#1343
Ryo-wtnb11 wants to merge 2 commits into
tensor4all:mainfrom
Ryo-wtnb11:feature/issue-1332-tblis-cpu

Conversation

@Ryo-wtnb11

Copy link
Copy Markdown
Collaborator

Summary:

  • optional cpu-tblis provider on the CPU backend, with fallback to the existing CPU path when TBLIS is unavailable or not selected
  • complex contraction support is wired through the same route
  • provider resolution now goes through tenferro-tblis-src, with a pinned TBLIS commit and static linking so the runtime/test/bench binaries do not depend on libtblis.dylib
  • docs and the worklog were updated to match the new provider flow

Tests run:

  • cargo test -p tenferro-cpu --no-default-features --features cpu-faer,cpu-tblis passed: 220 unit tests, 7 backend capability tests, 3 provider feature tests, 25 runtime error tests, 61 doctests
  • cargo check -p tenferro-runtime --no-default-features --features cpu-faer,cpu-tblis passed
  • cargo check -p tenferro-linalg --no-default-features --features cpu-faer,cpu-tblis passed
  • cargo check -p tenferro-cpu --no-default-features --features cpu-faer,cpu-tblis --benches passed
  • cargo check -p tenferro-cpu --no-default-features --features cpu-faer,cpu-tblis,blas-openblas --benches passed after source-provider downloads
  • cargo package -p tenferro-tblis-src --allow-dirty --offline passed
  • cargo fmt --all --check passed
  • git diff --check passed
  • otool -L on the test/bench binaries showed no libtblis.dylib dependency

Benchmarks:

  • Quick local release benchmarks with threads pinned: TBLIS_NUM_THREADS=1, RAYON_NUM_THREADS=1, OMP_NUM_THREADS=1, and for the BLAS runs OPENBLAS_NUM_THREADS=1
  • Small/default BLAS run:
    • f64 matmul 32: faer 3.42 us, BLAS 1.98 us, TBLIS 5.66 us
    • f64 matmul 64: faer 12.71 us, BLAS 19.77 us, TBLIS 19.52 us
    • f64 matmul 128: faer 86.88 us, BLAS 99.27 us, TBLIS 101.31 us
    • c64 lhs-conj matmul 128: faer 385.69 us, BLAS 406.12 us, TBLIS 333.33 us
    • rank-4 interleaved n=8: faer 16.79 us, BLAS 29.64 us, TBLIS 19.08 us
    • rank-5 batched interleaved n=8: faer 62.11 us, BLAS 108.55 us, TBLIS 74.58 us
    • rank-4 row-major view n=8: faer 17.90 us, BLAS 42.66 us, TBLIS 20.13 us
  • Large sample:
    • f64 matmul 256: faer 617.38 us, BLAS 748.55 us, TBLIS 645.64 us
    • f64 matmul 512: faer 5.04 ms, BLAS 4.91 ms, TBLIS 4.78 ms
    • c64 lhs-conj matmul 256: faer 2.93 ms, BLAS 2.77 ms, TBLIS 2.39 ms
    • c64 lhs-conj matmul 512: faer 23.37 ms, BLAS 22.08 ms, TBLIS 18.32 ms
    • rank-4 interleaved n=16: faer 672.51 us, BLAS 676.83 us, TBLIS 646.17 us
    • rank-5 batched interleaved n=16: faer 3.03 ms, BLAS 3.10 ms, TBLIS 2.67 ms
    • rank-4 row-major view n=16: faer 935.45 us, BLAS 954.64 us, TBLIS 651.67 us
  • Interpretation: TBLIS is not a broad small-size win; it is more favorable on larger complex, interleaved, and view-heavy cases, so this PR does not overstate it as a universal replacement

Ryo-wtnb11 and others added 2 commits July 4, 2026 10:39
@Ryo-wtnb11

Copy link
Copy Markdown
Collaborator Author

Superseded by internal-branch PR #1344 so repository rules review can run on a non-external PR.

@Ryo-wtnb11 Ryo-wtnb11 closed this Jul 10, 2026
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