| 25 | } |
| 26 | |
| 27 | export interface WebGPUProgram { |
| 28 | // Whether to use atomic built-in functions. |
| 29 | atomic?: boolean; |
| 30 | // dispatch specifies geometry of thread groups - derived from dispatchLayout. |
| 31 | dispatch: [number, number, number]; |
| 32 | // dispatchLayout enumerates how tensor dimensions are distributed among |
| 33 | // dispatch x,y,z dimensions. |
| 34 | dispatchLayout: {x: number[], y?: number[], z?: number[]}; |
| 35 | // By default, the output data component is 1. |
| 36 | outputComponent?: number; |
| 37 | outputShape: number[]; |
| 38 | pixelsOpType?: PixelsOpType; |
| 39 | // The unique key to distinguish different shader source code. |
| 40 | shaderKey: string; |
| 41 | // Whether to use output size for bounds checking. |
| 42 | size?: boolean; |
| 43 | uniforms?: string; |
| 44 | variableNames: string[]; |
| 45 | // Describe each variable's component and must have one-one mapping with |
| 46 | // variableNames. If not set, all variables component will be same with output |
| 47 | // component member. |
| 48 | variableComponents?: number[]; |
| 49 | // workgroupSize.x * workgroupSize.y * workgroupSize.z = the number of threads |
| 50 | // in a thread group. Individual dimensions determines thread layout within |
| 51 | // the group. |
| 52 | workgroupSize: [number, number, number]; |
| 53 | // Size of register cache in one dimension (assumes square cache). |
| 54 | // Each thread writes to workPerThread * workPerThread locations in the output |
| 55 | // buffer. |
| 56 | workPerThread?: number; |
| 57 | pipeline?: GPUComputePipeline|Promise<GPUComputePipeline>; |
| 58 | getUserCode: () => string; |
| 59 | } |
| 60 | |
| 61 | export const compileProgram = |
| 62 | (device: GPUDevice, program: WebGPUProgram, inputsData: InputInfo[], |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…