Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
655b014
gpu: support six-slot F32 tier handoff
Burntgogi Oct 24, 2026
55df14a
gpu: support ordinary IQ4_XS shared sites
Burntgogi Oct 24, 2026
a4f3919
gpu: size mixed expert scratch from selected resident forms
Burntgogi Oct 24, 2026
79a2959
gpu: name the new six-slot tier primitive generically
Burntgogi Oct 24, 2026
a6beeac
placement: test overflow refusal without pinning panic wording
Burntgogi Oct 24, 2026
2824f4f
gpu: preserve fixed reserves for host-only node projections
Burntgogi Oct 24, 2026
2f2a887
gpu: use fixed-size rows in the IQ4 consumer gate
Burntgogi Oct 24, 2026
b3a2380
gpu: remove redundant wrapper test allocation and borrow
Burntgogi Oct 24, 2026
d19c568
gpu: support ordinary IQ4_XS shared sites
Burntgogi Oct 24, 2026
9749739
gpu: use fixed-size rows in the IQ4 consumer gate
Burntgogi Oct 24, 2026
dcb1e3a
gpu: size mixed expert scratch from selected resident forms
Burntgogi Oct 24, 2026
c592a64
placement: test overflow refusal without pinning panic wording
Burntgogi Oct 24, 2026
7f75867
gpu: preserve fixed reserves for host-only node projections
Burntgogi Oct 24, 2026
9b833fb
gpu: remove redundant wrapper test allocation and borrow
Burntgogi Oct 24, 2026
8f2de9a
gpu: support six-slot F32 tier handoff
Burntgogi Oct 24, 2026
2b8c87c
gpu: name the new six-slot tier primitive generically
Burntgogi Oct 24, 2026
49110c8
gpu: implement the common optional-bias 256/top6 floor router
Burntgogi Oct 24, 2026
1c9432b
gpu: complete current-main selected tier prerequisite cutover
Burntgogi Oct 24, 2026
e28830d
feat(flint): attach floor router, ring attention and hosted runtime
Burntgogi Oct 24, 2026
f71e889
test(flint): align mixed expert fixtures with current model description
Burntgogi Oct 24, 2026
7cb8f03
test(flint): fix expert norm flag and record real-weight CPU consumers
Burntgogi Oct 24, 2026
313b9f0
fix(flint): include shared HTTP seat in published integration
Burntgogi Oct 24, 2026
ebce5ba
test(gpu): pin measured Flint cc8.6 resources
Burntgogi Oct 25, 2026
f17cf1b
gpu: support ordinary IQ4_XS shared sites
Burntgogi Oct 24, 2026
614ff91
gpu: use fixed-size rows in the IQ4 consumer gate
Burntgogi Oct 24, 2026
aa8e1b8
gpu: size mixed expert scratch from selected resident forms
Burntgogi Oct 24, 2026
a65d1d8
placement: test overflow refusal without pinning panic wording
Burntgogi Oct 24, 2026
d767e0b
gpu: preserve fixed reserves for host-only node projections
Burntgogi Oct 24, 2026
9da54fb
gpu: remove redundant wrapper test allocation and borrow
Burntgogi Oct 24, 2026
45a6b4a
gpu: support six-slot F32 tier handoff
Burntgogi Oct 24, 2026
61318d0
gpu: name the new six-slot tier primitive generically
Burntgogi Oct 24, 2026
6c2eaf8
gpu: implement the common optional-bias 256/top6 floor router
Burntgogi Oct 24, 2026
781370e
gpu: complete current-main selected tier prerequisite cutover
Burntgogi Oct 24, 2026
c443e8d
feat(flint): attach floor router, ring attention and hosted runtime
Burntgogi Oct 24, 2026
39c1a78
test(flint): align mixed expert fixtures with current model description
Burntgogi Oct 24, 2026
2802c49
test(flint): fix expert norm flag and record real-weight CPU consumers
Burntgogi Oct 24, 2026
2ea4203
fix(flint): include shared HTTP seat in published integration
Burntgogi Oct 24, 2026
fb2c73d
test(gpu): pin measured Flint cc8.6 resources
Burntgogi Oct 25, 2026
c691a90
test(flint): capture forced trajectories and cover real two-card cons…
Burntgogi Oct 25, 2026
d3d5ceb
docs(flint): bind rebased candidate and instrumentation controls
Burntgogi Oct 26, 2026
412e5b3
test(gpu): load mixed expert fixtures through placed rows
Burntgogi Oct 26, 2026
89378a8
fix(flint): match HTTP diagnostic boundary and selected fixture formats
Burntgogi Oct 26, 2026
d6c3727
test(gpu): remove obsolete Solar2 Q6_K rejection
Burntgogi Oct 26, 2026
9bfa55a
Merge current main into six-slot tier handoff; preserve four-slot dis…
Burntgogi Oct 26, 2026
a22aab8
Merge upstream main into ordinary IQ4_XS shared-site contribution
Burntgogi Oct 26, 2026
e683887
Merge upstream main into mixed expert scratch contribution
Burntgogi Oct 26, 2026
fead3aa
Merge validated Flint diagnostic and fixture candidate into existing …
Burntgogi Oct 26, 2026
ee7512f
Merge fixed upstream main into existing Flint integration history
Burntgogi Oct 26, 2026
a0e1e90
Reconcile selected scratch test contracts and format migrated callers
Burntgogi Oct 26, 2026
29a29b1
Format the combined tier handoff guard
Burntgogi Oct 26, 2026
203f512
Keep IQ4 regression checks behavioral and format the merged sites
Burntgogi Oct 26, 2026
efe6c7b
Complete the mixed fixture description and remove superseded reserve …
Burntgogi Oct 26, 2026
dc5b013
Merge selected expert PR while preserving Flint scale accounting and …
Burntgogi Oct 26, 2026
4047c8c
Merge final mixed-wrapper description and selected-reserve regression…
Burntgogi Oct 26, 2026
0f620a4
Merge IQ4 shared-site PR with current layout and wide scratch contracts
Burntgogi Oct 26, 2026
3071a9f
Drop imports made obsolete by selected reserve regression cutover
Burntgogi Oct 26, 2026
02d492a
Merge six-slot PR and preserve the four-six-eight consumption gate
Burntgogi Oct 26, 2026
d144eac
Merge final mixed-scratch import cleanup
Burntgogi Oct 26, 2026
efd97b4
Reconcile final Flint selected reserve APIs and measured unsafe census
Burntgogi Oct 26, 2026
2b0724e
Remove merge-duplicated accounting and restore fixed-form scratch cal…
Burntgogi Oct 26, 2026
adcfaf5
Complete fixed tier descriptor migration in model and frontend consumers
Burntgogi Oct 26, 2026
dd7253b
Reconcile quantized leg protection with current input contracts
Burntgogi Oct 26, 2026
b9b6e01
Use common F32 tier handoff error context
Burntgogi Oct 26, 2026
160efbe
Finish current-main fixed-reserve caller migration
Burntgogi Oct 26, 2026
cb77a47
Iterate planted router factors without indexed lint debt
Burntgogi Oct 26, 2026
c26025b
Select actual Q8Act tier scratch also for empty tiers
Burntgogi Oct 26, 2026
f11d5b1
Pin measured six-slot handoff resources on cc8.6
Burntgogi Oct 26, 2026
ff54af2
Record closure cutover and measured head decomposition
Burntgogi Oct 26, 2026
c67b54e
Merge reviewed selected-tier reserve repair from PR783
Burntgogi Oct 26, 2026
96b7040
Merge measured PR781 handoff pin and common diagnostics
Burntgogi Oct 26, 2026
082cf7f
Retain tier activation fixture helper across integration
Burntgogi Oct 26, 2026
4d841c9
Record repaired empty-tier consumer hardware proof
Burntgogi Oct 26, 2026
0b055bb
Document source-specific ordinary IQ4 hardware proof
Burntgogi Oct 26, 2026
b29cf26
Merge PR782 source-specific proof documentation
Burntgogi Oct 26, 2026
da8863e
Merge PR783 repaired consumer proof documentation
Burntgogi Oct 26, 2026
76f4b12
Unify selected tier accounting and checked reserve contracts
Burntgogi Oct 26, 2026
5bee298
Bound Solar reserve regression from a host-only reference plan
Burntgogi Oct 26, 2026
5c1c67a
Preserve IQ4 pin provenance and meaningful refusal diagnostics
Burntgogi Oct 26, 2026
a3206fe
Use one resident sequence for the Solar reference budget
Burntgogi Oct 26, 2026
6ecd144
Exclude reusable granule padding from the no-expert-room boundary
Burntgogi Oct 26, 2026
f3b2a21
Use the nonzero byte-granule constant in the reserve fixture
Burntgogi Oct 26, 2026
7e37ef9
Document the exact-granule reserve boundary
Burntgogi Oct 26, 2026
d1cf1c4
Merge checked selected-tier review repairs into Flint runtime
Burntgogi Oct 26, 2026
c5b3b94
Merge IQ4 refusal diagnostics and pin provenance
Burntgogi Oct 26, 2026
1239144
Keep handoff measurements durable and move operational receipts out o…
Burntgogi Oct 26, 2026
420131b
Integrate checked tier contracts with Flint scale ownership
Burntgogi Oct 26, 2026
ab7f126
Merge durable six-slot handoff measurement record
Burntgogi Oct 26, 2026
981c6d4
Merge upstream cb8d92eb for current FlInt integration compatibility
Burntgogi Oct 27, 2026
a1660b9
Format merged file-site imports
Burntgogi Oct 27, 2026
49b11b3
Reconcile projected-site IQ4 admission with current main
Burntgogi Oct 27, 2026
cf035b8
Document exact-source mixed-tier review consumers
Burntgogi Oct 27, 2026
b91137e
Merge exact-source mixed-tier consumer evidence
Burntgogi Oct 27, 2026
c38d603
Merge pinned upstream into mixed-tier component
Burntgogi Oct 27, 2026
c34ea82
Merge commit 'cb8d92ebddd1ce1a325a15450c06a01f57ecf88c' into contrib/…
Burntgogi Oct 27, 2026
7a7cfdc
Exercise IQ4 projected admission through typed site fixture
Burntgogi Oct 27, 2026
47c51a1
Merge current-main IQ4 projected consumer reconciliation
Burntgogi Oct 27, 2026
e82dd9a
Merge current-main checked tier contract reconciliation
Burntgogi Oct 27, 2026
b0fc05e
Keep projected-file admission coverage without metadata-copy guard
Burntgogi Oct 27, 2026
f086dc9
Merge projected-file admission regression cleanup
Burntgogi Oct 27, 2026
6a46aa1
Document projected-file execution and remove obsolete test import
Burntgogi Oct 27, 2026
b4b2844
Merge observed projected-file proof and test import cleanup
Burntgogi Oct 27, 2026
72d0059
Merge formatted site test imports
Burntgogi Oct 27, 2026
3bd0c04
Format the cleaned site test imports
Burntgogi Oct 27, 2026
fd2a64b
Document current-main dense-header consumer execution
Burntgogi Oct 27, 2026
f5ffbf3
Merge current-main frontend execution evidence
Burntgogi Oct 27, 2026
923da64
Include FlInt in the current-main llama serve build recipe
Burntgogi Oct 27, 2026
a35ddd0
Document the shared serve recipe feature contract
Burntgogi Oct 27, 2026
55f07ce
Merge pinned upstream 95a483fc to resolve actual serve integration co…
Burntgogi Oct 27, 2026
5abe1ae
Merge pinned upstream 95a483fc split block compatibility
Burntgogi Oct 27, 2026
2635886
Merge IQ4 split scratch compatibility with upstream 95a483fc
Burntgogi Oct 27, 2026
cd03428
Document upstream split scratch compatibility and host proof
Burntgogi Oct 27, 2026
fbf77f7
Merge split scratch compatibility evidence
Burntgogi Oct 27, 2026
462213c
Fix Qwen tier descriptor down-form bounds
Burntgogi Oct 27, 2026
8aae54c
Merge commit '462213ca' into contrib/bloomery-flint-next-z8w6lglu
Burntgogi Oct 27, 2026
695018d
Keep Qwen tier input scales disabled in integrated descriptor
Burntgogi Oct 27, 2026
c143c98
Merge pinned upstream 0df4076e for Q5_0 dispatch compatibility
Burntgogi Oct 27, 2026
182012b
Merge commit 'c143c98d' into contrib/bloomery-flint-next-z8w6lglu
Burntgogi Oct 27, 2026
3ba6e7c
Merge remote-tracking branch 'origin/main' into land783
midagedev Oct 27, 2026
800700d
placement: a tier card with no leg descriptor keeps its reserve; the …
midagedev Oct 27, 2026
9e7ab5a
Merge main into selected mixed expert scratch
Burntgogi Oct 27, 2026
f7b06be
Merge main into #799: Flint's cc12.1 rows pinned at cc8.6, the host n…
midagedev Oct 27, 2026
fdec20e
Merge remote-tracking branch 'origin/main' into land783
midagedev Oct 27, 2026
338ee5d
Merge branch 'contrib/flint-mixed-legs-kid28n7y' of https://github.co…
midagedev Oct 27, 2026
a9969db
Merge branch 'land783' into land799
midagedev Oct 27, 2026
35f9c80
Merge remote-tracking branch 'origin/main' into land799
midagedev Oct 27, 2026
49f096d
card_experts: restore the leg buffers' card_downs test; the documente…
midagedev Oct 27, 2026
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
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "3"
members = ["crates/qdot", "crates/gguf", "crates/models", "crates/model", "crates/model-hf", "crates/placement", "crates/threads", "crates/levers", "crates/verbs", "crates/gpu", "crates/gpu-deepseek41", "crates/gpu-glm5next", "crates/gpu-mimo2", "crates/gpu-solar2", "crates/gpu-minimaxm3", "crates/gpu-gemma-embedding2", "crates/gpu-gates", "crates/engram", "crates/engram-lab", "crates/sampler", "crates/tokenizer", "crates/serve", "crates/jinja", "crates/vision", "crates/gpu-vision", "crates/gpu-gemma4a", "crates/refset", "crates/runtime", "crates/app", "crates/decision", "crates/embed", "crates/hf", "crates/safetensors", "crates/os", "crates/device", "crates/metal", "crates/record", "crates/chain"]
members = ["crates/qdot", "crates/gguf", "crates/models", "crates/model", "crates/model-hf", "crates/placement", "crates/threads", "crates/levers", "crates/verbs", "crates/gpu", "crates/gpu-deepseek41", "crates/gpu-glm5next", "crates/gpu-mimo2", "crates/gpu-solar2", "crates/gpu-minimaxm3", "crates/gpu-flint", "crates/gpu-gemma-embedding2", "crates/gpu-gates", "crates/engram", "crates/engram-lab", "crates/sampler", "crates/tokenizer", "crates/serve", "crates/jinja", "crates/vision", "crates/gpu-vision", "crates/gpu-gemma4a", "crates/refset", "crates/runtime", "crates/app", "crates/decision", "crates/embed", "crates/hf", "crates/safetensors", "crates/os", "crates/device", "crates/metal", "crates/record", "crates/chain"]
# 의도적으로 컴파일되지 않는 재현기다(MUL-7). 워크스페이스에 넣으면 --workspace가 영구히 빨갛다.
exclude = ["crates/oxide-ice-unroll", "crates/oxide-ice-unroll/variants/unroll_smoke", "fuzz", "labs/hip-native"]

