Skip to main content

Crate flynnel

Crate flynnel 

Source
Expand description

§Flynnel

A K-aware, NUMA-aware work-stealing scheduler with extended-Flynn- taxonomy dispatch. Pun-named for Michael J. Flynn (1934-), whose 1966 taxonomy of computer architectures (SISD / SIMD / MISD / MIMD) underlies the per-call execution-class plan this crate exposes.

§Extended Flynn taxonomy

AcronymExpansionFlynnel axis
SISDSingle Instruction, Single Datainline execution
SIMDSingle Instruction, Multiple Datavector lanes (in-kernel)
MISDMultiple Instruction, Single Datarace_variants (first tolerable wins)
MIMDMultiple Instruction, Multiple Datajoin; explore_select (all finish, best-by-comparator)
SIMCSingle Instruction, Multiple Corescooperative_join_n (cross-core SIMD)
MIMCMultiple Instruction, Multiple Coresheterogeneous roles within MIMC
SIMTSingle Instruction, Multiple ThreadsDispatchBackend::dispatch_kernel on a registered accelerator; auto-routed via dispatch_accel
MIMTMultiple Instruction, Multiple Threadsjoin_hybrid / hybrid_pipeline (CPU + accelerator)

§Quick start

use flynnel::{JobPlan, DispatchProfile, join};

let plan = JobPlan::set_profile(8, 1024, DispatchProfile::PortBound);
let (a, b) = join(
    &plan,
    || (0..1024).sum::<u32>(),
    || (1024..2048).sum::<u32>(),
);
assert_eq!(a + b, (0..2048).sum::<u32>());

The workhorse primitives (join, for_each_chunk, for_each_indexed, for_each_chunk_ref, cooperative_join_n, join_hybrid, hybrid_pipeline, race_variants, CancelToken, k_join, k_join_with_plan, JobPlan) are re-exported at the crate root following the rayon / tokio convention: short top-level path for the things you call constantly. Specialized variants stay namespaced under sched where they live.

References: rayon-core 1.13 (JobRef vtable, CoreLatch, JEC sleep), ARCAS arXiv:2503.11460 (chiplet-aware scheduling; see crate::numa_topology::NumaTopology::cluster_size_log2), Libfork arXiv:2402.18480 (continuation stealing), Olivier-Prins ROSS ’11 (leader-driven cross-NUMA stealing), arXiv:2401.04494 (last-successful-victim-first steal probing), arXiv:2009.00202 (prefetching stolen job state into L2 on steal).

Re-exports§

pub use backend::Backend;
pub use backend::BackendCapabilities;
pub use backend::BackendError;
pub use backend::BackendRef;
pub use backend::DispatchBackend;
pub use backend::KernelArg;
pub use backend::KernelHandle;
pub use backend::backend_by_id;
pub use backend::backends;
pub use backend::cpu_backend;
pub use backend::register_backend;
pub use backend::accel_op::AccelOpId;
pub use backend::accel_op::AccelReport;
pub use backend::accel_op::RegisteredAccelOp;
pub use backend::accel_op::accel_op_name;
pub use backend::accel_op::accel_target;
pub use backend::accel_op::bind_accel_kernel;
pub use backend::accel_op::bind_accel_kernel_handle;
pub use backend::accel_op::dispatch_accel;
pub use backend::accel_op::register_accel_op;
pub use backend::accel_op::registered_accel_ops;
pub use dispatch_profile::DispatchProfile;
pub use foundation::HwClass;
pub use foundation::SchedTier;
pub use foundation::Variant;
pub use numa_topology::NumaSource;
pub use numa_topology::NumaTopology;
pub use numa_topology::numa_topology;
pub use op_class::OpClass;
pub use sched::adaptive_profile::LeafShape;
pub use sched::adaptive_profile::WorkloadClass;
pub use sched::BisectVariant;
pub use sched::JobPlan;
pub use sched::arena::join;
pub use sched::arena::join_context;
pub use sched::arena::join_default;
pub use sched::cooperative::cooperative_join_n;
pub use sched::call_site::CallSiteState;
pub use sched::call_site::Placement;
pub use sched::call_site::RegisteredKeyedSite;
pub use sched::call_site::RegisteredSite;
pub use sched::call_site::SiteRef;
pub use sched::call_site::caller_site;
pub use sched::call_site::registered_keyed_sites;
pub use sched::call_site::registered_sites;
pub use sched::call_site::reset_all_sites;
pub use sched::call_site::site_for_key;
pub use sched::call_site::site_for_location;
pub use sched::cat::CatCapability;
pub use sched::cat::CatError;
pub use sched::cat::L3Reservation;
pub use sched::reset_spin_stats;
pub use sched::set_spin_adaptive;
pub use sched::set_spin_window;
pub use sched::spin_adapt_decisions;
pub use sched::spin_window;
pub use sched::total_backend_monitor_arms;
pub use sched::total_backend_monitor_waits;
pub use sched::total_idle_yields;
pub use sched::total_join_parks;
pub use sched::total_latch_monitor_arms;
pub use sched::total_latch_monitor_waits;
pub use sched::total_long_yields;
pub use sched::total_monitor_rounds;
pub use sched::total_park_events;
pub use sched::total_rescue_events;
pub use sched::total_self_rescues;
pub use sched::total_sleepless_backoffs;
pub use sched::yield_histogram;
pub use sched::hybrid::SplitReport;
pub use sched::hybrid::hybrid_auto;
pub use sched::hybrid::hybrid_auto_split;
pub use sched::hybrid::hybrid_auto_split_ranges;
pub use sched::hybrid::hybrid_pipeline;
pub use sched::hybrid::join_hybrid;
pub use sched::k_join::k_join;
pub use sched::k_join::k_join_with_plan;
pub use sched::par_iter::for_each_chunk;
pub use sched::par_iter::for_each_chunk_ref;
pub use sched::par_iter::for_each_indexed;
pub use sched::race::Agreement;
pub use sched::race::Anytime;
pub use sched::race::CancelToken;
pub use sched::race::Settled;
pub use sched::race::StatOpts;
pub use sched::race::StatOutcome;
pub use sched::race::explore_select;
pub use sched::race::race_agree;
pub use sched::race::race_any;
pub use sched::race::race_deadline;
pub use sched::race::race_quorum;
pub use sched::race::race_refute;
pub use sched::race::race_statistical;
pub use sched::race::race_tournament;
pub use sched::race::race_variants;
pub use sched::marshal::Marshal;
pub use sched::marshal::register_marshal_handler;

Modules§

backend
Backend dispatch fabric: extends Flynnel from CPU-only work-stealing into a generic dispatcher that can route work to GPUs (CUDA / ROCm / Metal), TPUs (Google / Coral / Apple Neural Engine), or any other accelerator class.
cpu_info
CPU topology hints: physical-core count + SMT factor.
dispatch_profile
DispatchProfile: scheduler-native classification of work for per-dispatch tuning.
flat
Plan-free rayon-shaped surface.
foundation
Foundation enums: Variant, SchedTier, HwClass.
gpu_peer
GPU-peer substrate: the GPU joins the scheduler as a shared-memory peer over a CUDA-registered memory-mapped file.
kernels
The declared kernels as plain Rust: each kernel’s partition, its per-block work and its combine, with no pool behind any of it.
notice
Where the library’s notes go.
numa_topology
NUMA topology probe: per-CPU node membership + node-to-node distance matrix.
op_class
Domain-agnostic operation classification.
sched
Flynnel K-aware NUMA-aware unified scheduler.