Skip to main content

themis/
lib.rs

1//! Typed placement law for Atlas memory and runtime crates.
2//!
3//! Themis owns placement vocabulary, not allocation or execution. Mnemosyne
4//! consumes these types to choose memory locality. Moirai consumes these types
5//! to choose worker and task locality.
6
7#![cfg_attr(not(feature = "std"), no_std)]
8#![cfg_attr(nightly_tls_active, feature(thread_local))]
9#![deny(unsafe_op_in_unsafe_fn)]
10#![deny(missing_docs)]
11
12#[cfg(feature = "std")]
13extern crate std;
14
15mod law;
16mod query;
17mod topology;
18
19#[cfg(feature = "melinoe")]
20mod branded;
21
22#[cfg(feature = "melinoe")]
23pub use branded::{
24    sync_region_placement_scope, thread_local_placement_scope, ConstNumaNodePlacement,
25    ConstNumaPinnedCell, ConstNumaPinnedCellRef, ConstNumaPinnedSlice, ConstNumaPinnedSliceRef,
26    ConstPinnedCell, ConstPinnedSlice, ConstThreadLocalNumaPlacement, NumaNodePlacement,
27    NumaPinnedCell, NumaPinnedCellRef, NumaPinnedSlice, NumaPinnedSliceRef, PinnedCell,
28    PinnedSlice, SyncRegionPlacement, ThreadLocalNumaPlacement, ThreadLocalPlacement,
29};
30pub use law::{
31    LocalityDomainId, MemoryTier, NumaBucketIndex, NumaNodeId, PlacementHint, TopologyEpoch,
32    WorkerId,
33};
34pub use query::{
35    current_numa_node, current_processor, refresh_current_numa_node, try_current_numa_node,
36};
37#[cfg(feature = "std")]
38pub use topology::{bind_current_thread, BindError};
39pub use topology::{
40    CacheLevel, CoreId, CpuEfficiencyView, CpuSmtView, CpuTopology, EfficiencyClass,
41    GpuDeviceProperties, GpuTopology, NumaNode, TpuDeviceProperties, TpuTopology,
42};
43#[cfg(windows)]
44pub use topology::{ProcessorAffinityGroups, ProcessorGroupAffinity};
45
46// Test-only re-exports for integration tests (they are `pub` at definition
47// site but live inside a private `mod topology`, so crate-root re-export
48// is required for integration-test access). Gated on `feature = "testing"`
49// (not just `cfg(test)`) because integration tests in `tests/` consume the
50// lib as a regular dependency; `cfg(test)` only activates when the lib itself
51// is the test target, not when it is depended on.
52#[cfg(any(test, feature = "testing"))]
53pub use topology::{
54    build_adjacent_nodes, build_default_distance_row, build_node_to_index, build_processor_to_node,
55};