interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / crates / aien-runtime / src / rsi.rs

57 lines · 2109 bytes Raw Blame History
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Drake Stapleton (AIEN / aien-dev)
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! Autonomous Systems Optimizer (RSI) Boundary Interface
17//! Provides read-only runtime snapshots and validated online hyperparameter tuning.
18
19use serde::{Deserialize, Serialize};
20
21#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct RuntimeSnapshot {
23 pub active_sequences: usize,
24 pub queued_sequences: usize,
25 pub mean_batch_rows: f32,
26 pub logical_kv_bytes: usize,
27 pub physical_kv_bytes: usize,
28 pub shared_pages: usize,
29 pub cow_faults: usize,
30 pub fallback_count: usize,
31 pub step_latency_us: u64,
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
35pub struct RuntimeTuning {
36 pub prefill_chunk_tokens: usize,
37 pub max_batch_rows: usize,
38 pub watermark_blocks: usize,
39}
40
41pub struct RsiBoundary;
42
43impl RsiBoundary {
44 /// Validates proposed runtime hyperparameter changes against legal operational ranges.
45 pub fn validate_tuning(tuning: &RuntimeTuning) -> Result<(), String> {
46 if tuning.prefill_chunk_tokens == 0 || tuning.prefill_chunk_tokens > 8192 {
47 return Err("prefill_chunk_tokens must be within [1, 8192]".to_string());
48 }
49 if tuning.max_batch_rows == 0 || tuning.max_batch_rows > 4096 {
50 return Err("max_batch_rows must be within [1, 4096]".to_string());
51 }
52 if tuning.watermark_blocks < 2 || tuning.watermark_blocks > 256 {
53 return Err("watermark_blocks must be within [2, 256]".to_string());
54 }
55 Ok(())
56 }
57}