tqchen commented on code in PR #19771:
URL: https://github.com/apache/tvm/pull/19771#discussion_r3429857738
##########
web/src/runtime.ts:
##########
@@ -1323,6 +1325,23 @@ export class Instance implements Disposable {
artifactCache: ArtifactCacheTemplate,
signal?: AbortSignal,
) {
+ // Avoid a single JS-to-wasm byte-array call for multi-hundred-MiB
+ // tensor-cache records. The cap is a conservative per-call staging size,
+ // independent of the final tensor allocation size. Smaller records keep
+ // the existing full-record path.
+ const maxChunkBytes = 128 * 1024 * 1024;
+ const storageBytes = (dtype: string) => {
+ if (dtype === "bool") {
+ return 1;
+ }
+ const match = dtype.match(/(\d+)(?:x(\d+))?$/);
Review Comment:
regex here is really adhoc here, i think we should go with something related
to prefix matching, or have something in the wasm_runtime, which can take
string and get DLDataType to return storage bytes.
--
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]