You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5ac9a7f
Browse filesBrowse the repository at this point in the historyBrowse files
[Web] Give callers their own reference to cached shape tuples (#20501)
`makeShapeTuple` returns the object the shape cache owns. The cache is a
256-entry LRU that disposes what it evicts, so once a prefill touches
more than 256 distinct shapes a caller can hold a tuple that has already
been freed. WebLLM hits this on a Radeon iGPU as `Object has already
been disposed` followed by a device hang (mlc-ai/web-llm#844). #20130
kept evicted tuples alive until teardown, whereas here the tuple is
owned by the caller.
1. `makeShapeTuple` takes a reference on the cached handle and returns a
new object attached to the current scope, so eviction only drops the
cache's reference. Like every other function that returns a TVM object,
it now requires an open scope.
2. `setDeviceLostAutoDispose(false)` lets an owner that already disposes
the instance itself keep it from disposing on the device-lost promise
A cache hit costs 15 to 30 ns more per call. Tests cover eviction while
a caller holds the tuple and deferred disposal after device loss.
---------
Signed-off-by: Akaash Parthasarathy <akaashrp@gmail.com>
0 commit comments