Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions docs/SETTINGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A number or a word is set like any environment variable, for example `STRATA_KVA
(`terminal/strata-<model>.json`), which the server passes to the engine. The Strata project's Terminal writes it there with
`strata launch --set NAME=value`.

## Switches you can turn on (368)
## Switches you can turn on (370)

Off unless you set them. The last column says where each one is described.

Expand Down Expand Up @@ -177,6 +177,8 @@ Off unless you set them. The last column says where each one is described.
| `STRATA_MEGAKERNEL` | number | NVIDIA and AMD | - |
| `STRATA_MEMORY_LIMIT_MIB` | on / off | NVIDIA and AMD | [DETAILS.md](DETAILS.md) |
| `STRATA_METAL_ARENA_GB` | number | Mac | [MAC.md](MAC.md) |
| `STRATA_METAL_BELL_CHUNK` | number | Mac | - |
| `STRATA_METAL_BELL_FORCE` | on / off | Mac | - |
| `STRATA_METAL_CONTIG` | number | Mac | [MAC.md](MAC.md) |
| `STRATA_METAL_EXP_CACHE_GB` | number | NVIDIA and AMD | - |
| `STRATA_METAL_GYRO_TILES` | on / off | Mac | [MAC.md](MAC.md) |
Expand Down Expand Up @@ -386,7 +388,7 @@ Off unless you set them. The last column says where each one is described.
| `STRATA_WDDM_BUDGET` | number | AMD, Intel Arc | [AMD_HIP.md](AMD_HIP.md) |
| `STRATA_WDDM_MARGIN_MIB` | number | AMD | [AMD_HIP.md](AMD_HIP.md) |

## Switches that go back to earlier behaviour (137)
## Switches that go back to earlier behaviour (138)

These behaviours are on by default. Setting the switch returns the earlier behaviour; the notes in the register say which
version made it the default.
Expand Down Expand Up @@ -441,6 +443,7 @@ version made it the default.
| `STRATA_KEEP_MAPPING` | on / off | NVIDIA and AMD | v0.2.16 | - |
| `STRATA_KV_HOST_DMA` | on / off | NVIDIA and AMD, Intel Arc | v0.2.16 | [TROUBLESHOOTING.md](TROUBLESHOOTING.md), [README.md](bench-results/2026-12-01-community-rx-7900-xtx-flash-next-ista-mtp/README.md), [README.md](bench-results/2026-12-05-community-rx-7900-xtx-flash-next-coder-uncensored-mtp/README.md) |
| `STRATA_MEM_CREDIT_INACTIVE` | text | NVIDIA and AMD | v0.2.16 | - |
| `STRATA_METAL_BELL` | on / off | Mac | - | - |
| `STRATA_METAL_ICB` | on / off | Mac | - | - |
| `STRATA_METAL_LDB` | on / off | Mac | v0.2.16 | - |
| `STRATA_METAL_MTP_OVERLAP` | on / off | Mac | v0.2.16 | - |
Expand Down Expand Up @@ -473,7 +476,7 @@ version made it the default.
| `STRATA_PF_XMX` | text | Intel Arc | v0.2.16 | [INTEL.md](INTEL.md), [release-notes-0.2.0.md](release-notes-0.2.0.md) |
| `STRATA_PIPELINE_ADAPT_ASYNC` | number | NVIDIA and AMD | v0.2.16 | - |
| `STRATA_PLE_AUTO_MMAP` | number | NVIDIA and AMD, Intel Arc | v0.2.16 | [DETAILS.md](DETAILS.md) |
| `STRATA_POLY_BELL` | on / off | NVIDIA and AMD | - | [inkling.md](models/inkling.md) |
| `STRATA_POLY_BELL` | on / off | NVIDIA and AMD, Mac | - | [inkling.md](models/inkling.md) |
| `STRATA_POLY_EXPERT_TILES` | on / off | NVIDIA and AMD | - | [inkling.md](models/inkling.md) |
| `STRATA_POLY_HIP_GROUPED` | on / off | NVIDIA and AMD | - | - |
| `STRATA_POLY_MIRROR_LENT` | on / off | NVIDIA | - | [inkling.md](models/inkling.md) |
Expand Down
32 changes: 32 additions & 0 deletions engine/include/strata/poly/kernels.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,38 @@ void bell_add_defer(const ExpertBell* bell, uint32_t* seq, const float* hy_imm,
const float* hy_def0, const float* hy_def1, float* def_acc, int n, void* stream);
/// Pokes bell->ack = seq from a CUDA/HIP stream after its preceding D2H writes are visible to the peer.
void bell_ack(ExpertBell* bell, uint32_t seq, void* stream);
#if defined(STRATA_GPU_METAL)
constexpr int kMetalBellMaxJobs = 128;
constexpr int kMetalBellMaxRows = 16;
/// One MoE layer's shared-memory doorbell slot on Metal (unified memory, synchronized via MTLSharedEvent).
/// Job arrays are partitioned into [0 .. n_jobs) immediate CPU jobs and [n_jobs .. n_jobs + defer_n_jobs) deferred
/// CPU jobs (computed after signaling the current layer done and merged at the next MoE layer).
struct MetalBellSlot {
int32_t il;
int32_t n;
int32_t n_used;
int32_t n_jobs;
int32_t defer_n_jobs;
int32_t tail_skipped;
int32_t has_cpu;
int32_t has_def_cpu;
int32_t all_ids[kMetalBellMaxJobs];
int32_t job_row[kMetalBellMaxJobs];
int32_t job_e[kMetalBellMaxJobs];
int32_t job_k[kMetalBellMaxJobs];
float job_w[kMetalBellMaxJobs];
};
/// Scans n * n_used picks against `table` (device pointers, null = miss), writes `bell_ids` (-1 for misses/skips),
/// populates `slot` (partitioning surviving misses into immediate [0..n_jobs) and deferred [n_jobs..n_jobs+defer_n_jobs)
/// when 0 <= defer_from < n_used), and copies `xn` into `bell_x` when n_jobs + defer_n_jobs > 0.
void metal_bell_ring(const void* const* table, const int32_t* ids, const float* wts, const float* xn,
int32_t* bell_ids, MetalBellSlot* slot, float* bell_x, int il, int n, int n_used, int n_embd,
int tail_skip, float skip_weight, int route_top, void* stream, int defer_from = -1);
/// Adds `bell_cpu` into `fo` (total_floats floats) when slot->has_cpu != 0, and optionally adds
/// `prev_bell_cpu_def` into `fo` when prev_slot != nullptr && prev_slot->has_def_cpu != 0.
void metal_bell_add(const MetalBellSlot* slot, const float* bell_cpu, float* fo, int total_floats, void* stream,
const MetalBellSlot* prev_slot = nullptr, const float* prev_bell_cpu_def = nullptr);
#endif
/// copy2() with a third run. CUDA and HIP only.
void copy3(const void* x0, void* y0, int n0, const void* x1, void* y1, int n1, const void* x2, void* y2, int n2,
void* stream);
Expand Down
7 changes: 7 additions & 0 deletions engine/metal/include/strata/gpu/metal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ void set_optimize(bool enabled);
bool optimize();
/// Submit pending commands without a host wait; graph capture records the boundary.
Error submit(Stream s);
/// MTLSharedEvent doorbell primitives for partial-VRAM decode (graph-recordable signal/wait).
uint64_t bell_begin_pass(Stream s, uint64_t n_slots);
Error bell_record_signal(Stream s, uint64_t rel_offset);
Error bell_record_wait(Stream s, uint64_t rel_offset);
bool bell_wait_host(Stream s, uint64_t want, uint64_t timeout_ms);
void bell_signal_host(Stream s, uint64_t val);
void bell_unwind_host(Stream s, uint64_t target_val);
/// Dispatches between parallel_begin() and parallel_end() have no data dependencies on each other and may run
/// concurrently without intervening memory barriers (recorded by graph capture).
Error parallel_begin(Stream s);
Expand Down
Loading
Loading