Expand Down
2 changes: 2 additions & 0 deletions crates/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ bloomery-gpu-mimo2 = { path = "../gpu-mimo2", optional = true }
bloomery-gpu-minimaxm3 = { path = "../gpu-minimaxm3", optional = true }
# The Solar-Open2 session (`arch::solar2`).
bloomery-gpu-solar2 = { path = "../gpu-solar2", optional = true }
bloomery-gpu-flint = { path = "../gpu-flint", optional = true }
# The levers the sessions' own configurations carry (the plan's card budget, the host set's load
# settings). The crate has no dependency of its own, so every session reads it.
bloomery-levers = { path = "../levers" }
Expand All @@ -41,3 +42,4 @@ glm5next = ["dep:bloomery-gpu-glm5next"]
mimo2 = ["dep:bloomery-gpu-mimo2"]
minimaxm3 = ["dep:bloomery-gpu-minimaxm3"]
solar2 = ["dep:bloomery-gpu-solar2"]
flint = ["dep:bloomery-gpu-flint"]
76 changes: 76 additions & 0 deletions crates/app/src/arch/flint.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//! Flint's session over its actual attention-ring body and common hybrid planner.

use std::num::NonZeroUsize;

use bloomery_gpu::head::Head;
use bloomery_gpu::host::swap::Residency;
use bloomery_gpu::weights::Weights;
use bloomery_gpu::{Gpu, GpuError, GpuModel};
use bloomery_gpu_flint::Body;
use bloomery_levers::HostCfg;
use gguf::Split;
use model::arch::flint::place::PlanInputs;
use model::placement::Plan;

