gemini-code-assist[bot] commented on code in PR #18450:
URL: https://github.com/apache/tvm/pull/18450#discussion_r2527342699
##########
web/src/runtime.ts:
##########
@@ -1421,6 +1421,8 @@ export class Instance implements Disposable {
throw err;
}
}
+ fetchedBytes += shard.nbytes;
+ timeElapsed = Math.ceil((perf.now() - tstart) / 1000);
Review Comment:

This change correctly adds progress reporting for the cache loading phase
when `cacheOnly` is true. However, it introduces a bug when `cacheOnly` is
false. In that case, `fetchedBytes` is incremented both during the initial
download phase and again in this loading phase, leading to double-counting and
a progress percentage that can go up to 200%.
The ideal solution is to reset `fetchedBytes` to 0 before this `for` loop
(at line 1377) to track the loading progress separately. Since I can only
suggest changes within this diff, a viable workaround is to reset the counter
on the first iteration of this loop.
```typescript
if (i === 0) {
// Reset for the loading phase to avoid double counting with
download phase.
fetchedBytes = 0;
}
fetchedBytes += shard.nbytes;
timeElapsed = Math.ceil((perf.now() - tstart) / 1000);
```
--
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]