From 7ab80249f34dc4a2b7087e46dc6d389961ccbb0b Mon Sep 17 00:00:00 2001 From: AIEN Atlas Date: Fri, 9 Oct 2026 21:09:11 -0500 Subject: [PATCH 1/2] cargo check passes: bench_apples_to_apples builds against current ModelConfig engine_aien.rs built ModelConfig without rope_scaling, tie_word_embeddings, eos_token_ids and qk_norm. Set them to the TinyLlama values (plain rope, tied embeddings off, legacy stop set via empty eos list, no qk norm). Also make cargo clippy -D warnings and cargo fmt --check pass for the crate, and refresh benchmarks/Cargo.lock for the existing path dependencies. Co-authored-by: Drake Stapleton Co-Authored-By: Claude Sonnet 5.5 --- benchmarks/Cargo.lock | 93 +++++++++++++++++++ .../bench_apples_to_apples/src/engine_aien.rs | 13 ++- .../bench_apples_to_apples/src/engine_max.rs | 24 +++-- .../crates/bench_apples_to_apples/src/main.rs | 32 +++++-- .../bench_apples_to_apples/src/metrics.rs | 6 +- .../bench_apples_to_apples/src/oracle.rs | 13 ++- .../bench_apples_to_apples/src/telemetry.rs | 5 +- 7 files changed, 157 insertions(+), 29 deletions(-) diff --git a/benchmarks/Cargo.lock b/benchmarks/Cargo.lock index 9ddd896c..3906e981 100644 --- a/benchmarks/Cargo.lock +++ b/benchmarks/Cargo.lock @@ -25,17 +25,30 @@ dependencies = [ "memchr", ] +[[package]] +name = "aien-abi-core" +version = "0.1.0" +dependencies = [ + "async-trait", + "serde", +] + [[package]] name = "aien-inference-abi" version = "0.1.0" dependencies = [ + "aien-abi-core", "aien-kv-cache", + "aien-omega-gpu", + "aien-platform", "async-trait", "libloading", + "parking_lot", "rayon", "reqwest", "serde", "serde_json", + "sha2", "tokenizers", "tokio", ] @@ -45,14 +58,29 @@ name = "aien-kv-cache" version = "0.1.0" dependencies = [ "aien-platform", + "aien-platform-linux", + "libc", "parking_lot", "serde", ] +[[package]] +name = "aien-omega-gpu" +version = "0.1.0" + [[package]] name = "aien-platform" version = "0.1.0" +[[package]] +name = "aien-platform-linux" +version = "0.1.0" +dependencies = [ + "aien-platform", + "libc", + "parking_lot", +] + [[package]] name = "android_system_properties" version = "0.1.6" @@ -168,6 +196,15 @@ version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "bumpalo" version = "3.20.3" @@ -312,6 +349,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crossbeam-deque" version = "0.8.8" @@ -337,6 +383,16 @@ version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + [[package]] name = "darling" version = "0.20.11" @@ -412,6 +468,16 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + [[package]] name = "displaydoc" version = "0.2.7" @@ -568,6 +634,16 @@ dependencies = [ "slab", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getrandom" version = "0.2.17" @@ -1588,6 +1664,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "2.0.1" @@ -1939,6 +2026,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + [[package]] name = "unicode-ident" version = "1.0.26" diff --git a/benchmarks/crates/bench_apples_to_apples/src/engine_aien.rs b/benchmarks/crates/bench_apples_to_apples/src/engine_aien.rs index d1fc8fc3..e00bcf4c 100644 --- a/benchmarks/crates/bench_apples_to_apples/src/engine_aien.rs +++ b/benchmarks/crates/bench_apples_to_apples/src/engine_aien.rs @@ -34,6 +34,10 @@ impl AienEngineHandle { vocab_size: 32000, rms_norm_eps: 1e-5, rope_theta: 10000.0, + rope_scaling: None, + tie_word_embeddings: false, + eos_token_ids: Vec::new(), + qk_norm: false, }; let safetensors_path = format!("{}/model.safetensors", config.model_path); @@ -49,8 +53,13 @@ impl AienEngineHandle { let tokenizer_path = resolve_tokenizer_path(&config.tokenizer_path, &config.model_path)?; eprintln!("Loading tokenizer from {}...", tokenizer_path.display()); - let tokenizer = TinyLlamaTokenizer::from_file(&tokenizer_path) - .map_err(|e| format!("Failed to load tokenizer from {}: {}", tokenizer_path.display(), e))?; + let tokenizer = TinyLlamaTokenizer::from_file(&tokenizer_path).map_err(|e| { + format!( + "Failed to load tokenizer from {}: {}", + tokenizer_path.display(), + e + ) + })?; Ok(Self { backend, tokenizer }) } diff --git a/benchmarks/crates/bench_apples_to_apples/src/engine_max.rs b/benchmarks/crates/bench_apples_to_apples/src/engine_max.rs index c67617e0..cb47634b 100644 --- a/benchmarks/crates/bench_apples_to_apples/src/engine_max.rs +++ b/benchmarks/crates/bench_apples_to_apples/src/engine_max.rs @@ -92,7 +92,10 @@ impl MaxServerHandle { impl Drop for MaxServerHandle { fn drop(&mut self) { let pid_str = self.child.id().to_string(); - eprintln!("Terminating Modular MAX server PID {} and its worker subprocesses...", pid_str); + eprintln!( + "Terminating Modular MAX server PID {} and its worker subprocesses...", + pid_str + ); let _ = Command::new("pkill").args(["-9", "-P", &pid_str]).output(); let _ = self.child.kill(); let _ = self.child.wait(); @@ -152,10 +155,8 @@ async fn execute_single_max_request( if let Ok(val) = serde_json::from_str::(json_str) { if let Some(choices) = val.get("choices").and_then(|c| c.as_array()) { if let Some(first) = choices.first() { - let text_opt = first - .get("text") - .and_then(|t| t.as_str()) - .or_else(|| { + let text_opt = + first.get("text").and_then(|t| t.as_str()).or_else(|| { first .get("delta") .and_then(|d| d.get("content")) @@ -166,7 +167,9 @@ async fn execute_single_max_request( if token_count == 0 { ttft_ms = start.elapsed().as_secs_f64() * 1000.0; } else { - itl_ms.push(now.duration_since(last_chunk_time).as_secs_f64() * 1000.0); + itl_ms.push( + now.duration_since(last_chunk_time).as_secs_f64() * 1000.0, + ); } last_chunk_time = now; token_count += 1; @@ -219,7 +222,8 @@ pub async fn run_max_concurrency_sweep( let model_name = server.model_id.clone(); handles.push(tokio::spawn(async move { - execute_single_max_request(client_clone, port, req_idx, prompt, max_tokens, model_name).await + execute_single_max_request(client_clone, port, req_idx, prompt, max_tokens, model_name) + .await })); } @@ -260,12 +264,14 @@ pub async fn run_max_concurrency_sweep( let itl_p50 = calculate_percentile(&all_itl, 50.0); let itl_p95 = calculate_percentile(&all_itl, 95.0); let itl_p99 = calculate_percentile(&all_itl, 99.0); - let energy_j_per_tok = calculate_joules_per_token(avg_power_watts, wall_clock_elapsed, total_output_tokens); + let energy_j_per_tok = + calculate_joules_per_token(avg_power_watts, wall_clock_elapsed, total_output_tokens); let parity_match_rate_pct = if let Ok(tok) = aien_inference_abi::tokenizer::TinyLlamaTokenizer::from_file(&config.tokenizer_path) { - let toks = crate::oracle::encode_generated_text_in_context(&tok, &config.prompt, &sample_text); + let toks = + crate::oracle::encode_generated_text_in_context(&tok, &config.prompt, &sample_text); verify_token_sequence_match(&toks, &ORACLE_BENCHMARK_128_TOKENS) } else { 0.0 diff --git a/benchmarks/crates/bench_apples_to_apples/src/main.rs b/benchmarks/crates/bench_apples_to_apples/src/main.rs index 7d660643..cb430f5b 100644 --- a/benchmarks/crates/bench_apples_to_apples/src/main.rs +++ b/benchmarks/crates/bench_apples_to_apples/src/main.rs @@ -57,18 +57,20 @@ struct Args { async fn main() -> Result<(), Box> { let args = Args::parse(); - let mut config = BenchmarkConfig::default(); - config.output_token_count = args.output_tokens; - config.max_serve_port = args.max_port; - config.cool_down_target_power_watts = args.target_power_watts; - config.cool_down_max_temp_c = args.max_temp_c; - let concurrency_levels: Vec = args .concurrency .split(',') .filter_map(|s| s.trim().parse::().ok()) .collect(); - config.concurrency_levels = concurrency_levels.clone(); + + let config = BenchmarkConfig { + output_token_count: args.output_tokens, + max_serve_port: args.max_port, + cool_down_target_power_watts: args.target_power_watts, + cool_down_max_temp_c: args.max_temp_c, + concurrency_levels: concurrency_levels.clone(), + ..Default::default() + }; let target_engines: Vec = args .engines @@ -85,7 +87,10 @@ async fn main() -> Result<(), Box> { println!("Workload: 128 input tokens -> 128 output tokens (Greedy, Temp=0.0)"); println!("Engines: {:?}", target_engines); println!("Concurrency levels: {:?}", concurrency_levels); - println!("Thermal cooldown envelope: <= {:.1}W, <= {:.1}C", config.cool_down_target_power_watts, config.cool_down_max_temp_c); + println!( + "Thermal cooldown envelope: <= {:.1}W, <= {:.1}C", + config.cool_down_target_power_watts, config.cool_down_max_temp_c + ); println!("================================================================================"); let mut all_results: Vec = Vec::new(); @@ -202,7 +207,16 @@ fn print_sweep_result_line(res: &ConcurrencyRunResult) { fn print_summary_table(results: &[ConcurrencyRunResult]) { println!( "| {:<24} | {:>3} | {:>10} | {:>10} | {:>10} | {:>9} | {:>9} | {:>8} | {:>9} | {:>8} |", - "Engine", "C", "Throughput", "TTFT p50", "TTFT p95", "ITL p50", "ITL p95", "Peak RSS", "Avg Power", "Parity" + "Engine", + "C", + "Throughput", + "TTFT p50", + "TTFT p95", + "ITL p50", + "ITL p95", + "Peak RSS", + "Avg Power", + "Parity" ); println!( "|--------------------------|-----|------------|------------|------------|-----------|-----------|----------|-----------|----------|" diff --git a/benchmarks/crates/bench_apples_to_apples/src/metrics.rs b/benchmarks/crates/bench_apples_to_apples/src/metrics.rs index b165bb91..11242d5f 100644 --- a/benchmarks/crates/bench_apples_to_apples/src/metrics.rs +++ b/benchmarks/crates/bench_apples_to_apples/src/metrics.rs @@ -23,7 +23,11 @@ pub fn calculate_percentile(values: &[f64], percentile: f64) -> f64 { /// Computes energy efficiency in Joules per token. /// Formula: (Average Power in Watts * Total Elapsed Time in Seconds) / Total Tokens Generated. -pub fn calculate_joules_per_token(avg_power_watts: f64, elapsed_secs: f64, total_tokens: usize) -> f64 { +pub fn calculate_joules_per_token( + avg_power_watts: f64, + elapsed_secs: f64, + total_tokens: usize, +) -> f64 { if total_tokens == 0 { return 0.0; } diff --git a/benchmarks/crates/bench_apples_to_apples/src/oracle.rs b/benchmarks/crates/bench_apples_to_apples/src/oracle.rs index 7f26951a..93ae8cee 100644 --- a/benchmarks/crates/bench_apples_to_apples/src/oracle.rs +++ b/benchmarks/crates/bench_apples_to_apples/src/oracle.rs @@ -11,13 +11,12 @@ pub const ORACLE_M3_FIRST_16_TOKENS: [u32; 16] = [ pub const ORACLE_BENCHMARK_128_TOKENS: [u32; 128] = [ 2111, 824, 6601, 11258, 338, 8688, 304, 2304, 263, 9377, 3464, 310, 8324, 322, 9595, 29889, 3118, 310, 278, 1820, 7117, 310, 5400, 6601, 11258, 338, 278, 3370, 21277, 29892, 607, 338, - 14040, 363, 767, 6751, 278, 2130, 304, 3370, 7788, 29889, 450, 3370, 21277, 338, 13931, - 964, 2211, 11174, 29901, 13, 13, 29896, 29889, 2184, 3370, 29901, 910, 338, 278, 1667, 3370, - 393, 338, 15579, 304, 599, 1889, 943, 297, 278, 1788, 29889, 739, 338, 12234, 19098, 964, - 24388, 29892, 1269, 411, 967, 1914, 731, 310, 3370, 14157, 29889, 13, 13, 29906, 29889, - 28540, 29901, 315, 14520, 526, 2319, 3370, 12786, 393, 526, 8688, 304, 7090, 13672, 20592, - 848, 29889, 2688, 526, 12234, 5982, 2978, 278, 21433, 29915, 29879, 1667, 3370, 322, 526, - 4784, 13672, 304, 3013, + 14040, 363, 767, 6751, 278, 2130, 304, 3370, 7788, 29889, 450, 3370, 21277, 338, 13931, 964, + 2211, 11174, 29901, 13, 13, 29896, 29889, 2184, 3370, 29901, 910, 338, 278, 1667, 3370, 393, + 338, 15579, 304, 599, 1889, 943, 297, 278, 1788, 29889, 739, 338, 12234, 19098, 964, 24388, + 29892, 1269, 411, 967, 1914, 731, 310, 3370, 14157, 29889, 13, 13, 29906, 29889, 28540, 29901, + 315, 14520, 526, 2319, 3370, 12786, 393, 526, 8688, 304, 7090, 13672, 20592, 848, 29889, 2688, + 526, 12234, 5982, 2978, 278, 21433, 29915, 29879, 1667, 3370, 322, 526, 4784, 13672, 304, 3013, ]; /// Computes token-level match rate against the reference oracle. diff --git a/benchmarks/crates/bench_apples_to_apples/src/telemetry.rs b/benchmarks/crates/bench_apples_to_apples/src/telemetry.rs index 5ece82a7..2c060a39 100644 --- a/benchmarks/crates/bench_apples_to_apples/src/telemetry.rs +++ b/benchmarks/crates/bench_apples_to_apples/src/telemetry.rs @@ -173,7 +173,10 @@ pub async fn enforce_thermal_cooldown(target_watts: f64, max_temp_c: f64) { ); if sample.power_watts <= target_watts && sample.temperature_c <= max_temp_c { - eprintln!("Thermal envelope satisfied in {:.1}s.", start.elapsed().as_secs_f64()); + eprintln!( + "Thermal envelope satisfied in {:.1}s.", + start.elapsed().as_secs_f64() + ); return; } } From feb4b8d38ad8df79104fd0e21f562b89e8640858 Mon Sep 17 00:00:00 2001 From: AIEN Atlas Date: Fri, 9 Oct 2026 21:09:19 -0500 Subject: [PATCH 2/2] crumb compile Co-authored-by: Drake Stapleton --- .crumb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.crumb b/.crumb index 3a64552d..5db26dd1 100644 --- a/.crumb +++ b/.crumb @@ -65,7 +65,7 @@ "children": [ { "digest": "3f8234691c53c0a0dc36cf6c7848a3006fbeb6b23fc71a77d7c9ad3c35d82323", - "last_commit": "6ee4315", + "last_commit": "885e42f", "name": "scripts", "purpose": "" }, @@ -77,14 +77,14 @@ } ], "children_root": "sha256:6125449db449f5c3431e63c5bf8b20022665a7ea6c635c0f884c8f1e5c0e8ee2", - "compiled_at": "2026-10-10T01:38:15Z", + "compiled_at": "2026-10-10T02:09:11Z", "compiler": "crumb-compile/1", - "digest": "sha256:9c55268eee41818af15238f32bbff65dfd1993502c16cb1cd99aa0953181435d", + "digest": "sha256:dfa985276ee617c9ead3ed3d4767042e33312f182a2f210b227df48e3153d7f8", "evidence_files": 187, "evidence_root": "sha256:27ee0353cb4d4aae2b7dbce2bfe0d9f4ef2a94cd7a4555b84684d59372503280", "files": 1849, - "generated_at_commit": "6ee431581c8eea3525d3d338ab9a897e334c843f", - "source_tree": "sha256:97826c5963e03bbcf2c575e13ccf230c6cabd1b2dd268b00bd31f4a21db91bbf" + "generated_at_commit": "7ab80249f34dc4a2b7087e46dc6d389961ccbb0b", + "source_tree": "sha256:8f1219de38d7fef89068d1517b84ae7bab87c64cf9b3a52ffaed599cef9dd1aa" } }, "history": [],