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

While this correctly handles the case where assets are loaded entirely from
the cache (`cacheOnly` is true), it introduces an issue when assets are first
downloaded from the network. In the download case (`!cacheOnly`),
`fetchedBytes` will already be equal to `totalBytes` after the download phase.
This change will then cause `fetchedBytes` to continue incrementing from
`totalBytes` up to `2 * totalBytes` during this cache loading phase, resulting
in progress being reported from 100% to 200%.
To ensure the loading progress is correctly reported as 0% to 100% in both
scenarios, `fetchedBytes` should be reset to 0 at the beginning of this loading
loop. A concise way to do this is to reset it on the first iteration.
```suggestion
fetchedBytes = (i === 0 ? 0 : fetchedBytes) + shard.nbytes;
```
--
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]