use super::{Batch, ResidentSequences};

const WHAT: &str = "flint session";

/// A Flint session, with resident slots backed by the body's own stores.
pub type FlintSession = crate::Session<Body>;

impl Batch for Body {
type Inputs = PlanInputs;
type Sequences = ResidentSequences;

const WHAT: &'static str = self::WHAT;

fn read(file: &Split) -> Result<PlanInputs, GpuError> {
PlanInputs::read(file).map_err(|e| GpuError::plan(WHAT, e))
}

fn configure(inputs: &mut PlanInputs, cfg: &super::HybridCfg) -> Result<(), GpuError> {
model::arch::flint::place::configure_group(inputs, cfg.group)
.map_err(|e| GpuError::plan(WHAT, e))
}

fn open_placed(
file: Split,
plan: &Plan<'_>,
inputs: &PlanInputs,
host: HostCfg,
residency: Residency,
slots: NonZeroUsize,
) -> Result<GpuModel<Body>, GpuError> {
Body::open_placed_slots(file, plan, inputs, 0, host, residency, slots)
}

fn batch(
gpu: &Gpu,
w: &Weights,
body: &mut Body,
head: &mut Head,
ids: &[u32],
at: u32,
) -> Result<bool, GpuError> {
bloomery_gpu_flint::prefill::prefill(gpu, w, body, head, ids, at)
}

fn group(m: &mut GpuModel<Body>, g: usize) -> Result<bool, GpuError> {
bloomery_gpu_flint::set_prefill_group(m, g)
}

fn keepable(m: &GpuModel<Body>, n: u32) -> u32 {
m.body(WHAT)
.map_or(0, |b| b.keepable_at(m.pos(), n.min(m.pos())))
}

fn cut(m: &mut GpuModel<Body>, n: u32) -> Result<(), GpuError> {
if n == 0 {
return m.reset();
}
let pos = m.pos();
m.body_parts(WHAT)?.2.stand_for_cut(pos);
m.rollback(n)
}
}
8 changes: 5 additions & 3 deletions crates/app/src/arch/minimaxm3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
//! every layer's key and value rows at those positions, every sparse layer's
//! index keys, and the last position's logits. Every store is a plane of
//! positions a later position never reads before it writes, so a cut keeps
//! every held position. This session holds one sequence; the serve seat parks
//! more ([`bloomery_gpu_minimaxm3`]'s `Slots`).
//! every held position. The plan counts the configured resident sequences;
//! [`crate::Session::add_slots`] parks them through the body's actual `Slots`.
//!
//! The session's shape is the common owner's ([`super::Batch`]): what the
//! placement plans, how the prompt runs and how a cut is kept are shared with
Expand All @@ -37,6 +37,7 @@ const WHAT: &str = "minimaxm3 session";

