Skip to content

cost: read the team dispatch cost from threadteam 0.1.2; drop team_section_cost (threadteam-rs#6 stage 4) - #104

Merged
shinaoka merged 3 commits into
mainfrom
refactor/drop-team-section-cost
Oct 29, 2026
Merged

shinaoka merged 3 commits into
mainfrom
refactor/drop-team-section-cost

Conversation

@shinaoka

Copy link
Copy Markdown
Member

Stage 4 of tensor4all/threadteam-rs#6. faer stops extrapolating the team dispatch cost itself and reads threadteam's table, so the model exists in one place for every consumer.

Changes

Gate decisions that change (by design)

row before after
generic (largest anchor at 6) flat to width 8 linear from 7: width 8 is 4 us instead of 3 us, so a 10 us one-section region at width 8 now stays serial
x86_64-avx512 team 0.9 us at width 8 its measured width-8 anchor, 0.98 us
x86_64-avx2 (Zen2 row) 3 us at width 2, 3 * 64 / 8 = 24 us at width 64 1.42 us at width 2, 9.33 us at width 64: regions go parallel more readily on such hosts

Tests

  • utils::cost::tests::the_team_cost_is_threadteams_table_at_every_width checks:
    • for five rows, the shape cost equals threadteam's table at widths 2 to 128;
    • above each row's largest anchor, the cost is cost(w_m) * w / w_m in integer ns, including width 128 on the Zen2 row;
    • a region that does not pay at 8 does not pay at 64.
  • utils::team::tests::kernel_width_finds_the_widest_paying_width_on_a_falling_row.

Verification

  • cargo test -p t4a-faer --lib: 520 passed. --doc: 63 passed. --lib utils:: after the last edit: 54 passed.
  • cargo check -p t4a-faer for no-default, std, std,rayon, default and std,rayon,threadteam: no new warnings, and one fewer (MEASURED_MAX_WIDTH unused).
  • Independent pre- and post-implementation reviews (gpt-6.1-sol) were done and their findings applied.

Not run: the adoption-protocol acceptance measurement

docs/adoption-protocol.md asks for a blast-radius acceptance run before merge. Here the blast radius is every family whose parallel gate reads the team cost: GEMM and the triangular products through kernel_width and the tiled floor, plus the factorizations and solves through ParShape and par_pays_time.

This change moves gate inputs, not kernels. Following the maintainer's rule against a long campaign per change, the run was not done; the maintainer decides before merge whether to run it.

Next

tcontract-exec and tlinalg lock updates follow this PR.

🤖 Generated with Claude Code

shinaoka and others added 3 commits October 29, 2026 10:56
…ction_cost

threadteam 0.1.1 extrapolates WidthCosts linearly above a row's largest
anchor and 0.1.2 measures a Zen2 team row for x86_64-avx2 up to width 64
(tensor4all/threadteam-rs#6), so faer's own extrapolation above width 8
(team_section_cost, MEASURED_MAX_WIDTH, #97) is deleted and the four readers
ask threadteam's table. kernel_width searches from the full width down:
measured rows fall with the width, so a narrow width that does not pay says
nothing about a wide one. Requirement threadteam 0.1.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shinaoka

Copy link
Copy Markdown
Member Author

Before/after on broccoli: 1T and 16T are decision-neutral; 64T is not resolvable here

origin/main ddc55a0 against PR head b83f08d, gemm f64 256x4096x256 and qr_factor f64 1024 C,
1 / 16 / 64 threads, 3 process sets per cell with the arms alternating, harness prime 250 ms / 5 reps /
median, per-cell whole-L3-domain idle guard (EPYC 7702P, 64 cores Zen2, SMT off, boost 0, governor
performance).

Both arms link threadteam 0.1.2 (the harness's own lock already carries it), so the difference
measured here is faer's reading of the cost — the new row plus the deleted team_section_cost — and
not the library version. Harness: faer-benchmark 0e685d7 (after #37).

cell T order main (3 sets) PR (3 sets) ratio
gemm 256x4096x256 1 C 21.20 (20.97/21.20/21.65) 20.99 (20.99/21.17/20.96) 1.010
gemm 256x4096x256 16 C 2.152 (2.14/2.18/2.15) 2.172 (2.17/2.17/2.19) 0.991
gemm 256x4096x256 16 F 2.166 2.167 0.999
qr_factor 1024 1 C 77.05 (77.84/76.88/77.05) 73.62 (73.31/73.62/73.70) 1.047
qr_factor 1024 1 F 63.98 64.20 0.997
qr_factor 1024 16 C 16.10 (16.28/16.06/16.10) 16.00 (16.00/15.69/16.18) 1.006
qr_factor 1024 16 F 14.03 14.03 1.000

A floor change shows up as "a region splits or it does not", so this is the answer that matters:
at 1T and at 16T none of these cells moves.
The row decides the same thing as the extrapolation it
replaces on these shapes. (The 4.7% on qr_factor 1024 C at 1T is a per-arm offset that is
reproducible within each arm and absent in F order — one thread opens no region, so that is the
binary-layout noise floor, not a decision.)

64T: no verdict from this host. The cells are bimodal there in both arms: gemm F order is
1.12/1.11 ms in main and 6.28/1.12/5.11 ms in the PR (the PR's own three sets span 5.6x), and
qr_factor C is 18.03/17.52 against 16.01/37.58. The one pair worth a follow-up on a quiet machine is
qr_factor F 64T, where the two sets of each arm agree tightly and differ by 1.9x (main 25.23/29.14,
PR 14.21/13.97) — but the C order at the same budget disagrees, so I am not calling it a win. It is
the same per-process "the regions did not engage" mode I reported on #99 and #91
(16 participants run serially in a fresh process, ~3x), which makes a single-process 64T comparison
meaningless.

@shinaoka
shinaoka merged commit 31f059c into main Oct 29, 2026
7 checks passed
@shinaoka
shinaoka deleted the refactor/drop-team-section-cost branch October 29, 2026 02:56
shinaoka added a commit that referenced this pull request Oct 29, 2026
…25.2 (#155)

The minor version moves because #97 removed Par::Rayon, Par::rayon,
ParShape::Rayon and ParShape::rayon. CHANGELOG.md lists the changes since
faer-v0.25.2 with the migration: correctness fixes (nonsymmetric EVD
#112/#144/#145, SVD #110/#108, LU ties #105, diagonal products #113, sparse
LU #132, Krylov #133/#134), MaybeUninit matmul (#136), the team route
(#91, #111, #104), threadteam 0.1.3, t4a-private-gemm-x86 0.1.27, MSRV 1.89
and the opt-in x86-v4. t4a-faer-traits 0.24.2 only adds rust-version.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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