Hash a model's bytes once, at open, not on every acquire

A border fill acquires the filler once a tile, and each acquire hashed
the 28 MB model twice — 60 ms a tile, a third of the tile's run on a
throttled TensorRT. The Model keeps its hash from open.
This commit is contained in:
2026-09-19 20:41:21 +02:00
parent 54a80e688c
commit 031ba7b77d
3 changed files with 50 additions and 18 deletions
+6 -1
View File
@@ -29,7 +29,12 @@ pub fn hash(bytes: &[u8]) -> u64 {
/// The cache entry for `bytes` compiled on `rung`.
pub fn key(rung: Rung, bytes: &[u8]) -> String {
format!("{}:{:016x}", rung.label(), hash(bytes))
key_of(rung, hash(bytes))
}
/// The same, from a hash already taken.
pub fn key_of(rung: Rung, hash: u64) -> String {
format!("{}:{:016x}", rung.label(), hash)
}
/// Where QNN's compiled context for `bytes` lives.