You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2024/12/10 15:25:40 UTC
(tvm) branch main updated: [Web]Allows setting powerPreference on webgpu (#17545)
This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 4454f8d771 [Web]Allows setting powerPreference on webgpu (#17545)
4454f8d771 is described below
commit 4454f8d771ea40c398d5beb6b7536657a54b38aa
Author: Marcos Scheeren <ma...@gmail.com>
AuthorDate: Tue Dec 10 12:25:33 2024 -0300
[Web]Allows setting powerPreference on webgpu (#17545)
* Added powerPreference argument to detectGPUDevice() while keeping old behaviour as default.
---
web/src/webgpu.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/src/webgpu.ts b/web/src/webgpu.ts
index 5b2d7c9f30..27d68d887c 100644
--- a/web/src/webgpu.ts
+++ b/web/src/webgpu.ts
@@ -33,9 +33,9 @@ export interface GPUDeviceDetectOutput {
/**
* DetectGPU device in the environment.
*/
-export async function detectGPUDevice(): Promise<GPUDeviceDetectOutput | undefined> {
+export async function detectGPUDevice(powerPreference: "low-power" | "high-performance" = "high-performance"): Promise<GPUDeviceDetectOutput | undefined> {
if (typeof navigator !== "undefined" && navigator.gpu !== undefined) {
- const adapter = await navigator.gpu.requestAdapter({ "powerPreference": "high-performance" });
+ const adapter = await navigator.gpu.requestAdapter({ powerPreference });
if (adapter == null) {
throw Error(
"Unable to find a compatible GPU. This issue might be because your computer doesn't have a GPU, or your system settings are not configured properly. " +