sync 4385228f788d
Browse filesFiles changed (6)
55 unmodified lines565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210355 unmodified linesOne implementation is selected per call from the device capabilities, the request shapes and the dtypes; these notes say what each one covers.- `dp4a_pointwise_1x1_tail` — Exact tiled pointwise convolution for one or two spatial dimensions. Native packed dots or exact integer-vector dots share zero-point specialization; tile resources and dispatch eligibility follow device limits.- `dp4a_pointwise_1x1_tail_x_zero_point_only` — Exact tiled pointwise convolution for one or two spatial dimensions. Native packed dots or exact integer-vector dots share zero-point specialization; tile resources and dispatch eligibility follow device limits.- `dp4a_pointwise_1x1_tail_w_zero_point_only` — Exact tiled pointwise convolution for one or two spatial dimensions. Native packed dots or exact integer-vector dots share zero-point specialization; tile resources and dispatch eligibility follow device limits.- `dp4a_pointwise_1x1_tail_no_zero_points` — Exact tiled pointwise convolution for one or two spatial dimensions. Native packed dots or exact integer-vector dots share zero-point specialization; tile resources and dispatch eligibility follow device limits.- `dp4a_pointwise_1x1` — Exact tiled pointwise convolution for one or two spatial dimensions. Native packed dots or exact integer-vector dots share zero-point specialization; tile resources and dispatch eligibility follow device limits.- `dp4a_pointwise_1x1_x_zero_point_only` — Exact tiled pointwise convolution for one or two spatial dimensions. Native packed dots or exact integer-vector dots share zero-point specialization; tile resources and dispatch eligibility follow device limits.- `dp4a_pointwise_1x1_w_zero_point_only` — Exact tiled pointwise convolution for one or two spatial dimensions. Native packed dots or exact integer-vector dots share zero-point specialization; tile resources and dispatch eligibility follow device limits.- `dp4a_pointwise_1x1_no_zero_points` — Exact tiled pointwise convolution for one or two spatial dimensions. Native packed dots or exact integer-vector dots share zero-point specialization; tile resources and dispatch eligibility follow device limits.- `dp4a_pointwise_1x1_tail_per_channel` — Exact tiled pointwise convolution for one or two spatial dimensions. Native packed dots or exact integer-vector dots share zero-point specialization; tile resources and dispatch eligibility follow device limits.- `dp4a_pointwise_1x1_tail_per_channel_w_zero_point_only` — Exact tiled pointwise convolution for one or two spatial dimensions. Native packed dots or exact integer-vector dots share zero-point specialization; tile resources and dispatch eligibility follow device limits.- `dp4a_pointwise_1x1_per_channel` — Exact tiled pointwise convolution for one or two spatial dimensions. Native packed dots or exact integer-vector dots share zero-point specialization; tile resources and dispatch eligibility follow device limits.- `dp4a_pointwise_1x1_per_channel_w_zero_point_only` — Exact tiled pointwise convolution for one or two spatial dimensions. Native packed dots or exact integer-vector dots share zero-point specialization; tile resources and dispatch eligibility follow device limits.## Files- [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, per-variant templates, provenance)- [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)- [`test.json`](build/webgpu/test.json) — correctness cases- [`bench.json`](build/webgpu/bench.json) — benchmark cases- [`conv-int-accumulate-spatial.wgsl.jinja`](build/webgpu/conv-int-accumulate-spatial.wgsl.jinja)- [`conv-int-im2col-spatial.wgsl.jinja`](build/webgpu/conv-int-im2col-spatial.wgsl.jinja)- [`quant-dp4a-matmul.wgsl.jinja`](build/webgpu/quant-dp4a-matmul.wgsl.jinja)## Use with `@huggingface/kernels````shnpm install --save-exact @huggingface/kernels@0.0.1-preview.3```Required output shapes and logical data types are inferred from the supplied inputs and attributes; result tensors are allocated automatically.The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.It follows the `v1` branch as fixes land. To pin exact artifact bytes, pass a 40-character commit `revision` instead of `version`.Replace each `*Data` placeholder with a typed array containing the corresponding input data.```jsimport { getKernel } from "@huggingface/kernels";const kernel = await getKernel("webgpu-kernels/ai.onnx.ConvInteger", { version: 1 });const { y } = await kernel({x: { data: xData, shape: [1, 1, 2, 1, 1] },w: { data: wData, shape: [1, 1, 1, 1, 1] },});```55 unmodified lines5657585960616263646566676869707172737475767778798081828384858687888990919293949596979855 unmodified linesOne implementation is selected per call from the device capabilities, the request shapes and the dtypes; these notes say what each one covers.- `dp4a_im2col_scalar_zero_points` — Materializes widened int8 im2col columns for an ungrouped 2D or 3D convolution with scalar zero points, then multiplies them with packed DP4A dots.- `dp4a_pointwise_1x1`, `dp4a_pointwise_1x1_per_channel` — Exact tiled pointwise convolution for one or two spatial dimensions. Native packed dots or exact integer-vector dots share zero-point specialization; tile and dispatch sizes stay within device limits.## Files- [`metadata.json`](https://huggingface.co/kernels/webgpu-kernels/ai.onnx.ConvInteger/blob/v1/build/webgpu/metadata.json) — kernel metadata (id, file digests, manifest spec, provenance)- [`manifest.json`](https://huggingface.co/kernels/webgpu-kernels/ai.onnx.ConvInteger/blob/v1/build/webgpu/manifest.json) — the op contract (source of truth)- [`test.json`](https://huggingface.co/kernels/webgpu-kernels/ai.onnx.ConvInteger/blob/v1/build/webgpu/test.json) — correctness cases- [`bench.json`](https://huggingface.co/kernels/webgpu-kernels/ai.onnx.ConvInteger/blob/v1/build/webgpu/bench.json) — benchmark cases- [`conv-int-accumulate-spatial.wgsl.jinja`](https://huggingface.co/kernels/webgpu-kernels/ai.onnx.ConvInteger/blob/v1/build/webgpu/conv-int-accumulate-spatial.wgsl.jinja)- [`conv-int-im2col-spatial.wgsl.jinja`](https://huggingface.co/kernels/webgpu-kernels/ai.onnx.ConvInteger/blob/v1/build/webgpu/conv-int-im2col-spatial.wgsl.jinja)- [`quant-dp4a-matmul.wgsl.jinja`](https://huggingface.co/kernels/webgpu-kernels/ai.onnx.ConvInteger/blob/v1/build/webgpu/quant-dp4a-matmul.wgsl.jinja)## Use with `@huggingface/kernels````shnpm install --save-exact @huggingface/kernels@0.0.1-preview.4```Paste the example into a browser app that resolves npm imports. Serve the app over HTTPS or localhost with WebGPU available.Required output shapes and logical data types are inferred from the supplied inputs and attributes; result tensors are allocated automatically.The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.It follows the `v1` branch as fixes land. To pin exact artifact bytes, pass a 40-character commit `revision` instead of `version`.```jsimport { getKernel } from "@huggingface/kernels";const kernel = await getKernel("webgpu-kernels/ai.onnx.ConvInteger", { version: 1 });const xData = Uint8Array.of(2, 5);const wData = Uint8Array.of(3);const { y } = await kernel({x: { data: xData, shape: [1, 1, 2, 1, 1] },w: { data: wData, shape: [1, 1, 1, 1, 1] },});console.log({ y });```
29 unmodified lines303132333435363738394041424344454647484911 unmodified lines6162636465666729 unmodified linesreturn 0;{% endif %}}{% endmacro %}{% macro flat_index_2d(workgroupSize, name="i", bound="params.count", guardInline=false) %}{% set wgTerm = workgroupSize ~ "u" if workgroupSize is number else workgroupSize %}// 2D-folded flat index: gid.y carries the high bits past the dispatch's// per-axis workgroup fold width.let {{ name }} = gid.x + gid.y * {{ DISPATCH_FOLD_WIDTH }}u * {{ wgTerm }};if ({{ name }} >= {{ bound }}) { return; }{% endmacro %}{{ env.wgsl.resourceDeclarations }}fn read_x(index: u32) -> i32 {{% if xUnsigned %}return i32(x[index]);{% else %}return x[index];{% endif %}}fn read_w(index: u32) -> i32 {11 unmodified lines@compute @workgroup_size({{ tunables.WORKGROUP_SIZE }})fn main(@builtin(global_invocation_id) gid: vec3<u32>) {{{ flat_index_2d(tunables.WORKGROUP_SIZE, "index", guardInline=true) }}let ow = index % params.outW;var t = index / params.outW;let oh = t % params.outH;29 unmodified lines303132333435363738394041424344454647484950515211 unmodified lines6465666768697029 unmodified linesreturn 0;{% endif %}}{% endmacro %}{% macro flat_index_2d(workgroupSize, name="i", bound="params.count") %}{% set wgTerm = workgroupSize ~ "u" if workgroupSize is number else workgroupSize %}// 2D-folded flat index: gid.y carries the high bits past the dispatch's// per-axis workgroup fold width.let {{ name }} = gid.x + gid.y * {{ DISPATCH_FOLD_WIDTH }}u * {{ wgTerm }};if ({{ name }} >= {{ bound }}) {return;}{% endmacro %}{{ env.wgsl.resourceDeclarations }}fn read_x(index: u32) -> i32 {{% if xUnsigned %}return i32(x[index]);{% else %}return x[index];{% endif %}}fn read_w(index: u32) -> i32 {11 unmodified lines@compute @workgroup_size({{ tunables.WORKGROUP_SIZE }})fn main(@builtin(global_invocation_id) gid: vec3<u32>) {{{ flat_index_2d(tunables.WORKGROUP_SIZE, "index") }}let ow = index % params.outW;var t = index / params.outW;let oh = t % params.outH;
4 unmodified lines5678910111213144 unmodified lines* Optional extra K rows contain the raw input zero point to align the DP4A* reduction. */{{ env.wgsl.resourceDeclarations }}{% set kernelDSpec = kernelDSpec | default(1) %}{% set strideDSpec = strideDSpec | default(1) %}{% set dilationDSpec = dilationDSpec | default(1) %}{% set padFrontSpec = padFrontSpec | default(0) %}{% macro spatial_constants() %}{% if spatialRankSpec == 3 %}4 unmodified lines56789104 unmodified lines* Optional extra K rows contain the raw input zero point to align the DP4A* reduction. */{{ env.wgsl.resourceDeclarations }}{% macro spatial_constants() %}{% if spatialRankSpec == 3 %}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882{"domain": "ai.onnx","name": "ConvInteger","sinceVersion": 10,"inputs": {"x": { "dtype": "TX" },"w": { "dtype": "TW" },"x_zero_point": { "dtype": "TX", "optional": true },"w_zero_point": { "dtype": "TW", "optional": true }},"outputs": {"y": {"dtype": "TY","rank": "ranks.x","shape": "[dim(shapes.x, 0), dim(shapes.w, 0), expectedOutputWidth] if ranks.x == 3 else ([dim(shapes.x, 0), dim(shapes.w, 0), expectedOutputHeight, expectedOutputWidth] if ranks.x == 4 else [dim(shapes.x, 0), dim(shapes.w, 0), expectedOutputDepth, expectedOutputHeight, expectedOutputWidth])"}},"attributes": {"auto_pad": { "default": "NOTSET" },"group": { "default": 1 },"dilations": {},"kernel_shape": {},"pads": {},"strides": {}},"attributeConstraints": { "auto_pad": { "values": ["NOTSET", "SAME_UPPER", "SAME_LOWER", "VALID"] } },"typeConstraints": { "TX": ["uint8", "int8"], "TW": ["uint8", "int8"], "TY": ["int32"] },"tunables": { "WORKGROUP_SIZE": { "default": 256 } },"derive": {"inputDepth": "dim(shapes.x, 2) if ranks.x == 5 else 1","inputHeight": "dim(shapes.x, 3) if ranks.x == 5 else (dim(shapes.x, 2) if ranks.x == 4 else 1)","inputWidth": "dim(shapes.x, ranks.x - 1) if ranks.x >= 3 else 1","outputDepth": "dim(shapes.y, 2) if ranks.y == 5 else 1","outputHeight": "dim(shapes.y, 3) if ranks.y == 5 else (dim(shapes.y, 2) if ranks.y == 4 else 1)","outputWidth": "dim(shapes.y, ranks.y - 1) if ranks.y >= 3 else 1","kernelDepth": "dim(shapes.w, 2) if ranks.w == 5 else 1","kernelHeight": "dim(shapes.w, 3) if ranks.w == 5 else (dim(shapes.w, 2) if ranks.w == 4 else 1)","kernelWidth": "dim(shapes.w, ranks.w - 1) if ranks.w >= 3 else 1","spatialRank": "ranks.w - 2","kernelShapeLengthOk": "not has(attrs, \"kernel_shape\") or (attrs.kernel_shape | length) == spatialRank","stridesLengthOk": "not has(attrs, \"strides\") or (attrs.strides | length) == spatialRank","dilationsLengthOk": "not has(attrs, \"dilations\") or (attrs.dilations | length) == spatialRank","padsLengthOk": "not has(attrs, \"pads\") or (attrs.pads | length) == 2 * spatialRank","kernelD": "attrs.kernel_shape[0] if kernelShapeLengthOk and has(attrs, \"kernel_shape\") and spatialRank == 3 else 1","kernelH": "attrs.kernel_shape[spatialRank - 2] if kernelShapeLengthOk and has(attrs, \"kernel_shape\") and spatialRank >= 2 else 1","kernelW": "attrs.kernel_shape[spatialRank - 1] if kernelShapeLengthOk and has(attrs, \"kernel_shape\") and spatialRank >= 1 else 1","strideD": "attrs.strides[0] if stridesLengthOk and has(attrs, \"strides\") and spatialRank == 3 else 1","strideH": "attrs.strides[spatialRank - 2] if stridesLengthOk and has(attrs, \"strides\") and spatialRank >= 2 else 1","strideW": "attrs.strides[spatialRank - 1] if stridesLengthOk and has(attrs, \"strides\") and spatialRank >= 1 else 1","dilationD": "attrs.dilations[0] if dilationsLengthOk and has(attrs, \"dilations\") and spatialRank == 3 else 1","dilationH": "attrs.dilations[spatialRank - 2] if dilationsLengthOk and has(attrs, \"dilations\") and spatialRank >= 2 else 1","dilationW": "attrs.dilations[spatialRank - 1] if dilationsLengthOk and has(attrs, \"dilations\") and spatialRank >= 1 else 1","padFront": "attrs.pads[0] if padsLengthOk and has(attrs, \"pads\") and spatialRank == 3 else 0","padTop": "attrs.pads[spatialRank - 2] if padsLengthOk and has(attrs, \"pads\") and spatialRank >= 2 else 0","padLeft": "attrs.pads[spatialRank - 1] if padsLengthOk and has(attrs, \"pads\") and spatialRank >= 1 else 0","padBack": "attrs.pads[spatialRank] if padsLengthOk and has(attrs, \"pads\") and spatialRank == 3 else 0","padBottom": "attrs.pads[2 * spatialRank - 2] if padsLengthOk and has(attrs, \"pads\") and spatialRank >= 2 else 0","padRight": "attrs.pads[2 * spatialRank - 1] if padsLengthOk and has(attrs, \"pads\") and spatialRank >= 1 else 0","autoPadSame": "attrs.auto_pad == \"SAME_UPPER\" or attrs.auto_pad == \"SAME_LOWER\"","autoPadValid": "attrs.auto_pad == \"VALID\"","samePadDepth": "max(0, (outputDepth - 1) * strideD + (kernelDepth - 1) * dilationD + 1 - inputDepth)","samePadHeight": "max(0, (outputHeight - 1) * strideH + (kernelHeight - 1) * dilationH + 1 - inputHeight)","samePadWidth": "max(0, (outputWidth - 1) * strideW + (kernelWidth - 1) * dilationW + 1 - inputWidth)","samePadFront": "floor(samePadDepth / 2) if attrs.auto_pad == \"SAME_UPPER\" else samePadDepth - floor(samePadDepth / 2)","samePadTop": "floor(samePadHeight / 2) if attrs.auto_pad == \"SAME_UPPER\" else samePadHeight - floor(samePadHeight / 2)","samePadLeft": "floor(samePadWidth / 2) if attrs.auto_pad == \"SAME_UPPER\" else samePadWidth - floor(samePadWidth / 2)","effectivePadFront": "samePadFront if autoPadSame else (0 if autoPadValid else padFront)","effectivePadTop": "samePadTop if autoPadSame else (0 if autoPadValid else padTop)","effectivePadLeft": "samePadLeft if autoPadSame else (0 if autoPadValid else padLeft)","expectedOutputDepth": "ceil(inputDepth / strideD) if autoPadSame else floor((inputDepth + (0 if autoPadValid else padFront + padBack) - ((kernelDepth - 1) * dilationD + 1)) / strideD) + 1","expectedOutputHeight": "ceil(inputHeight / strideH) if autoPadSame else floor((inputHeight + (0 if autoPadValid else padTop + padBottom) - ((kernelHeight - 1) * dilationH + 1)) / strideH) + 1","expectedOutputWidth": "ceil(inputWidth / strideW) if autoPadSame else floor((inputWidth + (0 if autoPadValid else padLeft + padRight) - ((kernelWidth - 1) * dilationW + 1)) / strideW) + 1","spatialAttributeLengthsOk": "kernelShapeLengthOk and stridesLengthOk and dilationsLengthOk and padsLengthOk","kernelShapeMatchesWeights": "not has(attrs, \"kernel_shape\") or (kernelW == kernelWidth and (spatialRank < 2 or kernelH == kernelHeight) and (spatialRank < 3 or kernelD == kernelDepth))","kernelExtentsOk": "kernelWidth >= 1 and (spatialRank < 2 or kernelHeight >= 1) and (spatialRank < 3 or kernelDepth >= 1)","stridesValuesOk": "not has(attrs, \"strides\") or (strideD >= 1 and floor(strideD) == strideD and strideH >= 1 and floor(strideH) == strideH and strideW >= 1 and floor(strideW) == strideW)","dilationsValuesOk": "not has(attrs, \"dilations\") or (dilationD >= 1 and floor(dilationD) == dilationD and dilationH >= 1 and floor(dilationH) == dilationH and dilationW >= 1 and floor(dilationW) == dilationW)","padsValuesOk": "padFront >= 0 and floor(padFront) == padFront and padTop >= 0 and floor(padTop) == padTop and padLeft >= 0 and floor(padLeft) == padLeft and padBack >= 0 and floor(padBack) == padBack and padBottom >= 0 and floor(padBottom) == padBottom and padRight >= 0 and floor(padRight) == padRight","explicitPadsOk": "attrs.auto_pad == \"NOTSET\" or not has(attrs, \"pads\")","spatialAttributesOk": "spatialRank >= 1 and spatialRank <= 3 and spatialAttributeLengthsOk and kernelShapeMatchesWeights and kernelExtentsOk and stridesValuesOk and dilationsValuesOk and padsValuesOk and explicitPadsOk","packedFeature": "device.wgslLanguageFeatures.has(\"packed_4x8_integer_dot_product\")","rank4TensorOk": "spatialAttributesOk and (ranks.x == 4 and ranks.w == 4 and ranks.y == 4)","outputBatchChannelsOk": "dim(shapes.y, 0) == dim(shapes.x, 0) and dim(shapes.y, 1) == dim(shapes.w, 0)","groupChannelsOk": "attrs.group >= 1 and dim(shapes.w, 1) * attrs.group == dim(shapes.x, 1) and dim(shapes.w, 0) % attrs.group == 0","output2dShapeOk": "dim(shapes.y, 2) == expectedOutputHeight and dim(shapes.y, 3) == expectedOutputWidth","aScalar": "\"u32\" if tensorDtypes.w == \"uint8\" else \"i32\"","bScalar": "\"u32\" if tensorDtypes.x == \"uint8\" else \"i32\"","wScalar": "\"u32\" if tensorDtypes.w == \"uint8\" else \"i32\"","xScalar": "\"u32\" if tensorDtypes.x == \"uint8\" else \"i32\"","aUnsigned": "tensorDtypes.w == \"uint8\"","bUnsigned": "tensorDtypes.x == \"uint8\"","wUnsigned": "tensorDtypes.w == \"uint8\"","xUnsigned": "tensorDtypes.x == \"uint8\"","bZeroPerColumn": false,"rank5TensorOk": "spatialAttributesOk and (ranks.x == 5 and ranks.w == 5 and ranks.y == 5)","scalarXZeroOk": "ranks.x_zero_point == 0 or (ranks.x_zero_point == 1 and dim(shapes.x_zero_point, 0) == 1)","scalarWZeroOk": "ranks.w_zero_point == 0 or (ranks.w_zero_point == 1 and dim(shapes.w_zero_point, 0) == 1)","scalarXZeroRequiredOk": "present.x_zero_point and scalarXZeroOk","scalarWZeroRequiredOk": "present.w_zero_point and scalarWZeroOk","ungroupedChannelsOk": "attrs.group == 1 and dim(shapes.w, 1) == dim(shapes.x, 1)","output3dShapeOk": "dim(shapes.y, 2) == expectedOutputDepth and dim(shapes.y, 3) == expectedOutputHeight and dim(shapes.y, 4) == expectedOutputWidth","rank3TensorOk": "spatialAttributesOk and (ranks.x == 3 and ranks.w == 3 and ranks.y == 3)","nchwTensorOk": "rank4TensorOk or rank3TensorOk","output1dShapeOk": "dim(shapes.y, 2) == expectedOutputWidth","outputSpatialShapeOk": "output2dShapeOk if rank4TensorOk else output1dShapeOk","zeroPointsOmitted": "not present.x_zero_point and not present.w_zero_point","pointwiseTileM": 8,"pointwiseTileN": 64,"pointwiseKtWords": 32,"pointwiseResourcesOk": "pointwiseTileN <= min(device.limits.maxComputeWorkgroupSizeX, device.limits.maxComputeInvocationsPerWorkgroup) and 4 * pointwiseTileM * (pointwiseKtWords + 1) <= device.limits.maxComputeWorkgroupStorageSize","pointwiseDispatchOk": "ceilDiv(outputHeight * outputWidth, pointwiseTileN) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) and ceilDiv(dim(shapes.w, 0), pointwiseTileM) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) and dim(shapes.y, 0) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535)","aVec4": "\"vec4<u32>\" if tensorDtypes.w == \"uint8\" else \"vec4<i32>\""},"when": ["outputBatchChannelsOk"],"bindings": {"x": { "elementType": "$bScalar" },"x_zero_point": { "elementType": "$bScalar", "length": 1 },"cols": { "scratch": "cols3d", "elementType": "$bScalar" },"params": {"struct": [{ "name": "outCount", "type": "u32", "value": "dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4)" },{ "name": "inChannels", "type": "u32", "value": "dim(shapes.x, 1)" },{ "name": "inD", "type": "u32", "value": "dim(shapes.x, 2)" },{ "name": "inH", "type": "u32", "value": "dim(shapes.x, 3)" },{ "name": "inW", "type": "u32", "value": "dim(shapes.x, 4)" },{"name": "kRows","type": "u32","value": "dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4)"},{ "name": "outH", "type": "u32", "value": "dim(shapes.y, 3)" },{ "name": "outW", "type": "u32", "value": "dim(shapes.y, 4)" }]},"cols_im2col": { "name": "cols", "buffer": "storage", "elementType": "$bScalar" },"params_im2col": {"name": "params","struct": [{ "name": "outCount", "type": "u32", "value": "dim(shapes.y, 2) * dim(shapes.y, 3)" },{ "name": "inChannels", "type": "u32", "value": "dim(shapes.x, 1)" },{ "name": "inH", "type": "u32", "value": "dim(shapes.x, 2)" },{ "name": "inW", "type": "u32", "value": "dim(shapes.x, 3)" },{ "name": "kRows", "type": "u32", "value": "dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3)" },{ "name": "outW", "type": "u32", "value": "dim(shapes.y, 3)" }]},"a": { "arg": "w", "elementType": "$aVec4" },"b": { "scratch": "cols3d", "buffer": "read-only-storage", "elementType": "$bScalar" },"a_zero_point": { "arg": "w_zero_point", "elementType": "$aScalar", "length": 1 },"b_zero_point": { "arg": "x_zero_point", "elementType": "$bScalar", "length": 1 },"y": { "elementType": "i32" },"params_main": {"name": "params","struct": [{ "name": "M", "type": "u32", "value": "dim(shapes.w, 0)" },{ "name": "N", "type": "u32", "value": "dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4)" },{"name": "K","type": "u32","value": "dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4)"},{ "name": "aBatchStride4", "type": "u32", "value": 0 },{"name": "bBatchStride","type": "u32","value": "dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4) * dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4)"},{"name": "yBatchStride","type": "u32","value": "dim(shapes.w, 0) * dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4)"}]},"b_main": { "scratch": "cols", "name": "b", "buffer": "read-only-storage", "elementType": "$bScalar" },"params__uniform": {"name": "params","struct": [{ "name": "M", "type": "u32", "value": "dim(shapes.w, 0)" },{ "name": "N", "type": "u32", "value": "dim(shapes.y, 2) * dim(shapes.y, 3)" },{ "name": "K", "type": "u32", "value": "dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3)" },{ "name": "aBatchStride4", "type": "u32", "value": 0 },{"name": "bBatchStride","type": "u32","value": "(dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3)) * (dim(shapes.y, 2) * dim(shapes.y, 3))"},{ "name": "yBatchStride", "type": "u32", "value": "dim(shapes.w, 0) * dim(shapes.y, 2) * dim(shapes.y, 3)" }]},"a_w": { "arg": "w", "name": "a", "elementType": "$aScalar" },"b_x": { "arg": "x", "name": "b", "elementType": "$bScalar" },"params_quant_dp4a_matmul": {"name": "params","struct": [{ "name": "M", "type": "u32", "value": "dim(shapes.w, 0)" },{ "name": "N", "type": "u32", "value": "outputHeight * outputWidth" },{ "name": "K", "type": "u32", "value": "dim(shapes.x, 1)" },{ "name": "aBatchStride4", "type": "u32", "value": 0 },{ "name": "bBatchStride", "type": "u32", "value": "dim(shapes.x, 1) * inputHeight * inputWidth" },{ "name": "yBatchStride", "type": "u32", "value": "dim(shapes.w, 0) * outputHeight * outputWidth" }]},"x_main": { "name": "x", "elementType": "$xScalar" },"w": { "elementType": "$wScalar" },"x_zero_point_main": { "name": "x_zero_point", "elementType": "$xScalar", "length": 1 },"w_zero_point": { "elementType": "$wScalar" },"params_nchw2d_x_zero_point_only": {"name": "params","struct": [{ "name": "inChannels", "type": "u32", "value": "dim(shapes.x, 1)" },{ "name": "inH", "type": "u32", "value": "inputHeight" },{ "name": "inW", "type": "u32", "value": "inputWidth" },{ "name": "outChannels", "type": "u32", "value": "dim(shapes.w, 0)" },{ "name": "weightInChannels", "type": "u32", "value": "dim(shapes.w, 1)" },{ "name": "inChannelsPerGroup", "type": "u32", "value": "dim(shapes.x, 1) / attrs.group" },{ "name": "outChannelsPerGroup", "type": "u32", "value": "dim(shapes.w, 0) / attrs.group" },{ "name": "kernelH", "type": "u32", "value": "kernelHeight" },{ "name": "kernelW", "type": "u32", "value": "kernelWidth" },{ "name": "outH", "type": "u32", "value": "outputHeight" },{ "name": "outW", "type": "u32", "value": "outputWidth" },{ "name": "strideH", "type": "u32", "value": "strideH" },{ "name": "strideW", "type": "u32", "value": "strideW" },{ "name": "dilationH", "type": "u32", "value": "dilationH" },{ "name": "dilationW", "type": "u32", "value": "dilationW" },{ "name": "padH", "type": "i32", "value": "effectivePadTop" },{ "name": "padW", "type": "i32", "value": "effectivePadLeft" },{ "name": "count", "type": "u32", "value": "numel(shapes.y)" }]},"w_zero_point_main": { "name": "w_zero_point", "elementType": "$wScalar", "length": 1 },"params_ncdhw3d_x_zero_point_only": {"name": "params","struct": [{ "name": "inChannels", "type": "u32", "value": "dim(shapes.x, 1)" },{ "name": "inD", "type": "u32", "value": "dim(shapes.x, 2)" },{ "name": "inH", "type": "u32", "value": "dim(shapes.x, 3)" },{ "name": "inW", "type": "u32", "value": "dim(shapes.x, 4)" },{ "name": "outChannels", "type": "u32", "value": "dim(shapes.w, 0)" },{ "name": "weightInChannels", "type": "u32", "value": "dim(shapes.w, 1)" },{ "name": "inChannelsPerGroup", "type": "u32", "value": "dim(shapes.x, 1) / attrs.group" },{ "name": "outChannelsPerGroup", "type": "u32", "value": "dim(shapes.w, 0) / attrs.group" },{ "name": "kernelD", "type": "u32", "value": "dim(shapes.w, 2)" },{ "name": "kernelH", "type": "u32", "value": "dim(shapes.w, 3)" },{ "name": "kernelW", "type": "u32", "value": "dim(shapes.w, 4)" },{ "name": "outD", "type": "u32", "value": "dim(shapes.y, 2)" },{ "name": "outH", "type": "u32", "value": "dim(shapes.y, 3)" },{ "name": "outW", "type": "u32", "value": "dim(shapes.y, 4)" },{ "name": "strideD", "type": "u32", "value": "strideD" },{ "name": "strideH", "type": "u32", "value": "strideH" },{ "name": "strideW", "type": "u32", "value": "strideW" },{ "name": "dilationD", "type": "u32", "value": "dilationD" },{ "name": "dilationH", "type": "u32", "value": "dilationH" },{ "name": "dilationW", "type": "u32", "value": "dilationW" },{ "name": "padD", "type": "i32", "value": "effectivePadFront" },{ "name": "padH", "type": "i32", "value": "effectivePadTop" },{ "name": "padW", "type": "i32", "value": "effectivePadLeft" },{ "name": "count", "type": "u32", "value": "numel(shapes.y)" }]},"a_zero_point_per_row": { "arg": "w_zero_point", "name": "a_zero_point", "elementType": "$aScalar" }},"variants": [{"id": "dp4a_im2col_ncdhw3d_scalar_zero_points","priority": 20,"when": ["packedFeature", "rank5TensorOk", "scalarXZeroRequiredOk", "scalarWZeroRequiredOk", "ungroupedChannelsOk", "dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4) % 4 == 0", "dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4) >= 32", "dim(shapes.w, 0) >= 8", "dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4) >= 256", "output3dShapeOk", "dim(shapes.x, 0) * dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4) * dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4) * 4 <= device.limits.maxStorageBufferBindingSize", "dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535)", "ceilDiv(dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4), tunables.WORKGROUP_SIZE) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535)", "ceilDiv(dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4), 64) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535)", "ceilDiv(dim(shapes.w, 0), 8) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535)", "dim(shapes.x, 0) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535)"],"derive": {"hasAZero": true,"hasBZero": true,"aPacked": true,"aZeroPerRow": false,"tileM": 8,"tileN": 64,"ktWords": 32,"hasBias": false},"intermediates": [{"id": "cols3d","dtype": "int32","shape": "[dim(shapes.x, 0) * dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4) * dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4)]"}],"passes": [{"id": "im2col","name": "ConvInteger.Im2Col3d","shader": "conv-int-im2col-spatial.wgsl.jinja","derive": {"spatialRankSpec": 3,"kernelDSpec": "dim(shapes.w, 2)","kernelHSpec": "dim(shapes.w, 3)","kernelWSpec": "dim(shapes.w, 4)","strideDSpec": "strideD","strideHSpec": "strideH","strideWSpec": "strideW","dilationDSpec": "dilationD","dilationHSpec": "dilationH","dilationWSpec": "dilationW","padFrontSpec": "effectivePadFront","padTopSpec": "effectivePadTop","padLeftSpec": "effectivePadLeft"},"bindings": ["x", "x_zero_point", "cols", "params"],"dispatch": {"x": "ceil(dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4) / tunables.WORKGROUP_SIZE)","y": "dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4)","z": "dim(shapes.x, 0)"}},{"id": "main","name": "ConvInteger.Im2Col3dDp4a","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a", "b", "a_zero_point", "b_zero_point", "y", "params_main"],"dispatch": {"x": "ceil(dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4) / 64)","y": "ceil(dim(shapes.w, 0) / 8)","z": "dim(shapes.y, 0)"}}]},{"id": "dp4a_im2col_nchw_scalar_zero_points","priority": 20,"when": ["packedFeature", "rank4TensorOk", "scalarXZeroRequiredOk", "scalarWZeroRequiredOk", "ungroupedChannelsOk", "(dim(shapes.w, 2) > 1 or dim(shapes.w, 3) > 1)", "dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) % 4 == 0", "dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) >= 64", "numel(shapes.y) >= 8192", "dim(shapes.y, 2) * dim(shapes.y, 3) <= 4194240", "dim(shapes.w, 0) <= 524280", "dim(shapes.y, 0) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535)"],"derive": { "hasAZero": true, "hasBZero": true, "tileM": 8, "tileN": 64, "ktWords": 32 },"intermediates": [{"id": "cols","dtype": "int32","shape": "[dim(shapes.x, 0) * (dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3)) * (dim(shapes.y, 2) * dim(shapes.y, 3))]"}],"passes": [{"id": "im2col","name": "ConvInteger.Im2Col","shader": "conv-int-im2col-spatial.wgsl.jinja","derive": {"spatialRankSpec": 2,"kernelHSpec": "dim(shapes.w, 2)","kernelWSpec": "dim(shapes.w, 3)","strideHSpec": "strideH","strideWSpec": "strideW","dilationHSpec": "dilationH","dilationWSpec": "dilationW","padTopSpec": "effectivePadTop","padLeftSpec": "effectivePadLeft"},"bindings": ["x", "x_zero_point", "cols_im2col", "params_im2col"],"dispatch": {"x": "ceil(dim(shapes.y, 2) * dim(shapes.y, 3) / tunables.WORKGROUP_SIZE)","y": "dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3)","z": "dim(shapes.x, 0)"}},{"id": "main","name": "ConvInteger.Im2ColDp4a","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a", "b_main", "a_zero_point", "b_zero_point", "y", "params__uniform"],"dispatch": {"x": "ceil(dim(shapes.y, 2) * dim(shapes.y, 3) / 64)","y": "ceil(dim(shapes.w, 0) / 8)","z": "dim(shapes.y, 0)"}}]},{"id": "dp4a_pointwise_1x1_tail","priority": 21,"when": ["nchwTensorOk", "ungroupedChannelsOk", "kernelHeight == 1", "kernelWidth == 1", "strideH == 1", "strideW == 1", "padTop == 0 and padBottom == 0", "padLeft == 0 and padRight == 0", "outputHeight == inputHeight", "outputWidth == inputWidth", "scalarXZeroRequiredOk", "scalarWZeroRequiredOk", "dim(shapes.x, 1) >= 32", "dim(shapes.x, 1) % 4 != 0", "pointwiseResourcesOk", "pointwiseDispatchOk"],"derive": {"hasAZero": true,"hasBZero": true,"tileM": "pointwiseTileM","tileN": "pointwiseTileN","ktWords": "pointwiseKtWords","aPacked": false},"passes": [{"id": "main","name": "ConvInteger.Dp4aPointwiseTail","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a_w", "b_x", "a_zero_point", "b_zero_point", "y", "params_quant_dp4a_matmul"],"dispatch": {"x": "ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y": "ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z": "dim(shapes.y, 0)"}}]},{"id": "dp4a_pointwise_1x1_tail_x_zero_point_only","priority": 21,"when": ["nchwTensorOk", "ungroupedChannelsOk", "kernelHeight == 1", "kernelWidth == 1", "strideH == 1", "strideW == 1", "padTop == 0 and padBottom == 0", "padLeft == 0 and padRight == 0", "outputHeight == inputHeight", "outputWidth == inputWidth", "scalarXZeroRequiredOk", "not present.w_zero_point", "dim(shapes.x, 1) >= 32", "dim(shapes.x, 1) % 4 != 0", "pointwiseResourcesOk", "pointwiseDispatchOk"],"derive": {"hasAZero": false,"hasBZero": true,"tileM": "pointwiseTileM","tileN": "pointwiseTileN","ktWords": "pointwiseKtWords","aPacked": false},"passes": [{"id": "main","name": "ConvInteger.Dp4aPointwiseTail","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a_w", "b_x", "b_zero_point", "y", "params_quant_dp4a_matmul"],"dispatch": {"x": "ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y": "ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z": "dim(shapes.y, 0)"}}]},{"id": "dp4a_pointwise_1x1_tail_w_zero_point_only","priority": 21,"when": ["nchwTensorOk", "ungroupedChannelsOk", "kernelHeight == 1", "kernelWidth == 1", "strideH == 1", "strideW == 1", "padTop == 0 and padBottom == 0", "padLeft == 0 and padRight == 0", "outputHeight == inputHeight", "outputWidth == inputWidth", "not present.x_zero_point", "scalarWZeroRequiredOk", "dim(shapes.x, 1) >= 32", "dim(shapes.x, 1) % 4 != 0", "pointwiseResourcesOk", "pointwiseDispatchOk"],"derive": {"hasAZero": true,"hasBZero": false,"tileM": "pointwiseTileM","tileN": "pointwiseTileN","ktWords": "pointwiseKtWords","aPacked": false},"passes": [{"id": "main","name": "ConvInteger.Dp4aPointwiseTail","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a_w", "b_x", "a_zero_point", "y", "params_quant_dp4a_matmul"],"dispatch": {"x": "ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y": "ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z": "dim(shapes.y, 0)"}}]},{"id": "dp4a_pointwise_1x1_tail_no_zero_points","priority": 21,"when": ["nchwTensorOk", "ungroupedChannelsOk", "kernelHeight == 1", "kernelWidth == 1", "strideH == 1", "strideW == 1", "padTop == 0 and padBottom == 0", "padLeft == 0 and padRight == 0", "outputHeight == inputHeight", "outputWidth == inputWidth", "not present.x_zero_point", "not present.w_zero_point", "dim(shapes.x, 1) >= 32", "dim(shapes.x, 1) % 4 != 0", "pointwiseResourcesOk", "pointwiseDispatchOk"],"derive": {"hasAZero": false,"hasBZero": false,"tileM": "pointwiseTileM","tileN": "pointwiseTileN","ktWords": "pointwiseKtWords","aPacked": false},"passes": [{"id": "main","name": "ConvInteger.Dp4aPointwiseTail","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a_w", "b_x", "y", "params_quant_dp4a_matmul"],"dispatch": {"x": "ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y": "ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z": "dim(shapes.y, 0)"}}]},{"id": "dp4a_pointwise_1x1","priority": 20,"when": ["nchwTensorOk", "ungroupedChannelsOk", "kernelHeight == 1", "kernelWidth == 1", "strideH == 1", "strideW == 1", "padTop == 0 and padBottom == 0", "padLeft == 0 and padRight == 0", "outputHeight == inputHeight", "outputWidth == inputWidth", "scalarXZeroRequiredOk", "scalarWZeroRequiredOk", "dim(shapes.x, 1) % 4 == 0", "pointwiseResourcesOk", "pointwiseDispatchOk"],"derive": {"aVec4": "\"vec4<u32>\" if tensorDtypes.w == \"uint8\" else \"vec4<i32>\"","hasAZero": true,"hasBZero": true,"tileM": "pointwiseTileM","tileN": "pointwiseTileN","ktWords": "pointwiseKtWords"},"passes": [{"id": "main","name": "ConvInteger.Dp4aPointwise","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a", "b_x", "a_zero_point", "b_zero_point", "y", "params_quant_dp4a_matmul"],"dispatch": {"x": "ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y": "ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z": "dim(shapes.y, 0)"}}]},{"id": "dp4a_pointwise_1x1_x_zero_point_only","priority": 20,"when": ["nchwTensorOk", "ungroupedChannelsOk", "kernelHeight == 1", "kernelWidth == 1", "strideH == 1", "strideW == 1", "padTop == 0 and padBottom == 0", "padLeft == 0 and padRight == 0", "outputHeight == inputHeight", "outputWidth == inputWidth", "scalarXZeroRequiredOk", "not present.w_zero_point", "dim(shapes.x, 1) % 4 == 0", "pointwiseResourcesOk", "pointwiseDispatchOk"],"derive": {"aVec4": "\"vec4<u32>\" if tensorDtypes.w == \"uint8\" else \"vec4<i32>\"","hasAZero": false,"hasBZero": true,"tileM": "pointwiseTileM","tileN": "pointwiseTileN","ktWords": "pointwiseKtWords"},"passes": [{"id": "main","name": "ConvInteger.Dp4aPointwise","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a", "b_x", "b_zero_point", "y", "params_quant_dp4a_matmul"],"dispatch": {"x": "ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y": "ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z": "dim(shapes.y, 0)"}}]},{"id": "dp4a_pointwise_1x1_w_zero_point_only","priority": 20,"when": ["nchwTensorOk", "ungroupedChannelsOk", "kernelHeight == 1", "kernelWidth == 1", "strideH == 1", "strideW == 1", "padTop == 0 and padBottom == 0", "padLeft == 0 and padRight == 0", "outputHeight == inputHeight", "outputWidth == inputWidth", "not present.x_zero_point", "scalarWZeroRequiredOk", "dim(shapes.x, 1) % 4 == 0", "pointwiseResourcesOk", "pointwiseDispatchOk"],"derive": {"aVec4": "\"vec4<u32>\" if tensorDtypes.w == \"uint8\" else \"vec4<i32>\"","hasAZero": true,"hasBZero": false,"tileM": "pointwiseTileM","tileN": "pointwiseTileN","ktWords": "pointwiseKtWords"},"passes": [{"id": "main","name": "ConvInteger.Dp4aPointwise","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a", "b_x", "a_zero_point", "y", "params_quant_dp4a_matmul"],"dispatch": {"x": "ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y": "ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z": "dim(shapes.y, 0)"}}]},{"id": "dp4a_pointwise_1x1_no_zero_points","priority": 20,"when": ["nchwTensorOk", "ungroupedChannelsOk", "kernelHeight == 1", "kernelWidth == 1", "strideH == 1", "strideW == 1", "padTop == 0 and padBottom == 0", "padLeft == 0 and padRight == 0", "outputHeight == inputHeight", "outputWidth == inputWidth", "not present.x_zero_point", "not present.w_zero_point", "dim(shapes.x, 1) % 4 == 0", "pointwiseResourcesOk", "pointwiseDispatchOk"],"derive": {"aVec4": "\"vec4<u32>\" if tensorDtypes.w == \"uint8\" else \"vec4<i32>\"","hasAZero": false,"hasBZero": false,"tileM": "pointwiseTileM","tileN": "pointwiseTileN","ktWords": "pointwiseKtWords"},"passes": [{"id": "main","name": "ConvInteger.Dp4aPointwise","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a", "b_x", "y", "params_quant_dp4a_matmul"],"dispatch": {"x": "ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y": "ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z": "dim(shapes.y, 0)"}}]},{"id": "dp4a_pointwise_1x1_tail_per_channel","priority": 21,"when": ["nchwTensorOk", "ungroupedChannelsOk", "kernelHeight == 1", "kernelWidth == 1", "strideH == 1", "strideW == 1", "padTop == 0 and padBottom == 0", "padLeft == 0 and padRight == 0", "outputHeight == inputHeight", "outputWidth == inputWidth", "scalarXZeroRequiredOk", "present.w_zero_point", "ranks.w_zero_point == 1", "dim(shapes.w_zero_point, 0) == dim(shapes.w, 0)", "dim(shapes.x, 1) >= 32", "dim(shapes.x, 1) % 4 != 0", "pointwiseResourcesOk", "pointwiseDispatchOk"],"derive": {"hasAZero": true,"hasBZero": true,"tileM": "pointwiseTileM","tileN": "pointwiseTileN","ktWords": "pointwiseKtWords","aPacked": false,"aZeroPerRow": true},"passes": [{"id": "main","name": "ConvInteger.Dp4aPointwiseTail","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a_w", "b_x", "a_zero_point_per_row", "b_zero_point", "y", "params_quant_dp4a_matmul"],"dispatch": {"x": "ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y": "ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z": "dim(shapes.y, 0)"}}]},{"id": "dp4a_pointwise_1x1_tail_per_channel_w_zero_point_only","priority": 21,"when": ["nchwTensorOk", "ungroupedChannelsOk", "kernelHeight == 1", "kernelWidth == 1", "strideH == 1", "strideW == 1", "padTop == 0 and padBottom == 0", "padLeft == 0 and padRight == 0", "outputHeight == inputHeight", "outputWidth == inputWidth", "not present.x_zero_point", "present.w_zero_point", "ranks.w_zero_point == 1", "dim(shapes.w_zero_point, 0) == dim(shapes.w, 0)", "dim(shapes.x, 1) >= 32", "dim(shapes.x, 1) % 4 != 0", "pointwiseResourcesOk", "pointwiseDispatchOk"],"derive": {"hasAZero": true,"hasBZero": false,"tileM": "pointwiseTileM","tileN": "pointwiseTileN","ktWords": "pointwiseKtWords","aPacked": false,"aZeroPerRow": true},"passes": [{"id": "main","name": "ConvInteger.Dp4aPointwiseTail","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a_w", "b_x", "a_zero_point_per_row", "y", "params_quant_dp4a_matmul"],"dispatch": {"x": "ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y": "ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z": "dim(shapes.y, 0)"}}]},{"id": "dp4a_pointwise_1x1_per_channel","priority": 20,"when": ["nchwTensorOk", "ungroupedChannelsOk", "kernelHeight == 1", "kernelWidth == 1", "strideH == 1", "strideW == 1", "padTop == 0 and padBottom == 0", "padLeft == 0 and padRight == 0", "outputHeight == inputHeight", "outputWidth == inputWidth", "scalarXZeroRequiredOk", "present.w_zero_point", "ranks.w_zero_point == 1", "dim(shapes.w_zero_point, 0) == dim(shapes.w, 0)", "dim(shapes.x, 1) % 4 == 0", "pointwiseResourcesOk", "pointwiseDispatchOk"],"derive": {"aVec4": "\"vec4<u32>\" if tensorDtypes.w == \"uint8\" else \"vec4<i32>\"","hasAZero": true,"hasBZero": true,"tileM": "pointwiseTileM","tileN": "pointwiseTileN","ktWords": "pointwiseKtWords","aZeroPerRow": true},"passes": [{"id": "main","name": "ConvInteger.Dp4aPointwise","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a", "b_x", "a_zero_point_per_row", "b_zero_point", "y", "params_quant_dp4a_matmul"],"dispatch": {"x": "ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y": "ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z": "dim(shapes.y, 0)"}}]},{"id": "dp4a_pointwise_1x1_per_channel_w_zero_point_only","priority": 20,"when": ["nchwTensorOk", "ungroupedChannelsOk", "kernelHeight == 1", "kernelWidth == 1", "strideH == 1", "strideW == 1", "padTop == 0 and padBottom == 0", "padLeft == 0 and padRight == 0", "outputHeight == inputHeight", "outputWidth == inputWidth", "not present.x_zero_point", "present.w_zero_point", "ranks.w_zero_point == 1", "dim(shapes.w_zero_point, 0) == dim(shapes.w, 0)", "dim(shapes.x, 1) % 4 == 0", "pointwiseResourcesOk", "pointwiseDispatchOk"],"derive": {"aVec4": "\"vec4<u32>\" if tensorDtypes.w == \"uint8\" else \"vec4<i32>\"","hasAZero": true,"hasBZero": false,"tileM": "pointwiseTileM","tileN": "pointwiseTileN","ktWords": "pointwiseKtWords","aZeroPerRow": true},"passes": [{"id": "main","name": "ConvInteger.Dp4aPointwise","shader": "quant-dp4a-matmul.wgsl.jinja","bindings": ["a", "b_x", "a_zero_point_per_row", "y", "params_quant_dp4a_matmul"],"dispatch": {"x": "ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y": "ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z": "dim(shapes.y, 0)"}}]},{"id": "nchw2d_per_channel_zero_point","priority": 5,"when": ["nchwTensorOk", "scalarXZeroRequiredOk", "ranks.w_zero_point == 1", "dim(shapes.w_zero_point, 0) == dim(shapes.w, 0)", "groupChannelsOk", "outputSpatialShapeOk"],"derive": { "wZeroPerChannel": true },"passes": [{"id": "main","name": "ConvIntegerPerChannel","shader": "conv-int-accumulate-spatial.wgsl.jinja","derive": { "spatialRankSpec": 2, "xZeroOmitted": "false", "wZeroOmitted": "false" },"bindings": ["x_main", "w", "x_zero_point_main", "w_zero_point", "y", "params_nchw2d_x_zero_point_only"],"dispatch": {"x": "min(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","y": "ceilDiv(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","z": 1}}]},{"id": "nchw2d_per_channel_w_zero_point_only","priority": 5,"when": ["nchwTensorOk", "not present.x_zero_point", "present.w_zero_point", "ranks.w_zero_point == 1", "dim(shapes.w_zero_point, 0) == dim(shapes.w, 0)", "groupChannelsOk", "outputSpatialShapeOk"],"derive": { "wZeroPerChannel": true },"passes": [{"id": "main","name": "ConvIntegerPerChannel","shader": "conv-int-accumulate-spatial.wgsl.jinja","derive": { "spatialRankSpec": 2, "xZeroOmitted": "true", "wZeroOmitted": "false" },"bindings": ["x_main", "w", "w_zero_point", "y", "params_nchw2d_x_zero_point_only"],"dispatch": {"x": "min(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","y": "ceilDiv(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","z": 1}}]},{"id": "nchw2d_scalar_zero_points","when": ["nchwTensorOk", "scalarXZeroRequiredOk", "scalarWZeroRequiredOk", "groupChannelsOk", "outputSpatialShapeOk"],"derive": {},"passes": [{"id": "main","name": "ConvInteger","shader": "conv-int-accumulate-spatial.wgsl.jinja","derive": { "spatialRankSpec": 2, "xZeroOmitted": "false", "wZeroOmitted": "false" },"bindings": ["x_main", "w", "x_zero_point_main", "w_zero_point_main", "y", "params_nchw2d_x_zero_point_only"],"dispatch": {"x": "min(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","y": "ceilDiv(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","z": 1}}]},{"id": "nchw2d_x_zero_point_only","when": ["nchwTensorOk", "present.x_zero_point", "not present.w_zero_point", "scalarXZeroRequiredOk", "groupChannelsOk", "outputSpatialShapeOk"],"derive": {},"passes": [{"id": "main","name": "ConvInteger","shader": "conv-int-accumulate-spatial.wgsl.jinja","derive": { "spatialRankSpec": 2, "xZeroOmitted": "false", "wZeroOmitted": "true" },"bindings": ["x_main", "w", "x_zero_point_main", "y", "params_nchw2d_x_zero_point_only"],"dispatch": {"x": "min(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","y": "ceilDiv(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","z": 1}}]},{"id": "nchw2d_w_zero_point_only","when": ["nchwTensorOk", "not present.x_zero_point", "present.w_zero_point", "scalarWZeroRequiredOk", "groupChannelsOk", "outputSpatialShapeOk"],"derive": {},"passes": [{"id": "main","name": "ConvInteger","shader": "conv-int-accumulate-spatial.wgsl.jinja","derive": { "spatialRankSpec": 2, "xZeroOmitted": "true", "wZeroOmitted": "false" },"bindings": ["x_main", "w", "w_zero_point_main", "y", "params_nchw2d_x_zero_point_only"],"dispatch": {"x": "min(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","y": "ceilDiv(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","z": 1}}]},{"id": "ncdhw3d_scalar_zero_points","when": ["rank5TensorOk", "scalarXZeroRequiredOk", "scalarWZeroRequiredOk", "groupChannelsOk", "output3dShapeOk"],"derive": {},"passes": [{"id": "main","name": "ConvInteger3d","shader": "conv-int-accumulate-spatial.wgsl.jinja","derive": { "spatialRankSpec": 3, "xZeroOmitted": "false", "wZeroOmitted": "false" },"bindings": ["x_main", "w", "x_zero_point_main", "w_zero_point_main", "y", "params_ncdhw3d_x_zero_point_only"],"dispatch": {"x": "min(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","y": "ceilDiv(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","z": 1}}]},{"id": "ncdhw3d_x_zero_point_only","when": ["rank5TensorOk", "scalarXZeroRequiredOk", "not present.w_zero_point", "groupChannelsOk", "output3dShapeOk"],"derive": {},"passes": [{"id": "main","name": "ConvInteger3d","shader": "conv-int-accumulate-spatial.wgsl.jinja","derive": { "spatialRankSpec": 3, "xZeroOmitted": "false", "wZeroOmitted": "true" },"bindings": ["x_main", "w", "x_zero_point_main", "y", "params_ncdhw3d_x_zero_point_only"],"dispatch": {"x": "min(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","y": "ceilDiv(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","z": 1}}]},{"id": "ncdhw3d_w_zero_point_only","when": ["rank5TensorOk", "not present.x_zero_point", "scalarWZeroRequiredOk", "groupChannelsOk", "output3dShapeOk"],"derive": {},"passes": [{"id": "main","name": "ConvInteger3d","shader": "conv-int-accumulate-spatial.wgsl.jinja","derive": { "spatialRankSpec": 3, "xZeroOmitted": "true", "wZeroOmitted": "false" },"bindings": ["x_main", "w", "w_zero_point_main", "y", "params_ncdhw3d_x_zero_point_only"],"dispatch": {"x": "min(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","y": "ceilDiv(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","z": 1}}]},{"id": "ncdhw3d_implicit_zero_points","when": ["rank5TensorOk", "zeroPointsOmitted", "groupChannelsOk", "output3dShapeOk"],"derive": {},"passes": [{"id": "main","name": "ConvInteger3d","shader": "conv-int-accumulate-spatial.wgsl.jinja","derive": { "spatialRankSpec": 3, "xZeroOmitted": "true", "wZeroOmitted": "true" },"bindings": ["x_main", "w", "y", "params_ncdhw3d_x_zero_point_only"],"dispatch": {"x": "min(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","y": "ceilDiv(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","z": 1}}]},{"id": "nchw_implicit_zero_points","when": ["nchwTensorOk", "zeroPointsOmitted", "groupChannelsOk", "outputSpatialShapeOk"],"derive": {},"passes": [{"id": "main","name": "ConvInteger","shader": "conv-int-accumulate-spatial.wgsl.jinja","derive": { "spatialRankSpec": 2, "xZeroOmitted": "true", "wZeroOmitted": "true" },"bindings": ["x_main", "w", "y", "params_nchw2d_x_zero_point_only"],"dispatch": {"x": "min(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","y": "ceilDiv(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","z": 1}}]}]}1{"domain":"ai.onnx","name":"ConvInteger","sinceVersion":10,"inputs":{"x":{"dtype":"TX"},"w":{"dtype":"TW"},"x_zero_point":{"dtype":"TX","optional":true},"w_zero_point":{"dtype":"TW","optional":true}},"outputs":{"y":{"dtype":"TY","rank":"ranks.x","shape":"[dim(shapes.x, 0), dim(shapes.w, 0), expectedOutputWidth] if ranks.x == 3 else ([dim(shapes.x, 0), dim(shapes.w, 0), expectedOutputHeight, expectedOutputWidth] if ranks.x == 4 else [dim(shapes.x, 0), dim(shapes.w, 0), expectedOutputDepth, expectedOutputHeight, expectedOutputWidth])"}},"attributes":{"auto_pad":{"default":"NOTSET"},"group":{"default":1},"dilations":{},"kernel_shape":{},"pads":{},"strides":{}},"attributeConstraints":{"auto_pad":{"values":["NOTSET","SAME_UPPER","SAME_LOWER","VALID"]}},"typeConstraints":{"TX":["uint8","int8"],"TW":["uint8","int8"],"TY":["int32"]},"tunables":{"WORKGROUP_SIZE":{"default":256}},"derive":{"inputDepth":"dim(shapes.x, 2) if ranks.x == 5 else 1","inputHeight":"dim(shapes.x, 3) if ranks.x == 5 else (dim(shapes.x, 2) if ranks.x == 4 else 1)","inputWidth":"dim(shapes.x, ranks.x - 1) if ranks.x >= 3 else 1","outputDepth":"dim(shapes.y, 2) if ranks.y == 5 else 1","outputHeight":"dim(shapes.y, 3) if ranks.y == 5 else (dim(shapes.y, 2) if ranks.y == 4 else 1)","outputWidth":"dim(shapes.y, ranks.y - 1) if ranks.y >= 3 else 1","kernelDepth":"dim(shapes.w, 2) if ranks.w == 5 else 1","kernelHeight":"dim(shapes.w, 3) if ranks.w == 5 else (dim(shapes.w, 2) if ranks.w == 4 else 1)","kernelWidth":"dim(shapes.w, ranks.w - 1) if ranks.w >= 3 else 1","spatialRank":"ranks.w - 2","kernelShapeLengthOk":"not has(attrs, \"kernel_shape\") or (attrs.kernel_shape | length) == spatialRank","stridesLengthOk":"not has(attrs, \"strides\") or (attrs.strides | length) == spatialRank","dilationsLengthOk":"not has(attrs, \"dilations\") or (attrs.dilations | length) == spatialRank","padsLengthOk":"not has(attrs, \"pads\") or (attrs.pads | length) == 2 * spatialRank","kernelD":"attrs.kernel_shape[0] if kernelShapeLengthOk and has(attrs, \"kernel_shape\") and spatialRank == 3 else 1","kernelH":"attrs.kernel_shape[spatialRank - 2] if kernelShapeLengthOk and has(attrs, \"kernel_shape\") and spatialRank >= 2 else 1","kernelW":"attrs.kernel_shape[spatialRank - 1] if kernelShapeLengthOk and has(attrs, \"kernel_shape\") and spatialRank >= 1 else 1","strideD":"attrs.strides[0] if stridesLengthOk and has(attrs, \"strides\") and spatialRank == 3 else 1","strideH":"attrs.strides[spatialRank - 2] if stridesLengthOk and has(attrs, \"strides\") and spatialRank >= 2 else 1","strideW":"attrs.strides[spatialRank - 1] if stridesLengthOk and has(attrs, \"strides\") and spatialRank >= 1 else 1","dilationD":"attrs.dilations[0] if dilationsLengthOk and has(attrs, \"dilations\") and spatialRank == 3 else 1","dilationH":"attrs.dilations[spatialRank - 2] if dilationsLengthOk and has(attrs, \"dilations\") and spatialRank >= 2 else 1","dilationW":"attrs.dilations[spatialRank - 1] if dilationsLengthOk and has(attrs, \"dilations\") and spatialRank >= 1 else 1","padFront":"attrs.pads[0] if padsLengthOk and has(attrs, \"pads\") and spatialRank == 3 else 0","padTop":"attrs.pads[spatialRank - 2] if padsLengthOk and has(attrs, \"pads\") and spatialRank >= 2 else 0","padLeft":"attrs.pads[spatialRank - 1] if padsLengthOk and has(attrs, \"pads\") and spatialRank >= 1 else 0","padBack":"attrs.pads[spatialRank] if padsLengthOk and has(attrs, \"pads\") and spatialRank == 3 else 0","padBottom":"attrs.pads[2 * spatialRank - 2] if padsLengthOk and has(attrs, \"pads\") and spatialRank >= 2 else 0","padRight":"attrs.pads[2 * spatialRank - 1] if padsLengthOk and has(attrs, \"pads\") and spatialRank >= 1 else 0","autoPadSame":"attrs.auto_pad == \"SAME_UPPER\" or attrs.auto_pad == \"SAME_LOWER\"","autoPadValid":"attrs.auto_pad == \"VALID\"","samePadDepth":"max(0, (outputDepth - 1) * strideD + (kernelDepth - 1) * dilationD + 1 - inputDepth)","samePadHeight":"max(0, (outputHeight - 1) * strideH + (kernelHeight - 1) * dilationH + 1 - inputHeight)","samePadWidth":"max(0, (outputWidth - 1) * strideW + (kernelWidth - 1) * dilationW + 1 - inputWidth)","samePadFront":"floor(samePadDepth / 2) if attrs.auto_pad == \"SAME_UPPER\" else samePadDepth - floor(samePadDepth / 2)","samePadTop":"floor(samePadHeight / 2) if attrs.auto_pad == \"SAME_UPPER\" else samePadHeight - floor(samePadHeight / 2)","samePadLeft":"floor(samePadWidth / 2) if attrs.auto_pad == \"SAME_UPPER\" else samePadWidth - floor(samePadWidth / 2)","effectivePadFront":"samePadFront if autoPadSame else (0 if autoPadValid else padFront)","effectivePadTop":"samePadTop if autoPadSame else (0 if autoPadValid else padTop)","effectivePadLeft":"samePadLeft if autoPadSame else (0 if autoPadValid else padLeft)","expectedOutputDepth":"ceil(inputDepth / strideD) if autoPadSame else floor((inputDepth + (0 if autoPadValid else padFront + padBack) - ((kernelDepth - 1) * dilationD + 1)) / strideD) + 1","expectedOutputHeight":"ceil(inputHeight / strideH) if autoPadSame else floor((inputHeight + (0 if autoPadValid else padTop + padBottom) - ((kernelHeight - 1) * dilationH + 1)) / strideH) + 1","expectedOutputWidth":"ceil(inputWidth / strideW) if autoPadSame else floor((inputWidth + (0 if autoPadValid else padLeft + padRight) - ((kernelWidth - 1) * dilationW + 1)) / strideW) + 1","spatialAttributeLengthsOk":"kernelShapeLengthOk and stridesLengthOk and dilationsLengthOk and padsLengthOk","kernelShapeMatchesWeights":"not has(attrs, \"kernel_shape\") or (kernelW == kernelWidth and (spatialRank < 2 or kernelH == kernelHeight) and (spatialRank < 3 or kernelD == kernelDepth))","kernelExtentsOk":"kernelWidth >= 1 and (spatialRank < 2 or kernelHeight >= 1) and (spatialRank < 3 or kernelDepth >= 1)","stridesValuesOk":"not has(attrs, \"strides\") or (strideD >= 1 and floor(strideD) == strideD and strideH >= 1 and floor(strideH) == strideH and strideW >= 1 and floor(strideW) == strideW)","dilationsValuesOk":"not has(attrs, \"dilations\") or (dilationD >= 1 and floor(dilationD) == dilationD and dilationH >= 1 and floor(dilationH) == dilationH and dilationW >= 1 and floor(dilationW) == dilationW)","padsValuesOk":"padFront >= 0 and floor(padFront) == padFront and padTop >= 0 and floor(padTop) == padTop and padLeft >= 0 and floor(padLeft) == padLeft and padBack >= 0 and floor(padBack) == padBack and padBottom >= 0 and floor(padBottom) == padBottom and padRight >= 0 and floor(padRight) == padRight","explicitPadsOk":"attrs.auto_pad == \"NOTSET\" or not has(attrs, \"pads\")","spatialAttributesOk":"spatialRank >= 1 and spatialRank <= 3 and spatialAttributeLengthsOk and kernelShapeMatchesWeights and kernelExtentsOk and stridesValuesOk and dilationsValuesOk and padsValuesOk and explicitPadsOk","packedFeature":"device.wgslLanguageFeatures.has(\"packed_4x8_integer_dot_product\")","rank4TensorOk":"spatialAttributesOk and (ranks.x == 4 and ranks.w == 4 and ranks.y == 4)","outputBatchChannelsOk":"dim(shapes.y, 0) == dim(shapes.x, 0) and dim(shapes.y, 1) == dim(shapes.w, 0)","groupChannelsOk":"attrs.group >= 1 and dim(shapes.w, 1) * attrs.group == dim(shapes.x, 1) and dim(shapes.w, 0) % attrs.group == 0","output2dShapeOk":"dim(shapes.y, 2) == expectedOutputHeight and dim(shapes.y, 3) == expectedOutputWidth","aScalar":"\"u32\" if tensorDtypes.w == \"uint8\" else \"i32\"","bScalar":"\"u32\" if tensorDtypes.x == \"uint8\" else \"i32\"","wScalar":"\"u32\" if tensorDtypes.w == \"uint8\" else \"i32\"","xScalar":"\"u32\" if tensorDtypes.x == \"uint8\" else \"i32\"","aUnsigned":"tensorDtypes.w == \"uint8\"","bUnsigned":"tensorDtypes.x == \"uint8\"","wUnsigned":"tensorDtypes.w == \"uint8\"","xUnsigned":"tensorDtypes.x == \"uint8\"","bZeroPerColumn":false,"packedDotTilesOk":"not (has(device.adapterInfo, \"architecture\") and device.adapterInfo.architecture == \"adreno-8xx\")","rank5TensorOk":"spatialAttributesOk and (ranks.x == 5 and ranks.w == 5 and ranks.y == 5)","scalarXZeroOk":"ranks.x_zero_point == 0 or (ranks.x_zero_point == 1 and dim(shapes.x_zero_point, 0) == 1)","scalarWZeroOk":"ranks.w_zero_point == 0 or (ranks.w_zero_point == 1 and dim(shapes.w_zero_point, 0) == 1)","scalarXZeroRequiredOk":"present.x_zero_point and scalarXZeroOk","scalarWZeroRequiredOk":"present.w_zero_point and scalarWZeroOk","ungroupedChannelsOk":"attrs.group == 1 and dim(shapes.w, 1) == dim(shapes.x, 1)","output3dShapeOk":"dim(shapes.y, 2) == expectedOutputDepth and dim(shapes.y, 3) == expectedOutputHeight and dim(shapes.y, 4) == expectedOutputWidth","rank3TensorOk":"spatialAttributesOk and (ranks.x == 3 and ranks.w == 3 and ranks.y == 3)","nchwTensorOk":"rank4TensorOk or rank3TensorOk","output1dShapeOk":"dim(shapes.y, 2) == expectedOutputWidth","outputSpatialShapeOk":"output2dShapeOk if rank4TensorOk else output1dShapeOk","pointwiseTileM":8,"pointwiseTileN":64,"pointwiseKtWords":32,"pointwiseResourcesOk":"pointwiseTileN <= min(device.limits.maxComputeWorkgroupSizeX, device.limits.maxComputeInvocationsPerWorkgroup) and 4 * pointwiseTileM * (pointwiseKtWords + 1) <= device.limits.maxComputeWorkgroupStorageSize","pointwiseDispatchOk":"ceilDiv(outputHeight * outputWidth, pointwiseTileN) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) and ceilDiv(dim(shapes.w, 0), pointwiseTileM) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) and dim(shapes.y, 0) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535)","aVec4":"\"vec4<u32>\" if tensorDtypes.w == \"uint8\" else \"vec4<i32>\""},"when":["outputBatchChannelsOk"],"bindings":{"x":{"elementType":"$bScalar"},"x_zero_point":{"elementType":"$bScalar","length":1},"params":{"when":"rank5TensorOk","struct":[{"name":"outCount","type":"u32","value":"dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4)"},{"name":"inChannels","type":"u32","value":"dim(shapes.x, 1)"},{"name":"inD","type":"u32","value":"dim(shapes.x, 2)"},{"name":"inH","type":"u32","value":"dim(shapes.x, 3)"},{"name":"inW","type":"u32","value":"dim(shapes.x, 4)"},{"name":"kRows","type":"u32","value":"dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4)"},{"name":"outH","type":"u32","value":"dim(shapes.y, 3)"},{"name":"outW","type":"u32","value":"dim(shapes.y, 4)"}]},"cols_im2col":{"name":"cols","buffer":"storage","elementType":"$bScalar"},"params_im2col":{"name":"params","when":"not rank5TensorOk","struct":[{"name":"outCount","type":"u32","value":"dim(shapes.y, 2) * dim(shapes.y, 3)"},{"name":"inChannels","type":"u32","value":"dim(shapes.x, 1)"},{"name":"inH","type":"u32","value":"dim(shapes.x, 2)"},{"name":"inW","type":"u32","value":"dim(shapes.x, 3)"},{"name":"kRows","type":"u32","value":"dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3)"},{"name":"outW","type":"u32","value":"dim(shapes.y, 3)"}]},"a":{"arg":"w","elementType":"$aVec4"},"a_zero_point":{"arg":"w_zero_point","elementType":"$aScalar","length":1,"when":"present.w_zero_point"},"b_zero_point":{"arg":"x_zero_point","elementType":"$bScalar","length":1,"when":"present.x_zero_point"},"y":{"elementType":"i32"},"b_main":{"scratch":"cols","name":"b","buffer":"read-only-storage","elementType":"$bScalar"},"params__uniform":{"name":"params","struct":[{"name":"M","type":"u32","value":"dim(shapes.w, 0)"},{"name":"N","type":"u32","value":"outSpatial"},{"name":"K","type":"u32","value":"kRows"},{"name":"aBatchStride4","type":"u32","value":0},{"name":"bBatchStride","type":"u32","value":"kRows * outSpatial"},{"name":"yBatchStride","type":"u32","value":"dim(shapes.w, 0) * outSpatial"}]},"a_w":{"arg":"w","name":"a","elementType":"$aStorage"},"b_x":{"arg":"x","name":"b","elementType":"$bScalar"},"params_quant_dp4a_matmul":{"name":"params","struct":[{"name":"M","type":"u32","value":"dim(shapes.w, 0)"},{"name":"N","type":"u32","value":"outputHeight * outputWidth"},{"name":"K","type":"u32","value":"dim(shapes.x, 1)"},{"name":"aBatchStride4","type":"u32","value":0},{"name":"bBatchStride","type":"u32","value":"dim(shapes.x, 1) * inputHeight * inputWidth"},{"name":"yBatchStride","type":"u32","value":"dim(shapes.w, 0) * outputHeight * outputWidth"}]},"x_main":{"name":"x","elementType":"$xScalar"},"w":{"elementType":"$wScalar"},"x_zero_point_main":{"name":"x_zero_point","elementType":"$xScalar","length":1,"when":"present.x_zero_point"},"w_zero_point":{"elementType":"$wScalar"},"params_nchw":{"name":"params","struct":[{"name":"inChannels","type":"u32","value":"dim(shapes.x, 1)"},{"name":"inH","type":"u32","value":"inputHeight"},{"name":"inW","type":"u32","value":"inputWidth"},{"name":"outChannels","type":"u32","value":"dim(shapes.w, 0)"},{"name":"weightInChannels","type":"u32","value":"dim(shapes.w, 1)"},{"name":"inChannelsPerGroup","type":"u32","value":"dim(shapes.x, 1) / attrs.group"},{"name":"outChannelsPerGroup","type":"u32","value":"dim(shapes.w, 0) / attrs.group"},{"name":"kernelH","type":"u32","value":"kernelHeight"},{"name":"kernelW","type":"u32","value":"kernelWidth"},{"name":"outH","type":"u32","value":"outputHeight"},{"name":"outW","type":"u32","value":"outputWidth"},{"name":"strideH","type":"u32","value":"strideH"},{"name":"strideW","type":"u32","value":"strideW"},{"name":"dilationH","type":"u32","value":"dilationH"},{"name":"dilationW","type":"u32","value":"dilationW"},{"name":"padH","type":"i32","value":"effectivePadTop"},{"name":"padW","type":"i32","value":"effectivePadLeft"},{"name":"count","type":"u32","value":"numel(shapes.y)"}],"when":"not rank5TensorOk"},"w_zero_point_main":{"name":"w_zero_point","elementType":"$wScalar","length":1,"when":"present.w_zero_point"},"params_ncdhw":{"name":"params","struct":[{"name":"inChannels","type":"u32","value":"dim(shapes.x, 1)"},{"name":"inD","type":"u32","value":"dim(shapes.x, 2)"},{"name":"inH","type":"u32","value":"dim(shapes.x, 3)"},{"name":"inW","type":"u32","value":"dim(shapes.x, 4)"},{"name":"outChannels","type":"u32","value":"dim(shapes.w, 0)"},{"name":"weightInChannels","type":"u32","value":"dim(shapes.w, 1)"},{"name":"inChannelsPerGroup","type":"u32","value":"dim(shapes.x, 1) / attrs.group"},{"name":"outChannelsPerGroup","type":"u32","value":"dim(shapes.w, 0) / attrs.group"},{"name":"kernelD","type":"u32","value":"dim(shapes.w, 2)"},{"name":"kernelH","type":"u32","value":"dim(shapes.w, 3)"},{"name":"kernelW","type":"u32","value":"dim(shapes.w, 4)"},{"name":"outD","type":"u32","value":"dim(shapes.y, 2)"},{"name":"outH","type":"u32","value":"dim(shapes.y, 3)"},{"name":"outW","type":"u32","value":"dim(shapes.y, 4)"},{"name":"strideD","type":"u32","value":"strideD"},{"name":"strideH","type":"u32","value":"strideH"},{"name":"strideW","type":"u32","value":"strideW"},{"name":"dilationD","type":"u32","value":"dilationD"},{"name":"dilationH","type":"u32","value":"dilationH"},{"name":"dilationW","type":"u32","value":"dilationW"},{"name":"padD","type":"i32","value":"effectivePadFront"},{"name":"padH","type":"i32","value":"effectivePadTop"},{"name":"padW","type":"i32","value":"effectivePadLeft"},{"name":"count","type":"u32","value":"numel(shapes.y)"}],"when":"rank5TensorOk"},"a_zero_point_per_row":{"arg":"w_zero_point","name":"a_zero_point","elementType":"$aScalar"}},"variants":[{"id":"dp4a_im2col_scalar_zero_points","priority":20,"when":["packedFeature","rank5TensorOk or rank4TensorOk","scalarXZeroRequiredOk","scalarWZeroRequiredOk","ungroupedChannelsOk","(dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4) % 4 == 0 and dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4) >= 32 and dim(shapes.w, 0) >= 8 and dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4) >= 256 and output3dShapeOk and dim(shapes.x, 0) * dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4) * dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4) * 4 <= device.limits.maxStorageBufferBindingSize and dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * dim(shapes.w, 4) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) and ceilDiv(dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4), tunables.WORKGROUP_SIZE) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) and ceilDiv(dim(shapes.y, 2) * dim(shapes.y, 3) * dim(shapes.y, 4), 64) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) and ceilDiv(dim(shapes.w, 0), 8) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) and dim(shapes.x, 0) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535)) if rank5TensorOk else ((dim(shapes.w, 2) > 1 or dim(shapes.w, 3) > 1) and dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) % 4 == 0 and dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) >= 64 and numel(shapes.y) >= 8192 and dim(shapes.y, 2) * dim(shapes.y, 3) <= 4194240 and dim(shapes.w, 0) <= 524280 and dim(shapes.y, 0) <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535))","packedDotTilesOk"],"derive":{"hasAZero":true,"hasBZero":true,"aPacked":true,"aZeroPerRow":false,"tileM":8,"tileN":64,"ktWords":32,"hasBias":false,"kRows":"dim(shapes.w, 1) * dim(shapes.w, 2) * dim(shapes.w, 3) * (dim(shapes.w, 4) if rank5TensorOk else 1)","outSpatial":"dim(shapes.y, 2) * dim(shapes.y, 3) * (dim(shapes.y, 4) if rank5TensorOk else 1)"},"intermediates":[{"id":"cols","dtype":"int32","shape":"[dim(shapes.x, 0) * kRows * outSpatial]"}],"passes":[{"id":"im2col","name":"ConvInteger.Im2Col","shader":"conv-int-im2col-spatial.wgsl.jinja","derive":{"spatialRankSpec":"3 if rank5TensorOk else 2","kernelDSpec":"dim(shapes.w, 2) if rank5TensorOk else 1","kernelHSpec":"dim(shapes.w, ranks.w - 2)","kernelWSpec":"dim(shapes.w, ranks.w - 1)","strideDSpec":"strideD if rank5TensorOk else 1","strideHSpec":"strideH","strideWSpec":"strideW","dilationDSpec":"dilationD if rank5TensorOk else 1","dilationHSpec":"dilationH","dilationWSpec":"dilationW","padFrontSpec":"effectivePadFront if rank5TensorOk else 0","padTopSpec":"effectivePadTop","padLeftSpec":"effectivePadLeft"},"bindings":["x","x_zero_point","cols_im2col","params","params_im2col"],"dispatch":{"x":"ceil(outSpatial / tunables.WORKGROUP_SIZE)","y":"kRows","z":"dim(shapes.x, 0)"}},{"id":"main","name":"ConvInteger.Im2ColDp4a","shader":"quant-dp4a-matmul.wgsl.jinja","bindings":["a","b_main","a_zero_point","b_zero_point","y","params__uniform"],"dispatch":{"x":"ceil(outSpatial / 64)","y":"ceil(dim(shapes.w, 0) / 8)","z":"dim(shapes.y, 0)"}}]},{"id":"dp4a_pointwise_1x1","priority":21,"when":["nchwTensorOk","ungroupedChannelsOk","kernelHeight == 1","kernelWidth == 1","strideH == 1","strideW == 1","padTop == 0 and padBottom == 0","padLeft == 0 and padRight == 0","outputHeight == inputHeight","outputWidth == inputWidth","not present.x_zero_point or scalarXZeroOk","not present.w_zero_point or scalarWZeroOk","dim(shapes.x, 1) % 4 == 0 or dim(shapes.x, 1) >= 32","pointwiseResourcesOk","pointwiseDispatchOk","packedDotTilesOk"],"derive":{"aPacked":"dim(shapes.x, 1) % 4 == 0","aStorage":"aVec4 if aPacked else aScalar","hasAZero":"present.w_zero_point","hasBZero":"present.x_zero_point","tileM":"pointwiseTileM","tileN":"pointwiseTileN","ktWords":"pointwiseKtWords"},"passes":[{"id":"main","name":"ConvInteger.Dp4aPointwise","shader":"quant-dp4a-matmul.wgsl.jinja","bindings":["a_w","b_x","a_zero_point","b_zero_point","y","params_quant_dp4a_matmul"],"dispatch":{"x":"ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y":"ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z":"dim(shapes.y, 0)"}}]},{"id":"dp4a_pointwise_1x1_per_channel","priority":21,"when":["nchwTensorOk","ungroupedChannelsOk","kernelHeight == 1","kernelWidth == 1","strideH == 1","strideW == 1","padTop == 0 and padBottom == 0","padLeft == 0 and padRight == 0","outputHeight == inputHeight","outputWidth == inputWidth","not present.x_zero_point or scalarXZeroOk","present.w_zero_point","ranks.w_zero_point == 1","dim(shapes.w_zero_point, 0) == dim(shapes.w, 0)","dim(shapes.x, 1) % 4 == 0 or dim(shapes.x, 1) >= 32","pointwiseResourcesOk","pointwiseDispatchOk","packedDotTilesOk"],"derive":{"aPacked":"dim(shapes.x, 1) % 4 == 0","aStorage":"aVec4 if aPacked else aScalar","hasAZero":"present.w_zero_point","hasBZero":"present.x_zero_point","tileM":"pointwiseTileM","tileN":"pointwiseTileN","ktWords":"pointwiseKtWords","aZeroPerRow":true},"passes":[{"id":"main","name":"ConvInteger.Dp4aPointwise","shader":"quant-dp4a-matmul.wgsl.jinja","bindings":["a_w","b_x","a_zero_point_per_row","b_zero_point","y","params_quant_dp4a_matmul"],"dispatch":{"x":"ceilDiv(outputHeight * outputWidth, pointwiseTileN)","y":"ceilDiv(dim(shapes.w, 0), pointwiseTileM)","z":"dim(shapes.y, 0)"}}]},{"id":"nchw2d_per_channel_zero_point","priority":5,"when":["nchwTensorOk","not present.x_zero_point or scalarXZeroOk","present.w_zero_point","ranks.w_zero_point == 1","dim(shapes.w_zero_point, 0) == dim(shapes.w, 0)","groupChannelsOk","outputSpatialShapeOk"],"derive":{"wZeroPerChannel":true},"passes":[{"id":"main","name":"ConvIntegerPerChannel","shader":"conv-int-accumulate-spatial.wgsl.jinja","derive":{"spatialRankSpec":2,"xZeroOmitted":"not present.x_zero_point","wZeroOmitted":false},"bindings":["x_main","w","x_zero_point_main","w_zero_point","y","params_nchw"],"dispatch":{"x":"min(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","y":"ceilDiv(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","z":1}}]},{"id":"spatial","when":["nchwTensorOk and outputSpatialShapeOk or rank5TensorOk and output3dShapeOk","not present.x_zero_point or scalarXZeroOk","not present.w_zero_point or scalarWZeroOk","groupChannelsOk"],"passes":[{"id":"main","name":"ConvInteger","shader":"conv-int-accumulate-spatial.wgsl.jinja","derive":{"spatialRankSpec":"3 if rank5TensorOk else 2","xZeroOmitted":"not present.x_zero_point","wZeroOmitted":"not present.w_zero_point"},"bindings":["x_main","w","x_zero_point_main","w_zero_point_main","y","params_nchw","params_ncdhw"],"dispatch":{"x":"min(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","y":"ceilDiv(ceilDiv((numel(shapes.y)), (tunables.WORKGROUP_SIZE)), 65535)","z":1}}]}]}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748{"name": "ai.onnx.ConvInteger","id": "_ai_onnx_convinteger_webgpu_befbf8c","version": 1,"license": "Apache-2.0","backend": { "type": "webgpu" },"digest": {"algorithm": "sha256","files": {"bench.json": "w1Y+YvLhm6rmHnI3I6fdQTErLMPyr5es6PymArrgGTA=","conv-int-accumulate-spatial.wgsl.jinja": "7393dtsdsogF8Zzus4+gZiwygpXHb15ZTWhE9VM83UA=","conv-int-im2col-spatial.wgsl.jinja": "rUkI3zRiXYyD3r5GvVRqfcLMijHGc2KA71kljasROJM=","manifest.json": "guLLSG4M/NsDkfMSVXE0qMhQ2L9fYa8oY2GLgeyOXME=","quant-dp4a-matmul.wgsl.jinja": "hfcRmXhc3rBZU5qOfHyf75KqjiAmJpqzTY7BlyvoyC8=","test.json": "T5Q9TkFCTbjYtbC//Z9DuWYARBX+XkneiZt+RCoNamI="}},"provenance": { "kernel": { "sha": "6fdf6301e2bbcc2f03bf1eaf493b7ad55ef33afc", "dirty": false } },"webgpu": {"manifestSpec": "2.1","variants": {"dp4a_im2col_ncdhw3d_scalar_zero_points": ["conv-int-im2col-spatial.wgsl.jinja", "quant-dp4a-matmul.wgsl.jinja"],"dp4a_im2col_nchw_scalar_zero_points": ["conv-int-im2col-spatial.wgsl.jinja", "quant-dp4a-matmul.wgsl.jinja"],"dp4a_pointwise_1x1_tail": ["quant-dp4a-matmul.wgsl.jinja"],"dp4a_pointwise_1x1_tail_x_zero_point_only": ["quant-dp4a-matmul.wgsl.jinja"],"dp4a_pointwise_1x1_tail_w_zero_point_only": ["quant-dp4a-matmul.wgsl.jinja"],"dp4a_pointwise_1x1_tail_no_zero_points": ["quant-dp4a-matmul.wgsl.jinja"],"dp4a_pointwise_1x1": ["quant-dp4a-matmul.wgsl.jinja"],"dp4a_pointwise_1x1_x_zero_point_only": ["quant-dp4a-matmul.wgsl.jinja"],"dp4a_pointwise_1x1_w_zero_point_only": ["quant-dp4a-matmul.wgsl.jinja"],"dp4a_pointwise_1x1_no_zero_points": ["quant-dp4a-matmul.wgsl.jinja"],"dp4a_pointwise_1x1_tail_per_channel": ["quant-dp4a-matmul.wgsl.jinja"],"dp4a_pointwise_1x1_tail_per_channel_w_zero_point_only": ["quant-dp4a-matmul.wgsl.jinja"],"dp4a_pointwise_1x1_per_channel": ["quant-dp4a-matmul.wgsl.jinja"],"dp4a_pointwise_1x1_per_channel_w_zero_point_only": ["quant-dp4a-matmul.wgsl.jinja"],"nchw2d_per_channel_zero_point": ["conv-int-accumulate-spatial.wgsl.jinja"],"nchw2d_per_channel_w_zero_point_only": ["conv-int-accumulate-spatial.wgsl.jinja"],"nchw2d_scalar_zero_points": ["conv-int-accumulate-spatial.wgsl.jinja"],"nchw2d_x_zero_point_only": ["conv-int-accumulate-spatial.wgsl.jinja"],"nchw2d_w_zero_point_only": ["conv-int-accumulate-spatial.wgsl.jinja"],"ncdhw3d_scalar_zero_points": ["conv-int-accumulate-spatial.wgsl.jinja"],"ncdhw3d_x_zero_point_only": ["conv-int-accumulate-spatial.wgsl.jinja"],"ncdhw3d_w_zero_point_only": ["conv-int-accumulate-spatial.wgsl.jinja"],"ncdhw3d_implicit_zero_points": ["conv-int-accumulate-spatial.wgsl.jinja"],"nchw_implicit_zero_points": ["conv-int-accumulate-spatial.wgsl.jinja"]}}}1{"name":"ai.onnx.ConvInteger","id":"_ai_onnx_convinteger_webgpu_d1b7c67","version":1,"license":"Apache-2.0","backend":{"type":"webgpu"},"digest":{"algorithm":"sha256","files":{"bench.json":"w1Y+YvLhm6rmHnI3I6fdQTErLMPyr5es6PymArrgGTA=","conv-int-accumulate-spatial.wgsl.jinja":"aNoDIh9f/UhH7upOE35yFfVbY5BBWuv+wpadUC3q5eE=","conv-int-im2col-spatial.wgsl.jinja":"zFQCVRtTKPVsLMUEXXIjrpglz1slGPNoqUbfjmD4AO4=","manifest.json":"cSxM39Ex0c9XKDLCURa5HIKJ6ogEsPriUhVa3BimNiA=","quant-dp4a-matmul.wgsl.jinja":"ckxNIVOW81JCyci6rfZJ0Gjq0fSBb4+KB9T5v/TX128=","test.json":"T5Q9TkFCTbjYtbC//Z9DuWYARBX+XkneiZt+RCoNamI="}},"provenance":{"kernel":{"sha":"4385228f788ddaa1bd7aec6a80a20f3ddffd8011","dirty":false}},"webgpu":{"manifestSpec":"2.2"}}
12344 unmodified lines484950515253545 unmodified lines6061626364656618 unmodified lines8586878889909134 unmodified lines12612712812913013113239 unmodified lines17217317417517617717877 unmodified lines25625725825926026126252 unmodified lines315316317318319320321{% macro quant_read_column_zero(fn_name, buffer_name, is_unsigned, present=true, per_column=false, param_name="col", return_type="i32") %}fn {{ fn_name }}({% if per_column %}{{ param_name }}: u32{% endif %}) -> {{ return_type }} {{% if per_column %}44 unmodified lines{% set needsBSum = hasAZero or aUnsigned %}var<workgroup> a_tile: array<u32, A_TILE_WORDS>;{% if needsASum %}var<workgroup> a_row_sum: array<atomic<i32>, TILE_M>;{% endif %}// Pack 4 widened A values into one u32 (byte 0 = lowest k).5 unmodified linesreturn (u32(v.x) & 0xFFu) | ((u32(v.y) & 0xFFu) << 8u) | ((u32(v.z) & 0xFFu) << 16u) | ((u32(v.w) & 0xFFu) << 24u);{% endif %}}{% if needsASum %}// Sum of the 4 bias-shifted A values of one packed word.fn sum4_a(v: vec4<{{ aScalar }}>) -> i32 {18 unmodified linesfn dot4_packed(a_word: u32, b_word: u32) -> i32 {return dot4I8Packed(a_word, b_word);}{% if needsBSum %}fn sum4_b(b0: {{ bScalar }}, b1: {{ bScalar }}, b2: {{ bScalar }}, b3: {{ bScalar }}) -> i32 {{% if bUnsigned %}34 unmodified lines{% if needsASum %}if (tid < TILE_M) {atomicStore(&a_row_sum[tid], 0);}workgroupBarrier();39 unmodified lineslet v = a[a_base4 + src_m * k_words_total + kw0 + ki];{% endif %}packed = pack_a(v);{% if needsASum %}atomicAdd(&a_row_sum[mi], sum4_a(v));{% endif %}}77 unmodified lineslet v = vec4<{{ aScalar }}>(a0, a1, a2, a3);packed = pack_a(v);{% if needsASum %}atomicAdd(&a_row_sum[tid], sum4_a(v));{% endif %}}a_tile[tid * KT_WORDS] = packed;52 unmodified lines{% endif %}acc = acc + kcc;{% if hasBias %}acc = acc + bias[{{ "col" if biasPerColumn is defined and biasPerColumn else "mr" }}];{% endif %}y[y_base + mr * params.N + col] = acc;}1234544 unmodified lines505152535455565 unmodified lines6263646566676818 unmodified lines8788899091929334 unmodified lines12812913013113213313439 unmodified lines17417517617717817918077 unmodified lines25825926026126226326452 unmodified lines317318319320321322323{% set bPrepacked = false -%}{% set ownRowSums = false -%}{% macro quant_read_column_zero(fn_name, buffer_name, is_unsigned, present=true, per_column=false, param_name="col", return_type="i32") %}fn {{ fn_name }}({% if per_column %}{{ param_name }}: u32{% endif %}) -> {{ return_type }} {{% if per_column %}44 unmodified lines{% set needsBSum = hasAZero or aUnsigned %}var<workgroup> a_tile: array<u32, A_TILE_WORDS>;{% if needsASum %}var<workgroup> a_row_sum: array<{{ "i32" if ownRowSums else "atomic<i32>" }}, TILE_M>;{% endif %}// Pack 4 widened A values into one u32 (byte 0 = lowest k).5 unmodified linesreturn (u32(v.x) & 0xFFu) | ((u32(v.y) & 0xFFu) << 8u) | ((u32(v.z) & 0xFFu) << 16u) | ((u32(v.w) & 0xFFu) << 24u);{% endif %}}{% if needsASum and not ownRowSums %}// Sum of the 4 bias-shifted A values of one packed word.fn sum4_a(v: vec4<{{ aScalar }}>) -> i32 {18 unmodified linesfn dot4_packed(a_word: u32, b_word: u32) -> i32 {return dot4I8Packed(a_word, b_word);}{% if needsBSum and not bPrepacked %}fn sum4_b(b0: {{ bScalar }}, b1: {{ bScalar }}, b2: {{ bScalar }}, b3: {{ bScalar }}) -> i32 {{% if bUnsigned %}34 unmodified lines{% if needsASum %}if (tid < TILE_M) {{{ "a_row_sum[tid] = 0;" if ownRowSums else "atomicStore(&a_row_sum[tid], 0);" }}}workgroupBarrier();39 unmodified lineslet v = a[a_base4 + src_m * k_words_total + kw0 + ki];{% endif %}packed = pack_a(v);{% if needsASum and not ownRowSums %}atomicAdd(&a_row_sum[mi], sum4_a(v));{% endif %}}77 unmodified lineslet v = vec4<{{ aScalar }}>(a0, a1, a2, a3);packed = pack_a(v);{% if needsASum %}{{ "a_row_sum[tid] += dot4_packed(packed, 0x01010101u);" if ownRowSums else "atomicAdd(&a_row_sum[tid], sum4_a(v));" }}{% endif %}}a_tile[tid * KT_WORDS] = packed;52 unmodified lines{% endif %}acc = acc + kcc;{% if hasBias %}acc = acc + bias[{{ "mr" }}];{% endif %}y[y_base + mr * params.N + col] = acc;}
README.md+17-22
build/webgpu/conv-int-accumulate-spatial.wgsl.jinja+9-6
build/webgpu/conv-int-im2col-spatial.wgsl.jinja-4
build/webgpu/manifest.json+1-882
build/webgpu/metadata.json+1-48
build/webgpu/quant-dp4a-matmul.wgsl.jinja+9-7