77/// Usage:
88/// cargo run --release --no-default-features -p yscv-llm-bench --bin nchwc_coverage \
99/// -- private/private/model.onnx
10- use std:: collections:: { HashMap , HashSet } ;
11-
10+ use std:: collections:: { HashSet } ;
11+ use rustc_hash :: FxHashMap ;
1212use yscv_onnx:: { OnnxAttribute , OnnxModel , OnnxNode , load_onnx_model_from_file} ;
1313
1414fn main ( ) {
@@ -76,8 +76,8 @@ fn is_passthrough(op_type: &str) -> bool {
7676/// Build a map: tensor_name → shape, tracing through Identity nodes to
7777/// resolve weight-sharing aliases. In Siamese networks, branch1 weights
7878/// are Identity(branch0_initializer) — treat them as static weights.
79- fn build_effective_initializers ( model : & OnnxModel ) -> HashMap < String , Vec < usize > > {
80- let mut effective: HashMap < String , Vec < usize > > = model
79+ fn build_effective_initializers ( model : & OnnxModel ) -> FxHashMap < String , Vec < usize > > {
80+ let mut effective: FxHashMap < String , Vec < usize > > = model
8181 . initializers
8282 . iter ( )
8383 . map ( |( k, v) | ( k. clone ( ) , v. shape ( ) . to_vec ( ) ) )
@@ -139,8 +139,8 @@ fn run_coverage_probe(model: &OnnxModel) {
139139 // Classify each conv op
140140 let mut eligible = 0usize ;
141141 let mut rejected = 0usize ;
142- let mut kind_counts: HashMap < String , usize > = HashMap :: new ( ) ;
143- let mut reject_reasons: HashMap < String , usize > = HashMap :: new ( ) ;
142+ let mut kind_counts: FxHashMap < String , usize > = FxHashMap :: default ( ) ;
143+ let mut reject_reasons: FxHashMap < String , usize > = FxHashMap :: default ( ) ;
144144
145145 for ( _, node) in & conv_ops {
146146 let weight_name = node. inputs . get ( 1 ) . map ( |s| s. as_str ( ) ) . unwrap_or ( "" ) ;
@@ -331,7 +331,7 @@ fn run_coverage_probe(model: &OnnxModel) {
331331 println ! ( ) ;
332332 println ! ( "QLinearConv ops in model: {}" , qlinear_conv. len( ) ) ;
333333 // Show all non-Conv node op types and counts
334- let mut op_counts: HashMap < & str , usize > = HashMap :: new ( ) ;
334+ let mut op_counts: FxHashMap < & str , usize > = FxHashMap :: default ( ) ;
335335 for node in & model. nodes {
336336 * op_counts. entry ( node. op_type . as_str ( ) ) . or_default ( ) += 1 ;
337337 }
@@ -349,7 +349,7 @@ fn run_coverage_probe(model: &OnnxModel) {
349349 // Non-passthrough, non-Conv ops require NHWC → insert converter at boundary
350350
351351 // Build tensor → producing node index
352- let mut tensor_producer: HashMap < & str , usize > = HashMap :: new ( ) ;
352+ let mut tensor_producer: FxHashMap < & str , usize > = FxHashMap :: default ( ) ;
353353 for ( i, node) in model. nodes . iter ( ) . enumerate ( ) {
354354 for out in & node. outputs {
355355 if !out. is_empty ( ) {
0 commit comments