impl Batch for Body {
type Inputs = PlanInputs;
type Sequences = super::ResidentSequences;

const WHAT: &'static str = self::WHAT;

Expand All @@ -52,8 +53,9 @@ impl Batch for Body {
inputs: &PlanInputs,
host: HostCfg,
residency: Residency,
slots: NonZeroUsize,
) -> Result<GpuModel<Body>, GpuError> {
Body::open_placed_slots(file, plan, inputs, 0, host, residency, NonZeroUsize::MIN)
Body::open_placed_slots(file, plan, inputs, 0, host, residency, slots)
}

fn batch(
Expand Down
106 changes: 102 additions & 4 deletions crates/app/src/arch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
//! and the cut rule — and [`Batch`] holds the rest: the [`Open`] the placement
//! plans by, the [`Prompt`] the batch runs and the [`Keep`] the cut follows.

use std::num::NonZeroUsize;

use bloomery_gpu::head::Head;
use bloomery_gpu::host::served::prompt_pass;
use bloomery_gpu::host::swap::Residency;
use bloomery_gpu::model::{ChainBody, Rollback};
use bloomery_gpu::model::{ChainBody, Rollback, Slots};
use bloomery_gpu::weights::Weights;
use bloomery_gpu::{Gpu, GpuError, GpuModel};
use bloomery_levers::HostCfg;
Expand All @@ -24,6 +26,8 @@ use crate::{Keep, Open, Prompt};

#[cfg(feature = "deepseek41")]
pub mod deepseek41;
#[cfg(feature = "flint")]
pub mod flint;
#[cfg(feature = "glm5next")]
pub mod glm5next;
#[cfg(feature = "mimo2")]
Expand Down Expand Up @@ -56,6 +60,8 @@ pub struct HybridCfg {
pub residency: Residency,
/// The batches a prompt group runs layer by layer.
pub group: usize,
/// The resident sequences charged by the plan before any allocation.
pub slots: NonZeroUsize,
}

/// The plan inputs of a hybrid body: the family's own hyperparameters under
Expand All @@ -71,6 +77,7 @@ pub trait HybridInputs {
machine: &'a Machine,
ctx: u64,
levers: &PlanLevers,
slots: NonZeroUsize,
what: &'static str,
) -> Result<Plan<'a>, GpuError>;
}
Expand All @@ -85,9 +92,11 @@ impl<H> HybridInputs for PlanInputs<H> {
machine: &'a Machine,
ctx: u64,
levers: &PlanLevers,
slots: NonZeroUsize,
what: &'static str,
) -> Result<Plan<'a>, GpuError> {
PlanInputs::plan(self, machine, ctx, levers).map_err(|e| GpuError::plan(what, e))
self.plan_with_slots(machine, ctx, levers, slots)
.map_err(|e| GpuError::plan(what, e))
}
}

