tomayac opened a new pull request, #19569:
URL: https://github.com/apache/tvm/pull/19569

   The CrossOriginStorage class was storing the URL→hash map only in the 
module-level GLOBAL_HASH_CACHE. After a page reload that cache is empty, and 
getFileHash() can only recover hashes for HuggingFace LFS files (URLs 
containing /resolve/). This left several resource categories uncacheable across 
sessions:
   
   <img width="1197" height="279" alt="Screenshot 2026-05-15 at 17 43 15" 
src="https://github.com/user-attachments/assets/c9943910-9002-4b06-afdd-6288b7e22ba6";
 />
   
   - JSON files not stored in LFS (mlc-chat-config.json, tokenizer.json, 
tensor-cache.json) — getFileHash returns null for their /resolve/ URLs because 
the raw pointer is the actual file content, not an LFS pointer.
   - .wasm files from GitHub raw URLs — no /resolve/ pattern at all.
   - Any file whose hash was computed from blob content via getBlobHash.
   
   Additionally, even for genuine LFS model shards, each page load was 
re-fetching every shard's LFS pointer file over the network just to re-derive 
the SHA-256 hash.
   
   Fix: persist the URL→hash mapping to a dedicated Cache API store 
(tvmjs-cos-hash-meta). Two write sites:
   
   1. put() — after a file is stored in COS, persist its blob-derived hash. 
This covers all non-LFS files and non-HuggingFace URLs.
   
   2. resolveHashDescriptor() — after getFileHash() resolves a hash from the 
LFS pointer, persist it immediately. This eliminates repeated pointer-file 
network requests for model shards on subsequent visits.
   
   Both write sites use a best-effort try/catch so storage quota errors are 
silently ignored. loadPersistedHashEntry() similarly swallows errors. The 
typeof caches === "undefined" guard keeps the code safe in Node.js test 
environments.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to