Skip to content

Commit

Permalink
Make subgroupSizeRange readonly array and fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangzhaoming committed Nov 5, 2024
1 parent 3c62069 commit 0154c77
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/web/lib/wasm/jsep/backend-webgpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ class AdapterInfoImpl implements AdapterInfo {
class DeviceInfoImpl implements DeviceInfo {
readonly subgroupsSupported: boolean;
readonly subgroupsF16Supported: boolean;
readonly subgroupSizeRange?: [number, number];
readonly subgroupSizeRange?: readonly [number, number];

constructor(device: GPUDevice) {
this.subgroupsSupported = device.features.has('subgroups' as GPUFeatureName);
this.subgroupsF16Supported = device.features.has('subgroups' as GPUFeatureName);
// Currently subgroups feature is still experimental and size attributes are not in the WebGPU IDL, so we have to
// workaround the IDL type checks.
// TODO: clean this after subgroups feature is sattled in IDL.
// TODO: clean this after subgroups feature is settled in IDL.
const deviceSubgroupsLimits = device.limits as { minSubgroupSize?: number; maxSubgroupSize?: number };
if (!this.subgroupsSupported || !deviceSubgroupsLimits.minSubgroupSize || !deviceSubgroupsLimits.maxSubgroupSize) {
this.subgroupSizeRange = undefined;
Expand Down
2 changes: 1 addition & 1 deletion js/web/lib/wasm/jsep/webgpu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface AdapterInfo {
export interface DeviceInfo {
readonly subgroupsSupported: boolean;
readonly subgroupsF16Supported: boolean;
readonly subgroupSizeRange?: [number, number];
readonly subgroupSizeRange?: readonly [number, number];
}

export interface GpuData {
Expand Down

0 comments on commit 0154c77

Please sign in to comment.