From 920df4e89c4fd4e55a84f1470af147b64021c7b3 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Tue, 7 Jan 2025 11:18:15 -0800 Subject: [PATCH] add comments --- src/common/runtime/helper/options.ts | 5 ++++- src/common/util/navigator_gpu.ts | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/common/runtime/helper/options.ts b/src/common/runtime/helper/options.ts index 5ec7140d3ae..2bea817d44a 100644 --- a/src/common/runtime/helper/options.ts +++ b/src/common/runtime/helper/options.ts @@ -102,7 +102,10 @@ export const kCTSOptionsInfo: OptionsInfos = { debug: { description: 'show more info' }, compatibility: { description: 'run in compatibility mode' }, forceFallbackAdapter: { description: 'pass forceFallbackAdapter: true to requestAdapter' }, - enforceDefaultLimits: { description: 'force the adapter limits to the default limits' }, + enforceDefaultLimits: { + description: `force the adapter limits to the default limits. +Note: May fail on tests for low-power/high-performance`, + }, unrollConstEvalLoops: { description: 'unroll const eval loops in WGSL' }, powerPreference: { description: 'set default powerPreference for some tests', diff --git a/src/common/util/navigator_gpu.ts b/src/common/util/navigator_gpu.ts index cef5d4ddb4d..728b8cdadf5 100644 --- a/src/common/util/navigator_gpu.ts +++ b/src/common/util/navigator_gpu.ts @@ -129,6 +129,16 @@ export function getGPU(recorder: TestCaseRecorder | null): GPU { this: GPUAdapter, desc?: GPUDeviceDescriptor | undefined ) { + // We need to enforce the default limits because even though we patched the adapter to + // show defaults for adapter.limits, there are tests that test we throw when we request more than the max. + // In other words. + // + // adapter.requestDevice({ requiredLimits: { + // maxXXX: addapter.limits.maxXXX + 1, // should throw + // }); + // + // But unless we enforce this manually, it won't actual through if the adapter's + // true limits are higher than we patched above. enforceDefaultLimits(this, desc); return await origRequestDeviceFn.call(this, desc); };