interplane.Get Omega
Read in your language

benchmarks-mv

Measurement harnesses and evidence bundles for AIEN on the NVIDIA DGX Spark GB10. Speed is reported against the machine's physical limit and my own previous run. Attachment of AienOS.

Brought by drakestapleton

branch main Branches Tags History

benchmarks-mv / src / harness / workloads.rs

60 lines · 1961 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
16use std::time::Instant;
17
18#[allow(dead_code)]
19pub struct VectorBenchmarkResult {
20 pub iterations: usize,
21 pub dimensions: usize,
22 pub elapsed_ms: f64,
23 pub operations_per_sec: f64,
24 pub p50_latency_us: f64,
25}
26
27pub fn run_vector_dot_product_benchmark(
28 iterations: usize,
29 dimensions: usize,
30) -> VectorBenchmarkResult {
31 let v1: Vec<f32> = (0..dimensions).map(|i| (i as f32) * 0.001).collect();
32 let v2: Vec<f32> = (0..dimensions).map(|i| (i as f32) * 0.002).collect();
33
34 let start = Instant::now();
35 let mut accumulator = 0.0f32;
36
37 for _ in 0..iterations {
38 // Direct SIMD-friendly vector dot product
39 let dot: f32 = v1.iter().zip(v2.iter()).map(|(a, b)| a * b).sum();
40 accumulator += dot;
41 }
42
43 let elapsed = start.elapsed();
44 let elapsed_ms = elapsed.as_secs_f64() * 1000.0;
45 let ops_per_sec = (iterations as f64) / elapsed.as_secs_f64().max(0.00001);
46 let p50_us = (elapsed.as_micros() as f64) / (iterations as f64).max(1.0);
47
48 // Prevent compiler optimization from dead-stripping computation
49 if accumulator == 0.0000001 {
50 println!("Edge case");
51 }
52
53 VectorBenchmarkResult {
54 iterations,
55 dimensions,
56 elapsed_ms,
57 operations_per_sec: ops_per_sec,
58 p50_latency_us: p50_us,
59 }
60}