Skip to content

Commit 54b2d64

Browse files
WebGPU: Remove deprecated subgroups-f16 from WebGPU native and JS EP (#23898)
This PR removes the deprecated subgroups-f16 from WebGPU native and JS EP, and also remove the unused deviceInfo in WebGPU JS EP.
1 parent 996fffb commit 54b2d64

File tree

6 files changed

+3
-52
lines changed

6 files changed

+3
-52
lines changed

js/web/lib/wasm/jsep/backend-webgpu.ts

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { ProgramManager } from './webgpu/program-manager';
1313
import {
1414
AdapterInfo,
1515
ComputeContext,
16-
DeviceInfo,
1716
GpuArchitecture,
1817
GpuData,
1918
GpuVendor,
@@ -135,34 +134,13 @@ class AdapterInfoImpl implements AdapterInfo {
135134
}
136135
}
137136

138-
class DeviceInfoImpl implements DeviceInfo {
139-
readonly subgroupsSupported: boolean;
140-
readonly subgroupsF16Supported: boolean;
141-
readonly subgroupSizeRange?: readonly [number, number];
142-
143-
constructor(device: GPUDevice) {
144-
this.subgroupsSupported = device.features.has('subgroups' as GPUFeatureName);
145-
this.subgroupsF16Supported = device.features.has('subgroups' as GPUFeatureName);
146-
// Currently subgroups feature is still experimental and size attributes are not in the WebGPU IDL, so we have to
147-
// workaround the IDL type checks.
148-
// TODO: clean this after subgroups feature is settled in IDL.
149-
const deviceSubgroupsLimits = device.limits as { minSubgroupSize?: number; maxSubgroupSize?: number };
150-
if (!this.subgroupsSupported || !deviceSubgroupsLimits.minSubgroupSize || !deviceSubgroupsLimits.maxSubgroupSize) {
151-
this.subgroupSizeRange = undefined;
152-
} else {
153-
this.subgroupSizeRange = [deviceSubgroupsLimits.minSubgroupSize, deviceSubgroupsLimits.maxSubgroupSize];
154-
}
155-
}
156-
}
157-
158137
/**
159138
* this class is designed to store status and being used as a singleton for JSEP. It will be passed to jsepInit() as
160139
* the first parameter so that it is stored for future use.
161140
*/
162141
export class WebGpuBackend {
163142
adapterInfo: AdapterInfoImpl;
164143
device: GPUDevice;
165-
deviceInfo: DeviceInfoImpl;
166144
/**
167145
* an instance of GpuDataManager to manage a GpuDataId -> GpuBuffer mapping
168146
*/
@@ -274,13 +252,9 @@ export class WebGpuBackend {
274252
}
275253
requireFeatureIfAvailable('shader-f16');
276254
// Try subgroups
277-
if (requireFeatureIfAvailable('subgroups' as GPUFeatureName)) {
278-
// If subgroups feature is available, also try subgroups-f16
279-
requireFeatureIfAvailable('subgroups-f16' as GPUFeatureName);
280-
}
255+
requireFeatureIfAvailable('subgroups' as GPUFeatureName);
281256

282257
this.device = await adapter.requestDevice(deviceDescriptor);
283-
this.deviceInfo = new DeviceInfoImpl(this.device);
284258
this.adapterInfo = new AdapterInfoImpl(adapter.info || (await adapter.requestAdapterInfo()));
285259
this.gpuDataManager = createGpuDataManager(this);
286260
this.programManager = new ProgramManager(this);

js/web/lib/wasm/jsep/init.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ import { WebGpuBackend } from './backend-webgpu';
1111
import { LOG_DEBUG } from './log';
1212
import { TensorView } from './tensor-view';
1313
import { ShapeUtil } from './util';
14-
import {
15-
AdapterInfo,
16-
ComputeContext,
17-
ComputeContextInputsOutputsMapping,
18-
DeviceInfo,
19-
ProgramInfo,
20-
} from './webgpu/types';
14+
import { AdapterInfo, ComputeContext, ComputeContextInputsOutputsMapping, ProgramInfo } from './webgpu/types';
2115
import { WebNNBackend } from './backend-webnn';
2216

2317
/* eslint-disable no-bitwise */
@@ -76,7 +70,6 @@ class TensorViewImpl implements TensorView {
7670

7771
class ComputeContextImpl implements ComputeContext {
7872
readonly adapterInfo: AdapterInfo;
79-
readonly deviceInfo: DeviceInfo;
8073
readonly opKernelContext: number;
8174
readonly inputs: readonly TensorView[];
8275
readonly outputCount: number;
@@ -94,7 +87,6 @@ class ComputeContextImpl implements ComputeContext {
9487
contextDataOffset: number,
9588
) {
9689
this.adapterInfo = backend.adapterInfo;
97-
this.deviceInfo = backend.deviceInfo;
9890

9991
// extract context data
10092
const ptrSize = module.PTR_SIZE;

js/web/lib/wasm/jsep/webgpu/program-manager.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ export class ProgramManager {
9999
const extensionsInfo: Array<{ feature: GPUFeatureName; extension: string }> = [
100100
{ feature: 'shader-f16', extension: 'f16' },
101101
{ feature: 'subgroups' as GPUFeatureName, extension: 'subgroups' },
102-
{ feature: 'subgroups-f16' as GPUFeatureName, extension: 'subgroups_f16' },
103102
];
104103
extensionsInfo.forEach((info) => {
105104
if (device.features.has(info.feature)) {

js/web/lib/wasm/jsep/webgpu/types.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ export interface AdapterInfo {
2121
isArchitecture: (architecture: GpuArchitecture) => boolean;
2222
isVendor: (vendor: GpuVendor) => boolean;
2323
}
24-
export interface DeviceInfo {
25-
readonly subgroupsSupported: boolean;
26-
readonly subgroupsF16Supported: boolean;
27-
readonly subgroupSizeRange?: readonly [number, number];
28-
}
2924

3025
export interface GpuData {
3126
type: GpuDataType;
@@ -165,11 +160,6 @@ export interface ComputeContext {
165160
*/
166161
readonly adapterInfo: AdapterInfo;
167162

168-
/**
169-
* gpu device info
170-
*/
171-
readonly deviceInfo: DeviceInfo;
172-
173163
/**
174164
* stores the pointer to OpKernelContext
175165
*/

onnxruntime/core/providers/webgpu/shader_helper.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,6 @@ Status ShaderHelper::GenerateSourceCode(std::string& code, std::vector<int>& sha
345345
})) {
346346
ORT_RETURN_IF_NOT(device_.HasFeature(wgpu::FeatureName::ShaderF16), "Program ", program_.Name(), " requires f16 but the device does not support it.");
347347
ss << "enable f16;\n";
348-
if (device_.HasFeature(wgpu::FeatureName::SubgroupsF16)) {
349-
ss << "enable subgroups_f16;\n";
350-
}
351348
}
352349
if (device_.HasFeature(wgpu::FeatureName::Subgroups)) {
353350
ss << "enable subgroups;\n";

onnxruntime/core/providers/webgpu/webgpu_context.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,7 @@ std::vector<wgpu::FeatureName> WebGpuContext::GetAvailableRequiredFeatures(const
489489
#endif
490490
wgpu::FeatureName::TimestampQuery,
491491
wgpu::FeatureName::ShaderF16,
492-
wgpu::FeatureName::Subgroups,
493-
wgpu::FeatureName::SubgroupsF16};
492+
wgpu::FeatureName::Subgroups};
494493
for (auto feature : features) {
495494
if (adapter.HasFeature(feature)) {
496495
required_features.push_back(feature);

0 commit comments

Comments
 (0)