Expand All @@ -98,13 +107,20 @@ impl<H> HybridInputs for PlanInputs<H> {
pub trait Batch: ChainBody + Rollback + Sized {
/// The plan inputs the body is loaded by.
type Inputs: HybridInputs;
/// The sequence capability the body actually implements.
type Sequences: SequenceSlots<Self>;

/// The session's name in its refusals.
const WHAT: &'static str;

/// The plan inputs of `file`.
fn read(file: &Split) -> Result<Self::Inputs, GpuError>;

/// Price configuration-dependent buffers before placement; unchanged for a fixed schedule.
fn configure(_inputs: &mut Self::Inputs, _cfg: &HybridCfg) -> Result<(), GpuError> {
Ok(())
}

/// The body resident by `plan`, which `inputs` made: the layers the plan
/// puts on the card, the host tier over the routed ones.
fn open_placed(
Expand All @@ -113,6 +129,7 @@ pub trait Batch: ChainBody + Rollback + Sized {
inputs: &Self::Inputs,
host: HostCfg,
residency: Residency,
slots: NonZeroUsize,
) -> Result<GpuModel<Self>, GpuError>;

/// The prompt batch of `ids` from `at`: the head's row after the last.
Expand Down Expand Up @@ -154,6 +171,10 @@ impl<B: Batch> Open for B {
B::read(file)
}

fn configure_inputs(inputs: &mut B::Inputs, cfg: &HybridCfg) -> Result<(), GpuError> {
B::configure(inputs, cfg)
}

fn layer_count(inputs: &B::Inputs) -> usize {
inputs.layers()
}
Expand All @@ -169,8 +190,9 @@ impl<B: Batch> Open for B {
ctx: usize,
cfg: &HybridCfg,
) -> Result<Plan<'a>, GpuError> {
<B::Sequences as SequenceSlots<B>>::check(cfg.slots, B::WHAT)?;
let ctx = one_card_ctx(B::WHAT, machine, ctx)?;
inputs.plan_at(machine, ctx, &cfg.place, B::WHAT)
inputs.plan_at(machine, ctx, &cfg.place, cfg.slots, B::WHAT)
}

fn open(
Expand All @@ -179,7 +201,8 @@ impl<B: Batch> Open for B {
plan: &Plan<'_>,
cfg: &HybridCfg,
) -> Result<GpuModel<B>, GpuError> {
B::open_placed(file, plan, inputs, cfg.host, cfg.residency)
<B::Sequences as SequenceSlots<B>>::check(cfg.slots, B::WHAT)?;
B::open_placed(file, plan, inputs, cfg.host, cfg.residency, cfg.slots)
}

/// The configuration's group; the units it needs are made here.
Expand Down Expand Up @@ -222,6 +245,81 @@ impl<B: Batch> Keep for B {
}
}

/// The sequence operations a common hybrid seat may offer.
pub trait SequenceSlots<B: ChainBody> {
/// Whether several resident sequences are backed by body-owned stores.
const RESIDENT: bool;
/// Refuse an unsupported count before planning or allocation.
fn check(slots: NonZeroUsize, what: &'static str) -> Result<(), GpuError>;
/// Park the planned sequences through the session's actual slot operations.
fn add(s: &mut crate::Session<B>, slots: NonZeroUsize) -> Result<(), crate::SessionError>;
/// The number of resident sequences the session currently holds.
fn count(s: &crate::Session<B>) -> usize;
/// Select the actual sequence every following call acts on.
fn select(s: &mut crate::Session<B>, slot: usize) -> Result<(), crate::SessionError>;
}

/// A body that holds one sequence; other slots are refused, not simulated.
pub struct SingleSequence;

impl<B: ChainBody> SequenceSlots<B> for SingleSequence {
const RESIDENT: bool = false;

fn check(slots: NonZeroUsize, what: &'static str) -> Result<(), GpuError> {
if slots.get() != 1 {
return Err(GpuError::Shape {
what,
detail: format!(
"the body holds one sequence, not {} resident slots",
slots.get()
),
});
}
Ok(())
}

fn add(_s: &mut crate::Session<B>, slots: NonZeroUsize) -> Result<(), crate::SessionError> {
<Self as SequenceSlots<B>>::check(slots, "single-sequence session").map_err(Into::into)
}

fn count(_s: &crate::Session<B>) -> usize {
1
}

fn select(_s: &mut crate::Session<B>, slot: usize) -> Result<(), crate::SessionError> {
if slot == 0 {
Ok(())
} else {
Err(crate::SessionError::Refused(format!(
"select_slot {slot}: the body holds one sequence"
)))
}
}
}

/// Resident sequences backed by the body's actual parked stores.
pub struct ResidentSequences;

impl<B: Slots<Seq: 'static>> SequenceSlots<B> for ResidentSequences {
const RESIDENT: bool = true;

fn check(_slots: NonZeroUsize, _what: &'static str) -> Result<(), GpuError> {
Ok(())
}

fn add(s: &mut crate::Session<B>, slots: NonZeroUsize) -> Result<(), crate::SessionError> {
s.add_slots(slots.get())
}

fn count(s: &crate::Session<B>) -> usize {
s.slots()
}

fn select(s: &mut crate::Session<B>, slot: usize) -> Result<(), crate::SessionError> {
s.select_slot(slot)
}
}

/// `ctx` positions as a plan takes them, for a body whose chain runs on one
/// card: refused by name (`what` the body's session) when `machine` puts the
/// layers on any other number of cards or `ctx` passes u64.
Expand Down
4 changes: 3 additions & 1 deletion crates/app/src/arch/musespark/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ impl Open for Body {
ctx: usize,
cfg: &HybridCfg,
) -> Result<Plan<'a>, GpuError> {
<super::SingleSequence as super::SequenceSlots<Body>>::check(cfg.slots, WHAT)?;
let ctx = one_card_ctx(WHAT, machine, ctx)?;
inputs.plan_at(machine, ctx, &cfg.place, WHAT)
inputs.plan_at(machine, ctx, &cfg.place, cfg.slots, WHAT)
}

/// The model resident by `plan`, on the plan's one card, under the
Expand All @@ -60,6 +61,7 @@ impl Open for Body {
plan: &Plan<'_>,
cfg: &HybridCfg,
) -> Result<GpuModel<Body>, GpuError> {
<super::SingleSequence as super::SequenceSlots<Body>>::check(cfg.slots, WHAT)?;
GpuModel::<Body>::open_placed_with(file, plan, 0, cfg.host, cfg.residency)
}

Expand Down
4 changes: 3 additions & 1 deletion crates/app/src/arch/solar2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const WHAT: &str = "solar2 session";

impl Batch for Body {
type Inputs = PlanInputs;
type Sequences = super::SingleSequence;

const WHAT: &'static str = self::WHAT;

Expand All @@ -53,8 +54,9 @@ impl Batch for Body {
inputs: &PlanInputs,
host: HostCfg,
residency: Residency,
slots: NonZeroUsize,
) -> Result<GpuModel<Body>, GpuError> {
Body::open_placed_slots(file, plan, inputs, 0, host, residency, NonZeroUsize::MIN)
Body::open_placed_slots(file, plan, inputs, 0, host, residency, slots)
}

fn batch(
Expand Down
Loading
Loading