Skip to content

v0.7.0

Choose a tag to compare

@shinaoka shinaoka released this 25 Oct 01:42
· 17 commits to main since this release
a439aa4

strided-rs v0.7.0

Breaking: placement is an explicit Exec token

Every entry that can fan out takes a strided_exec::Exec as its last parameter, by value.
The token carries the pool and a budget of slots; the callee splits it (fork, for_ranges,
limit) and never starts a task by any other route. No thread-local placement state exists
any more, so work that runs on a waiting thread cannot inherit another operation's pool or
budget. All workspace crates are released at 0.7.0.

  • strided-exec (new crate). Pool and PoolBuilder (the only place a thread pool is
    started), Exec (serial, new(&pool, budget), budget, is_serial, reborrow, limit,
    fork, for_ranges, broadcast, external), and the Error and Refused types. A token is
    neither Clone nor Copy; slots are conserved across nesting; a serial token, a budget of
    one, or a single task runs inline and never starts the process-global Rayon pool. Without the
    parallel feature the same types exist and every entry runs inline. No Rayon type appears in
    the public API (scripts/check-no-public-rayon.sh).
  • Exec::external. Enters the pool once and hands the budget to an outside library (a BLAS,
    a linear-algebra backend) as a plain width.
  • One function per operation. The *_par permutation copies are merged into copy_into,
    copy_into_uninit and copy_into_col_major. strided-perm uses the budget it is given and
    never chooses a width, and one MINTHREADLENGTH decides when a loop is worth splitting.
  • strided-basic, strided-fused, strided-kernel, strided-nn take Exec;
    strided-basic re-exports Exec, Pool and PoolBuilder, and strided-kernel re-exports
    them from strided-basic. strided-fused and strided-nn use the token through
    strided-basic.
  • Rayon is a dependency of strided-exec only. strided-perm and strided-basic no longer
    depend on it. cargo deny check bans rejects a direct rayon dependency (normal, dev or
    build) anywhere else in the workspace, and bans faer, t4a-faer and spindle.
  • strided-nn 0.7.0 (previously 0.1.1): the fused axis-0 softmax takes caller-provided
    scratch sized by executable tasks (scratch_len) and an Exec.

Migration

0.6 0.7
ExecContext::serial() Exec::serial()
ExecContext::max_threads(n) Exec::new(&pool, n)? with a strided_exec::Pool
ExecContext::run_on(pool, ..) build a Pool once, mint Exec::new(&pool, n)? per call
plan.execute(&ctx, ..) (context first) plan.execute(.., exec) (token last)
with_execution_policy, ExecutionPolicy removed; pass an Exec
with_execution_pool removed; pass an Exec
rayon_threads() exec.budget()
copy_into_par, copy_into_uninit_par, copy_into_col_major_par copy_into, copy_into_uninit, copy_into_col_major with an Exec
ambient (global Rayon pool) placement none; use Exec::serial() or a pool you own
StridedError::InvalidThreadBudget strided_exec::Error::ZeroBudget from Exec::new
MaybeSend, MaybeSync bounds Send + Sync
a direct rayon dependency for placement strided-exec (feature parallel, default)

A phase sequence reuses one token with exec.reborrow(), because every parallel entry consumes
its token. Plans never store an Exec; replay takes it per call.

Design record: docs/design/cpu-exec-placement.md.

Full comparison: v0.5.0...v0.7.0