Skip to content

Commit b9d63f4

Browse files
committed
fix: resolve compilation errors across workspace
- Add PiQ3/PiQ2 match arms in ruvllm-cli quantize memory estimation - Add main() stub to mincut-gated-transformer-wasm web_scorer example - Gate scipix OCR examples behind required-features = ["ocr"] - Fix usize/u64 type mismatch in ruvector-cnn kernel_equivalence test https://claude.ai/code/session_01UWE22wnsZRSHKhT4h4Axby
1 parent 773adb5 commit b9d63f4

4 files changed

Lines changed: 27 additions & 2 deletions

File tree

crates/ruvector-cnn/tests/kernel_equivalence.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ mod kernel_equivalence {
468468
};
469469

470470
// Test matmul with various sizes (aligned and unaligned)
471-
let sizes = vec![
471+
let sizes: Vec<(usize, usize, usize)> = vec![
472472
(15, 15, 15), // Unaligned
473473
(16, 16, 16), // Aligned to 16
474474
(17, 17, 17), // Unaligned
@@ -478,7 +478,7 @@ mod kernel_equivalence {
478478
];
479479

480480
for (m, n, k) in sizes {
481-
let mut rng = fastrand::Rng::with_seed(42 + m);
481+
let mut rng = fastrand::Rng::with_seed(42 + m as u64);
482482
let a: Vec<i8> = (0..m * k).map(|_| rng.i8(..)).collect();
483483
let b: Vec<i8> = (0..k * n).map(|_| rng.i8(..)).collect();
484484

crates/ruvector-mincut-gated-transformer-wasm/examples/web_scorer.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,9 @@ pub fn run_custom_config_example() -> Result<JsValue, JsValue> {
156156

157157
Ok(output.into())
158158
}
159+
160+
// Required for cargo test/check; this example is meant to be built with wasm-pack.
161+
#[cfg(not(target_arch = "wasm32"))]
162+
fn main() {
163+
eprintln!("This example requires wasm-pack: wasm-pack build --target web");
164+
}

crates/ruvllm-cli/src/commands/quantize.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,20 @@ fn print_memory_estimates(format: TargetFormat) {
236236
e.total_mb *= 2.0;
237237
e
238238
},
239+
TargetFormat::PiQ3 => |p, v, h, l| {
240+
let mut e = estimate_memory_q4(p, v, h, l);
241+
// PiQ3 is ~3.0625 bits/weight vs Q4's ~4.5, so ~68% of Q4 size
242+
e.total_bytes = (e.total_bytes as f64 * 3.0625 / 4.5) as usize;
243+
e.total_mb = e.total_bytes as f64 / (1024.0 * 1024.0);
244+
e
245+
},
246+
TargetFormat::PiQ2 => |p, v, h, l| {
247+
let mut e = estimate_memory_q4(p, v, h, l);
248+
// PiQ2 is ~2.0625 bits/weight vs Q4's ~4.5, so ~46% of Q4 size
249+
e.total_bytes = (e.total_bytes as f64 * 2.0625 / 4.5) as usize;
250+
e.total_mb = e.total_bytes as f64 / (1024.0 * 1024.0);
251+
e
252+
},
239253
};
240254

241255
// Qwen2.5-0.5B (RuvLTRA-Small)

examples/scipix/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ crate-type = ["cdylib", "rlib"]
162162
[[example]]
163163
name = "simple_ocr"
164164
path = "examples/simple_ocr.rs"
165+
required-features = ["ocr"]
165166

166167
[[example]]
167168
name = "batch_processing"
@@ -171,6 +172,7 @@ required-features = ["ocr"]
171172
[[example]]
172173
name = "api_server"
173174
path = "examples/api_server.rs"
175+
required-features = ["ocr"]
174176

175177
[[example]]
176178
name = "streaming"
@@ -180,14 +182,17 @@ required-features = ["ocr"]
180182
[[example]]
181183
name = "custom_pipeline"
182184
path = "examples/custom_pipeline.rs"
185+
required-features = ["ocr"]
183186

184187
[[example]]
185188
name = "lean_agentic"
186189
path = "examples/lean_agentic.rs"
190+
required-features = ["ocr"]
187191

188192
[[example]]
189193
name = "accuracy_test"
190194
path = "examples/accuracy_test.rs"
195+
required-features = ["ocr"]
191196

192197
# Benchmark configurations
193198
[[bench]]

0 commit comments

Comments
 (0)