//! Why the certificate decides which graphs run here: the graphs of the corpus that use //! only the subset's operators but whose verdict does not meet `acc32` (ยง9.2 item 1), //! run with their arithmetic on the device anyway, give results that differ from the //! interpreter's, or carry values past the words a line holds. On every graph the //! subset admits, the device agrees (`tests/corpus.rs`). //! //! With no device the test prints `ops-npu width: SKIPPED`, and fails under //! `WAI_OPS_NPU_REQUIRE`. #[path = "support/corpus.rs"] mod corpus; use corpus::report; #[test] fn graphs_the_certificate_keeps_out_are_not_exact_here() { let vs = corpus::vectors(); let (rs, _) = corpus::ready(&vs); let only_acc32: Vec<&corpus::Ready<'_>> = rs.iter().filter(|r| r.plan.reasons == ["acc32"]).collect(); assert!(only_acc32.len() > 100, "too few graphs outside the subset by acc32 alone: {}", only_acc32.len()); let Some(npu) = corpus::device("width") else { return }; let t = corpus::run_all(&npu, &only_acc32, 3); // A graph whose values leave the words a line carries is declined operator by // operator; those ran on the CPU and say nothing about the device. report(&format!( "ops-npu width: key={} graphs outside the subset by acc32 alone={}: on the device {} differ from the interpreter; operators declined (values past 32 bits)={}; errors={}", npu.key(), only_acc32.len(), t.mismatched, t.stats.declined.len(), t.stats.errors.len() )); for m in &t.mismatches { println!("DIFFERS {m}"); } assert!(t.stats.errors.is_empty(), "device errors: {:?}", t.stats.errors.first()); assert!(t.mismatched > 0, "every graph the certificate keeps from the subset agreed on the device"); }