gemini-code-assist[bot] commented on code in PR #18680:
URL: https://github.com/apache/tvm/pull/18680#discussion_r2718741000
##########
web/src/webgpu.ts:
##########
@@ -110,6 +110,18 @@ export async function detectGPUDevice(powerPreference:
"low-power" | "high-perfo
);
}
+ const candidates = [1024, 512, 256];
+ const limit = adapter.limits.maxComputeInvocationsPerWorkgroup;
+ const requiredMaxComputeInvocationsPerWorkgroup = candidates.find(x => x
<= limit) || undefined;
Review Comment:

The `|| undefined` is redundant here. `Array.prototype.find()` already
returns `undefined` if no element satisfies the testing function.
```suggestion
const requiredMaxComputeInvocationsPerWorkgroup = candidates.find(x => x
<= limit);
```
##########
web/src/runtime.ts:
##########
@@ -2146,7 +2146,7 @@ export class Instance implements Disposable {
const errMsgOffset = stack.allocRawBytes(errMsg.length + 1);
stack.storeRawBytes(errMsgOffset, StringToUint8Array(errMsg));
stack.commitToWasmMemory();
- (this.lib.exports.FTVMFFIErrorSetRaisedFromCStr as
ctypes.FTVMFFIErrorSetRaisedFromCStr)(
+ (this.lib.exports.TVMFFIErrorSetRaisedFromCStr as
ctypes.FTVMFFIErrorSetRaisedFromCStr)(
stack.ptrFromOffset(errKindOffset),
stack.ptrFromOffset(errMsgOffset)
);
Review Comment:

The function name has been updated to `TVMFFIErrorSetRaisedFromCStr`, but
it's being cast to the old type `ctypes.FTVMFFIErrorSetRaisedFromCStr`. This is
inconsistent and suggests an incomplete refactoring. The type definition in
`ctypes.ts` and this cast should be updated to use the new name
`TVMFFIErrorSetRaisedFromCStr` for consistency.
```suggestion
(this.lib.exports.TVMFFIErrorSetRaisedFromCStr as
ctypes.TVMFFIErrorSetRaisedFromCStr)(
stack.ptrFromOffset(errKindOffset),
stack.ptrFromOffset(errMsgOffset)
);
```
--
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]