diff --git a/js/web/lib/wasm/jsep/backend-webgpu.ts b/js/web/lib/wasm/jsep/backend-webgpu.ts index cf6d25e61acf7..5d66caf77f08f 100644 --- a/js/web/lib/wasm/jsep/backend-webgpu.ts +++ b/js/web/lib/wasm/jsep/backend-webgpu.ts @@ -259,10 +259,6 @@ export class WebGpuBackend { run(program: ProgramInfo, inputTensorViews: readonly TensorView[], outputIndices: readonly number[], createKernelOutput: (index: number, dataType: number, dims: readonly number[]) => TensorView, createIntermediateOutput: (dataType: number, dims: readonly number[]) => TensorView): TensorView[] { - if (inputTensorViews.length !== program.inputTypes.length) { - throw new Error(`Input size must be equal to ${program.inputTypes.length}.`); - } - // create info for inputs const inputDatas: GpuData[] = []; for (let i = 0; i < inputTensorViews.length; ++i) { @@ -277,7 +273,7 @@ export class WebGpuBackend { const key = getProgramInfoUniqueKey(program, inputTensorViews); let artifact = this.programManager.getArtifact(key); - const {outputs, dispatchGroup, variables} = program.getRunData(inputTensorViews); + const {outputs, dispatchGroup, programUniforms} = program.getRunData(inputTensorViews); // check output indices const validatedOutputIndices = outputIndices.length === 0 ? outputs.map((_, i) => i) : outputIndices; @@ -328,12 +324,12 @@ export class WebGpuBackend { // TODO: add cache for uniform (is it necessary?) // let uniformBufferBinding: GPUBindingResource|undefined; - if (variables) { + if (programUniforms) { let currentOffset = 0; let preLength = 0; const offsets: number[] = []; let maxAlignmentOfField = 1; - variables.forEach(v => { + programUniforms.forEach(v => { const data = typeof v.data === 'number' ? [v.data] : v.data; // https://www.w3.org/TR/WGSL/#alignof let baseAlignment: number; @@ -374,7 +370,7 @@ export class WebGpuBackend { currentOffset = Math.ceil(currentOffset / maxAlignmentOfField) * maxAlignmentOfField; const arrayBuffer = new ArrayBuffer(currentOffset); - variables.forEach((v, i) => { + programUniforms.forEach((v, i) => { const offset = offsets[i]; const data = typeof v.data === 'number' ? [v.data] : v.data; if (v.type === 'int32') { diff --git a/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv2d_mm_webgpu.ts b/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv2d_mm_webgpu.ts index 389c5c725b391..01ddca520deed 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv2d_mm_webgpu.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv2d_mm_webgpu.ts @@ -22,7 +22,7 @@ import {LOG_DEBUG} from '../../../log'; import {TensorView} from '../../../tensor-view'; import {ShapeUtil} from '../../../util'; -import {GpuDataType, ProgramInfo} from '../../types'; +import {ProgramInfo} from '../../types'; import {tensorTypeToWsglStorageType} from '../common'; import {ConvAttributes} from '../conv'; @@ -213,11 +213,9 @@ export const createConv2DMatMulProgramInfo = return { name: 'Conv2DMatMul', - inputTypes: hasBias ? [GpuDataType.default, GpuDataType.default, GpuDataType.default] : - [GpuDataType.default, GpuDataType.default], shaderCache: {hint: attributes.cacheKey}, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputs[0].dataType}], dispatchGroup: {x: dispatch[0], y: dispatch[1], z: dispatch[2]}, }), getShaderSource: () => ` diff --git a/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv_backprop_mm_webgpu.ts b/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv_backprop_mm_webgpu.ts index 32bff2f7586b9..840360223c75a 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv_backprop_mm_webgpu.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv_backprop_mm_webgpu.ts @@ -22,7 +22,7 @@ import {LOG_DEBUG} from '../../../log'; import {TensorView} from '../../../tensor-view'; import {ShapeUtil} from '../../../util'; -import {GpuDataType, ProgramInfo} from '../../types'; +import {ProgramInfo} from '../../types'; import {ConvTransposeAttributes} from '../conv-transpose'; import {Activation, activationFnSnippet, biasActivationSnippet, typeSnippet} from './activation_util'; @@ -200,11 +200,9 @@ export const createConv2DTransposeMatMulProgramInfo = } return { name: 'Conv2DTransposeMatMul', - inputTypes: hasBias ? [GpuDataType.default, GpuDataType.default, GpuDataType.default] : - [GpuDataType.default, GpuDataType.default], shaderCache: {hint: attributes.cacheKey}, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputs[0].dataType}], dispatchGroup: {x: dispatch[0], y: dispatch[1], z: dispatch[2]} }), getShaderSource: () => ` diff --git a/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv_backprop_webgpu.ts b/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv_backprop_webgpu.ts index 414abe64eba9e..2e6392aada454 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv_backprop_webgpu.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/conv_backprop_webgpu.ts @@ -20,7 +20,7 @@ import {LOG_DEBUG} from '../../../log'; import {TensorView} from '../../../tensor-view'; import {ShapeUtil} from '../../../util'; -import {GpuDataType, ProgramInfo} from '../../types'; +import {ProgramInfo} from '../../types'; import {inputVariable, outputVariable, ShaderHelper, tensorTypeToWsglStorageType} from '../common'; import {ConvTransposeAttributes} from '../conv-transpose'; @@ -260,15 +260,12 @@ export const createConvTranspose2DProgramInfo = const dataType = tensorTypeToWsglStorageType(inputs[0].dataType); return { name: 'ConvTranspose2D', - inputTypes: hasBias ? [GpuDataType.default, GpuDataType.default, GpuDataType.default] : - [GpuDataType.default, GpuDataType.default], shaderCache: {hint: attributes.cacheKey}, getRunData: () => ({ dispatchGroup: {x: dispatch[0], y: dispatch[1], z: dispatch[2]}, outputs: [{ dims: squeezeOutputShapeFunction ? squeezeOutputShapeFunction(outputShape) : outputShape, - dataType: inputs[0].dataType, - gpuDataType: GpuDataType.default + dataType: inputs[0].dataType }] }), getShaderSource: (shaderHelper: ShaderHelper) => createConvTranspose2DOpProgramShaderSource( diff --git a/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts b/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts index c7a0b701ee86c..1032869412462 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/3rd-party/matmul_packed_webgpu.ts @@ -21,7 +21,7 @@ import {TensorView} from '../../../tensor-view'; import {ShapeUtil} from '../../../util'; -import {GpuDataType, ProgramInfo} from '../../types'; +import {ProgramInfo} from '../../types'; import {getBroadcastDims, IndicesHelper, inputVariable, outputVariable, ShaderHelper, tensorTypeToWsglStorageType} from '../common'; import {getActicationSnippet, InternalActivationAttributes} from '../fuse-utils'; @@ -481,11 +481,9 @@ export const createMatmulProgramInfo = ${batchDims.impl()}`; return { name: 'MatMul', - inputTypes: hasBias ? [GpuDataType.default, GpuDataType.default, GpuDataType.default] : - [GpuDataType.default, GpuDataType.default], shaderCache: {hint: activationAttributes.activationCacheKey}, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputs[0].dataType}], dispatchGroup: {x: dispatch[0], y: dispatch[1], z: dispatch[2]} }), getShaderSource, diff --git a/js/web/lib/wasm/jsep/webgpu/ops/bias-add.ts b/js/web/lib/wasm/jsep/webgpu/ops/bias-add.ts index 18bde55db6244..e2b8412000ef9 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/bias-add.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/bias-add.ts @@ -3,7 +3,7 @@ import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {inputVariable, outputVariable, ShaderHelper} from './common'; @@ -51,9 +51,8 @@ const createBiasAddProgramInfo = (inputs: readonly TensorView[]): ProgramInfo => return { name: 'BiasAdd', - inputTypes: Array(inputs.length).fill(GpuDataType.default), getRunData: () => ({ - outputs: [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputs[0].dataType}], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)} }), getShaderSource, diff --git a/js/web/lib/wasm/jsep/webgpu/ops/bias-split-gelu.ts b/js/web/lib/wasm/jsep/webgpu/ops/bias-split-gelu.ts index fc171367a7071..14eefc344f3c0 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/bias-split-gelu.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/bias-split-gelu.ts @@ -3,7 +3,7 @@ import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {inputVariable, outputVariable, ShaderHelper} from './common'; import {erfImpl} from './unary-op'; @@ -58,9 +58,8 @@ const createBiasSplitGeluProgramInfo = (inputs: readonly TensorView[]): ProgramI return { name: 'BiasSplitGelu', - inputTypes: [GpuDataType.default, GpuDataType.default], getRunData: () => ({ - outputs: [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputs[0].dataType}], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)} }), getShaderSource, diff --git a/js/web/lib/wasm/jsep/webgpu/ops/binary-op.ts b/js/web/lib/wasm/jsep/webgpu/ops/binary-op.ts index e57b8869f395d..eab571e87f5f5 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/binary-op.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/binary-op.ts @@ -4,7 +4,7 @@ import {DataType} from '../../../wasm-common'; import {TensorView} from '../../tensor-view'; import {BroadcastUtil, ShapeUtil} from '../../util'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {inputVariable, outputVariable, ShaderHelper} from './common'; @@ -175,13 +175,12 @@ const createBinaryOpProgramInfo = return { name, - inputTypes: [GpuDataType.default, GpuDataType.default], shaderCache: {hint: cacheKey}, getShaderSource: (shaderHelper) => createBinaryOpProgramShader( shaderHelper, a.dims, b.dims, outputShape, vectorize, isBroadcast, funcCall, a.dataType, b.dataType, outputDataType, additionalImplementation), getRunData: () => ({ - outputs: [{dims: outputShape, dataType: outputDataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: outputDataType}], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */ / 4 /* component size */)} }), }; diff --git a/js/web/lib/wasm/jsep/webgpu/ops/common.ts b/js/web/lib/wasm/jsep/webgpu/ops/common.ts index 4354543aea713..55ef9b3366abb 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/common.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/common.ts @@ -3,7 +3,7 @@ import {DataType} from '../../../wasm-common'; import {ShapeUtil} from '../../util'; -import {ProgramVariable} from '../types'; +import {ProgramUniform} from '../types'; /** * constant value for a workgroup size. @@ -259,7 +259,7 @@ export const tensorTypeToWsglValueType = (type: DataType, components: 1|2|3|4 = }; export const createTensorShapeVariables = (dims: readonly number[]): - ProgramVariable[] => [{type: 'uint32', data: dims}, {type: 'uint32', data: ShapeUtil.computeStrides(dims)}]; + ProgramUniform[] => [{type: 'uint32', data: dims}, {type: 'uint32', data: ShapeUtil.computeStrides(dims)}]; /** * A helper function to get a IndicesHelper for a given input or output. diff --git a/js/web/lib/wasm/jsep/webgpu/ops/concat.ts b/js/web/lib/wasm/jsep/webgpu/ops/concat.ts index 1b0505277b73c..4b5ca869f0dfb 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/concat.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/concat.ts @@ -4,7 +4,7 @@ import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {IndicesHelper, inputVariable, outputVariable, ShaderHelper} from './common'; @@ -122,10 +122,9 @@ const createConcatProgramInfo = (inputs: readonly TensorView[], axis: number): P }`; return { name: 'Concat', - inputTypes: Array(inputs.length).fill(GpuDataType.default), shaderCache: {hint: `${axis}`}, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputs[0].dataType}], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)} }), getShaderSource, diff --git a/js/web/lib/wasm/jsep/webgpu/ops/conv-grouped.ts b/js/web/lib/wasm/jsep/webgpu/ops/conv-grouped.ts index 21a15e82c2750..7abf022928ade 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/conv-grouped.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/conv-grouped.ts @@ -3,7 +3,7 @@ import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; -import {GpuDataType, ProgramInfo} from '../types'; +import {ProgramInfo} from '../types'; import {inputVariable, outputVariable, ShaderHelper} from './common'; import {calculateOutputShape, ConvAttributes} from './conv'; @@ -85,14 +85,11 @@ export const createGroupedConvProgramInfo = }`; return { name: 'GroupedConv', - inputTypes: hasBias ? [GpuDataType.default, GpuDataType.default, GpuDataType.default] : - [GpuDataType.default, GpuDataType.default], shaderCache: {hint: attributes.cacheKey}, getRunData: () => ({ outputs: [{ dims: squeezeOutputShapeFunction ? squeezeOutputShapeFunction(outputShape) : outputShape, - dataType: inputs[0].dataType, - gpuDataType: GpuDataType.default + dataType: inputs[0].dataType }], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)}, }), diff --git a/js/web/lib/wasm/jsep/webgpu/ops/einsum.ts b/js/web/lib/wasm/jsep/webgpu/ops/einsum.ts index c54ead10ec08f..357eb5c0b84ad 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/einsum.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/einsum.ts @@ -4,7 +4,7 @@ import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {IndicesHelper, inputVariable, outputVariable, ShaderHelper} from './common'; @@ -260,10 +260,9 @@ const createEinsumProgramInfo = (inputs: readonly TensorView[], einsumEquation: }`; return { name: 'Einsum', - inputTypes: Array(inputs.length).fill(GpuDataType.default), shaderCache: {hint: einsumEquation.equation}, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputs[0].dataType}], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)} }), getShaderSource, diff --git a/js/web/lib/wasm/jsep/webgpu/ops/expand.ts b/js/web/lib/wasm/jsep/webgpu/ops/expand.ts index 0e76501795ed2..5680af4787b6a 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/expand.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/expand.ts @@ -3,7 +3,7 @@ import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {inputVariable, outputVariable, ShaderHelper} from './common'; @@ -70,11 +70,10 @@ const createExpandProgramInfo = (inputs: readonly TensorView[]): ProgramInfo => }`; return { name: 'Expand', - inputTypes: [GpuDataType.default], shaderCache: {hint: `${outputShape}`}, getShaderSource, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputs[0].dataType}], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)} }) }; diff --git a/js/web/lib/wasm/jsep/webgpu/ops/gather-elements.ts b/js/web/lib/wasm/jsep/webgpu/ops/gather-elements.ts index aef45dd70e31e..9924a50e2ae6f 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/gather-elements.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/gather-elements.ts @@ -4,7 +4,7 @@ import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {inputVariable, outputVariable, ShaderHelper} from './common'; @@ -87,10 +87,9 @@ const createGatherElementsProgramInfo = return { name: 'GatherElements', - inputTypes: [GpuDataType.default, GpuDataType.default], shaderCache: {hint: attributes.cacheKey}, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputs[0].dataType}], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)} }), getShaderSource, diff --git a/js/web/lib/wasm/jsep/webgpu/ops/gather.ts b/js/web/lib/wasm/jsep/webgpu/ops/gather.ts index 561b9f9cca2b7..fdcd64abfe4e7 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/gather.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/gather.ts @@ -4,7 +4,7 @@ import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {inputVariable, outputVariable, ShaderHelper} from './common'; @@ -72,11 +72,10 @@ const createGatherProgramInfo = (inputs: readonly TensorView[], attributes: Gath }`; return { name: 'Gather', - inputTypes: [GpuDataType.default, GpuDataType.default], shaderCache: {hint: attributes.cacheKey}, getRunData: () => ({ outputs: [ - {dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}, + {dims: outputShape, dataType: inputs[0].dataType}, ], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)} }), diff --git a/js/web/lib/wasm/jsep/webgpu/ops/gemm.ts b/js/web/lib/wasm/jsep/webgpu/ops/gemm.ts index 9ec84333b426a..6e9dee41ce488 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/gemm.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/gemm.ts @@ -4,7 +4,7 @@ import {TensorView} from '../../tensor-view'; import {GemmUtil, ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {ShaderHelper, tensorTypeToWsglStorageType} from './common'; @@ -112,11 +112,9 @@ const createGemmProgramInfo = (inputs: readonly TensorView[], attributes: GemmAt }`; return { name: 'Gemm', - inputTypes: inputs.length === 3 ? [GpuDataType.default, GpuDataType.default, GpuDataType.default] : - [GpuDataType.default, GpuDataType.default], shaderCache: {hint: attributes.cacheKey}, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputs[0].dataType}], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)} }), getShaderSource, diff --git a/js/web/lib/wasm/jsep/webgpu/ops/instance-norm.ts b/js/web/lib/wasm/jsep/webgpu/ops/instance-norm.ts index d55aa835464ba..0c39152f56dad 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/instance-norm.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/instance-norm.ts @@ -4,7 +4,7 @@ import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {inputVariable, outputVariable, ShaderHelper, tensorTypeToWsglStorageType} from './common'; @@ -14,8 +14,7 @@ export interface InstanceNormAttributes extends AttributeWithCacheKey { } const metadata = { - name: 'InstanceNormalization', - inputTypes: [GpuDataType.default, GpuDataType.default, GpuDataType.default], + name: 'InstanceNormalization' }; const createInstanceNormProgramInfo = @@ -104,7 +103,7 @@ const createInstanceNormProgramInfo = shaderCache: {hint: attributes.cacheKey}, getRunData: () => ({ outputs: [ - {dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}, + {dims: outputShape, dataType: inputs[0].dataType}, ], dispatchGroup: {x: normCount} }), @@ -169,7 +168,7 @@ const createInstanceNormNHWCProgramInfo = shaderCache: {hint: attributes.cacheKey}, getRunData: () => ({ outputs: [ - {dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}, + {dims: outputShape, dataType: inputs[0].dataType}, ], dispatchGroup: {x: Math.ceil(normCount / 64 /* workgroup size */)} }), diff --git a/js/web/lib/wasm/jsep/webgpu/ops/layer-norm.ts b/js/web/lib/wasm/jsep/webgpu/ops/layer-norm.ts index 3fdf935b99b30..186a9999e53f2 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/layer-norm.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/layer-norm.ts @@ -5,7 +5,7 @@ import {DataType} from '../../../wasm-common'; import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {ShaderHelper, tensorTypeToWsglStorageType} from './common'; @@ -96,22 +96,20 @@ const createLayerNormProgramInfo = ${hasMeanDataOutput ? 'meanDataOutput[global_idx] = mean' : ''}; ${hasInvStdOutput ? 'invStdOutput[global_idx] = 1 / meanSquare' : ''}; }`; - const outputs = [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}]; + const outputs = [{dims: outputShape, dataType: inputs[0].dataType}]; if (hasMeanDataOutput) { outputs.push( - {dims: meanInvStdDevDim, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}, + {dims: meanInvStdDevDim, dataType: inputs[0].dataType}, ); } if (hasInvStdOutput) { outputs.push( - {dims: meanInvStdDevDim, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}, + {dims: meanInvStdDevDim, dataType: inputs[0].dataType}, ); } return { name: 'LayerNormalization', - inputTypes: inputs.length === 2 ? [GpuDataType.default, GpuDataType.default] : - [GpuDataType.default, GpuDataType.default, GpuDataType.default], shaderCache: {hint: `${attributes.cacheKey}|${outputCount}|${inputs.length}`}, getRunData: () => ({outputs, dispatchGroup: {x: Math.ceil(normCount / 64 /* workgroup size */)}}), getShaderSource, diff --git a/js/web/lib/wasm/jsep/webgpu/ops/pad.ts b/js/web/lib/wasm/jsep/webgpu/ops/pad.ts index 021ae9a896ce6..180dab92a453a 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/pad.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/pad.ts @@ -5,7 +5,7 @@ import {DataType} from '../../../wasm-common'; import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {IndicesHelper, inputVariable, outputVariable, ShaderHelper} from './common'; @@ -198,10 +198,9 @@ const createPadProgramInfo = (inputs: readonly TensorView[], attributes: PadAttr const outputShape = ShapeUtil.padShape(inputs[0].dims.slice(), attributes.pads); return { name: 'Pad', - inputTypes: [GpuDataType.default], shaderCache: {hint: attributes.cacheKey}, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputs[0].dataType}], dispatchGroup: {x: Math.ceil(ShapeUtil.size(outputShape) / 64 /* workgroup size */)} }), getShaderSource: shaderHelper => generatePadCode(shaderHelper, inputs, attributes, 'f32'), diff --git a/js/web/lib/wasm/jsep/webgpu/ops/pool.ts b/js/web/lib/wasm/jsep/webgpu/ops/pool.ts index c81afa47a5e23..05f02b07c4d89 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/pool.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/pool.ts @@ -4,7 +4,7 @@ import {TensorView} from '../../tensor-view'; import {PoolConvUtil, ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {IndicesHelper, inputVariable, outputVariable, ShaderHelper} from './common'; @@ -254,10 +254,9 @@ const createAveragePoolProgramInfo = } return { name, - inputTypes: [GpuDataType.default], shaderCache: {hint: attributes.cacheKey}, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: input.dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: input.dataType}], dispatchGroup: {x: Math.ceil(ShapeUtil.size(outputShape) / 64 /* workgroup size */)} }), getShaderSource: shaderHelper => @@ -320,10 +319,9 @@ const createMaxPoolProgramInfo = const x = inputVariable('x', input.dataType, input.dims); return { name, - inputTypes: [GpuDataType.default], shaderCache: {hint: attributes.cacheKey}, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: input.dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: input.dataType}], dispatchGroup: {x: Math.ceil(ShapeUtil.size(outputShape) / 64 /* workgroup size */)} }), getShaderSource: shaderHelper => diff --git a/js/web/lib/wasm/jsep/webgpu/ops/range.ts b/js/web/lib/wasm/jsep/webgpu/ops/range.ts index b857e6380c7c9..9cf66111bf707 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/range.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/range.ts @@ -4,7 +4,7 @@ import {env} from 'onnxruntime-common'; import {DataType} from '../../../wasm-common'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {outputVariable, ShaderHelper} from './common'; @@ -34,13 +34,11 @@ const createRangeProgramInfo = (start: number, limit: number, delta: number, dat }`; return { name: 'Range', - inputTypes: [], shaderCache: {hint: [start, limit, delta].map(x => x.toString()).join('_')}, getShaderSource, - getRunData: () => ({ - outputs: [{dims: outputShape, dataType, gpuDataType: GpuDataType.default}], - dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)} - }) + getRunData: () => ( + {outputs: [{dims: outputShape, dataType}], + dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)}}) }; }; diff --git a/js/web/lib/wasm/jsep/webgpu/ops/reduce.ts b/js/web/lib/wasm/jsep/webgpu/ops/reduce.ts index 0003ccfb4f32d..44d6332852d2a 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/reduce.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/reduce.ts @@ -5,7 +5,7 @@ import {DataType} from '../../../wasm-common'; import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo, ProgramShaderCacheInfo} from '../types'; +import {ComputeContext, ProgramInfo, ProgramShaderCacheInfo} from '../types'; import {IndicesHelper, inputVariable, outputVariable, ShaderHelper} from './common'; @@ -97,11 +97,10 @@ export const createReduceProgramInfo = return { name, - inputTypes: [GpuDataType.default], shaderCache, getShaderSource, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: outputDataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: outputDataType}], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)} }), }; diff --git a/js/web/lib/wasm/jsep/webgpu/ops/resize.ts b/js/web/lib/wasm/jsep/webgpu/ops/resize.ts index 00474645b2d2c..fed1dbcf51e9b 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/resize.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/resize.ts @@ -5,7 +5,7 @@ import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {IndicesHelper, inputVariable, outputVariable, ShaderHelper} from './common'; @@ -513,14 +513,13 @@ const createResizeProgramInfo = return { name: 'Resize', - inputTypes: [GpuDataType.default], shaderCache: { hint: `${attributes.cacheKey}|${opsetVersion}|${scales.length > 0 ? scales : ''}|${ sizes.length > 0 ? sizes : ''}` }, getShaderSource, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: inputTensor.dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputTensor.dataType}], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)} }) }; diff --git a/js/web/lib/wasm/jsep/webgpu/ops/skip-layer-norm.ts b/js/web/lib/wasm/jsep/webgpu/ops/skip-layer-norm.ts index b4478a33d391b..75e6a84cd6fcd 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/skip-layer-norm.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/skip-layer-norm.ts @@ -5,7 +5,7 @@ import {DataType} from '../../../wasm-common'; import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {ShaderHelper, tensorTypeToWsglStorageType} from './common'; @@ -135,20 +135,19 @@ const createSkipLayerNormProgramInfo = output[offset + i] = (output[offset + i] - mean) / variance * gamma[i] + ${hasBetaInput ? 'beta[i]' : '0.0'}; } }`; - const outputs = [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}]; + const outputs = [{dims: outputShape, dataType: inputs[0].dataType}]; if (outputCount > 1) { - outputs.push({dims: meanInvStdDevDim, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}); + outputs.push({dims: meanInvStdDevDim, dataType: inputs[0].dataType}); } if (outputCount > 2) { - outputs.push({dims: meanInvStdDevDim, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}); + outputs.push({dims: meanInvStdDevDim, dataType: inputs[0].dataType}); } if (outputCount > 3) { - outputs.push({dims: inputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}); + outputs.push({dims: inputShape, dataType: inputs[0].dataType}); } return { name: 'SkipLayerNormalization', - inputTypes: new Array(inputs.length).fill(GpuDataType.default), shaderCache: {hint: attributes.cacheKey}, getShaderSource, getRunData: () => ({outputs, dispatchGroup: {x: Math.ceil(outputSize / hiddenSize / 64)}}), diff --git a/js/web/lib/wasm/jsep/webgpu/ops/slice.ts b/js/web/lib/wasm/jsep/webgpu/ops/slice.ts index 06d960525d05a..d607351f69b74 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/slice.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/slice.ts @@ -5,7 +5,7 @@ import {DataType} from '../../../wasm-common'; import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo, TensorInfo} from '../types'; +import {ComputeContext, ProgramInfo, TensorInfo} from '../types'; import {IndicesHelper, inputVariable, outputVariable, ShaderHelper} from './common'; @@ -137,8 +137,7 @@ const createSliceProgramInfo = (inputs: readonly TensorView[], attributes: Slice outputShape[axis] = Math.ceil((ends[axis] - starts[axis]) / steps[axis]); }); - const outputTensorInfo: - TensorInfo = {dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}; + const outputTensorInfo: TensorInfo = {dims: outputShape, dataType: inputs[0].dataType}; const output = outputVariable('output', inputs[0].dataType, outputShape); const input = inputVariable('input', inputs[0].dataType, inputShape); @@ -161,7 +160,6 @@ const createSliceProgramInfo = (inputs: readonly TensorView[], attributes: Slice }`; return { name: 'Slice', - inputTypes: [GpuDataType.default], shaderCache: {hint: `${attributes.cacheKey}|${inputs[4]?.dims ?? ''}`}, getShaderSource, getRunData: () => ({ diff --git a/js/web/lib/wasm/jsep/webgpu/ops/softmax.ts b/js/web/lib/wasm/jsep/webgpu/ops/softmax.ts index 8d53e3311fa74..d4dbad79e613e 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/softmax.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/softmax.ts @@ -8,7 +8,7 @@ import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {ShaderHelper, tensorTypeToWsglStorageType} from './common'; @@ -119,11 +119,7 @@ const createSoftmaxProgramInfo = (input: TensorView, attributes: SoftmaxAttribut }`; return { name: 'Softmax', - inputTypes: [GpuDataType.default], - getRunData: () => ({ - outputs: [{dims: shape, dataType: input.dataType, gpuDataType: GpuDataType.default}], - dispatchGroup: {x: rows} - }), + getRunData: () => ({outputs: [{dims: shape, dataType: input.dataType}], dispatchGroup: {x: rows}}), getShaderSource, }; }; diff --git a/js/web/lib/wasm/jsep/webgpu/ops/split.ts b/js/web/lib/wasm/jsep/webgpu/ops/split.ts index 7c3d16ba896bc..fd60d81b87ae1 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/split.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/split.ts @@ -4,7 +4,7 @@ import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo, TensorInfo} from '../types'; +import {ComputeContext, ProgramInfo, TensorInfo} from '../types'; import {IndicesHelper, inputVariable, outputVariable, ShaderHelper} from './common'; @@ -81,7 +81,7 @@ const createSplitProgramInfo = (inputs: readonly TensorView[], attributes: Split outputShape[attributes.axis] = attributes.splitSizes[i]; outputShapes.push(outputShape); outputs[i] = outputVariable(`output${i}`, dataType, outputShapes[i]); - outputsTensorInfo.push({dims: outputShapes[i], dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}); + outputsTensorInfo.push({dims: outputShapes[i], dataType: inputs[0].dataType}); } const indicesAxis = rank < 2 ? 'indices' : `indices[${adjustedAxis}]`; const getShaderSource = (shaderHelper: ShaderHelper) => ` @@ -102,7 +102,6 @@ const createSplitProgramInfo = (inputs: readonly TensorView[], attributes: Split }`; return { name: 'Split', - inputTypes: [GpuDataType.default], shaderCache: {hint: attributes.cacheKey}, getShaderSource, getRunData: () => ({ diff --git a/js/web/lib/wasm/jsep/webgpu/ops/tile.ts b/js/web/lib/wasm/jsep/webgpu/ops/tile.ts index a9f3b4e7812da..e294541a775ca 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/tile.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/tile.ts @@ -4,7 +4,7 @@ import {DataType} from '../../../wasm-common'; import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {inputVariable, outputVariable, ShaderHelper} from './common'; @@ -74,10 +74,9 @@ export const createTileProgramInfo = (inputs: readonly TensorView[]): ProgramInf return { name: 'Tile', - inputTypes: [GpuDataType.default], shaderCache: {hint: `${repeats}`}, getRunData: () => ({ - outputs: [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputs[0].dataType}], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)}, }), getShaderSource, diff --git a/js/web/lib/wasm/jsep/webgpu/ops/transpose.ts b/js/web/lib/wasm/jsep/webgpu/ops/transpose.ts index e436b4bbb380d..fe556a7fd8552 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/transpose.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/transpose.ts @@ -4,7 +4,7 @@ import {TensorView} from '../../tensor-view'; import {ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {createTensorShapeVariables, IndicesHelper, inputVariable, outputVariable, ShaderHelper} from './common'; @@ -56,15 +56,14 @@ export const createTransposeProgramInfo = }`; return { name: 'Transpose', - inputTypes: [GpuDataType.default], shaderCache: {hint: `${permAttr}`, inputDependencies: ['rank']}, getRunData: (inputs) => { const outputShape = getOutputShape(inputs[0].dims, perm); const outputSize = ShapeUtil.size(outputShape); return { - outputs: [{dims: outputShape, dataType: inputs[0].dataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: inputs[0].dataType}], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */)}, - variables: [ + programUniforms: [ {type: 'uint32', data: outputSize}, ...createTensorShapeVariables(inputs[0].dims), ...createTensorShapeVariables(outputShape), diff --git a/js/web/lib/wasm/jsep/webgpu/ops/unary-op.ts b/js/web/lib/wasm/jsep/webgpu/ops/unary-op.ts index dedf8ffdf6e74..bead3e72f63c7 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/unary-op.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/unary-op.ts @@ -5,7 +5,7 @@ import {DataType} from '../../../wasm-common'; import {TensorView} from '../../tensor-view'; import {MAX_CLIP, MIN_CLIP, ShapeUtil} from '../../util'; import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../attribute-with-cache-key'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {inputVariable, outputVariable, ShaderHelper, tensorTypeToWsglStorageType} from './common'; @@ -45,12 +45,11 @@ const createElementwiseProgramInfo = (input: TensorView, name: string, funcCall: ElementwiseFunctionCall, additionalImplementation?: string, cacheKey?: string, outputDataType: number = input.dataType): ProgramInfo => ({ name, - inputTypes: [GpuDataType.default], shaderCache: {hint: cacheKey}, getShaderSource: shaderHelper => createElementwiseProgramShader( shaderHelper, ShapeUtil.size(input.dims), input.dataType, outputDataType, funcCall, additionalImplementation), getRunData: (inputTensors) => ({ - outputs: [{dims: input.dims, dataType: outputDataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: input.dims, dataType: outputDataType}], dispatchGroup: {x: Math.ceil(ShapeUtil.size(inputTensors[0].dims) / 64 /* workgroup size */ / 4 /* vec size */)} }) diff --git a/js/web/lib/wasm/jsep/webgpu/ops/where.ts b/js/web/lib/wasm/jsep/webgpu/ops/where.ts index d481a1636f3a3..6f66dd86b4088 100644 --- a/js/web/lib/wasm/jsep/webgpu/ops/where.ts +++ b/js/web/lib/wasm/jsep/webgpu/ops/where.ts @@ -4,7 +4,7 @@ import {DataType} from '../../../wasm-common'; import {TensorView} from '../../tensor-view'; import {BroadcastUtil, ShapeUtil} from '../../util'; -import {ComputeContext, GpuDataType, ProgramInfo} from '../types'; +import {ComputeContext, ProgramInfo} from '../types'; import {inputVariable, outputVariable, ShaderHelper} from './common'; @@ -92,11 +92,10 @@ const createWhereOpProgramInfo = (inputs: readonly TensorView[]): ProgramInfo => return { name: 'Where', - inputTypes: [GpuDataType.default, GpuDataType.default, GpuDataType.default], getShaderSource: (shaderHelper) => createWhereOpProgramShader(shaderHelper, inputs, outputShape, isBroadcast, outputDataType), getRunData: () => ({ - outputs: [{dims: outputShape, dataType: outputDataType, gpuDataType: GpuDataType.default}], + outputs: [{dims: outputShape, dataType: outputDataType}], dispatchGroup: {x: Math.ceil(outputSize / 64 /* workgroup size */ / 4 /* vec size */)} }), }; diff --git a/js/web/lib/wasm/jsep/webgpu/types.ts b/js/web/lib/wasm/jsep/webgpu/types.ts index 032bb723a6332..23fa33a9bba8f 100644 --- a/js/web/lib/wasm/jsep/webgpu/types.ts +++ b/js/web/lib/wasm/jsep/webgpu/types.ts @@ -21,11 +21,10 @@ export interface GpuData { export interface TensorInfo { dims: readonly number[]; dataType: number; - gpuDataType: GpuDataType; } -export interface ProgramVariable { +export interface ProgramUniform { type: 'int32'|'float32'|'uint32'; data: number|readonly number[]; } @@ -88,11 +87,6 @@ export interface ProgramInfo { */ name: string; - /** - * gpu data types for each input - */ - inputTypes: GpuDataType[]; - /** * an optional object describing the cache information of the program shader. * @@ -115,7 +109,7 @@ export interface ProgramInfo { getRunData: (inputs: readonly TensorView[]) => { outputs: readonly TensorInfo[]; dispatchGroup: {x: number; y?: number; z?: number}; - variables?: readonly ProgramVariable[]; + programUniforms?: readonly ProgramUniform[]; }; }