sync 6fdf6301e2bb
Browse filesFiles changed (7)
- README.md+2-2
- build/webgpu/group-normalization-splitk-apply.wgsl.jinja+2-1
- build/webgpu/group-normalization-splitk-partials.wgsl.jinja+2-1
- build/webgpu/group-normalization-stash-f16-serial.wgsl.jinja-3
- build/webgpu/manifest.json+13-26
- build/webgpu/metadata.json+8-8
- build/webgpu/norm-row-stats.wgsl.jinja+6-115
50 unmodified lines515253545556572 unmodified lines6061626364656650 unmodified lines- [`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 + tuning cases- [`group-normalization-splitk-apply.wgsl.jinja`](build/webgpu/group-normalization-splitk-apply.wgsl.jinja)- [`group-normalization-splitk-partials.wgsl.jinja`](build/webgpu/group-normalization-splitk-partials.wgsl.jinja)- [`group-normalization-stash-f16-serial.wgsl.jinja`](build/webgpu/group-normalization-stash-f16-serial.wgsl.jinja)2 unmodified lines## Use with `@huggingface/kernels````shnpm install --save-exact @huggingface/kernels@0.0.1-preview.2```Required output shapes and logical data types are inferred from the supplied inputs and attributes; result tensors are allocated automatically.50 unmodified lines515253545556572 unmodified lines6061626364656650 unmodified lines- [`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- [`group-normalization-splitk-apply.wgsl.jinja`](build/webgpu/group-normalization-splitk-apply.wgsl.jinja)- [`group-normalization-splitk-partials.wgsl.jinja`](build/webgpu/group-normalization-splitk-partials.wgsl.jinja)- [`group-normalization-stash-f16-serial.wgsl.jinja`](build/webgpu/group-normalization-stash-f16-serial.wgsl.jinja)2 unmodified lines## 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.
9 unmodified lines101112131415169 unmodified lines@compute @workgroup_size(WG, 1, 1)fn main(@builtin(workgroup_id) wg: vec3<u32>, @builtin(local_invocation_id) lid: vec3<u32>) {let row = wg.x;let part = wg.z;if (row >= params.rows) { return; }var pair = vec2<f32>(0.0);9 unmodified lines10111213141516179 unmodified lines@compute @workgroup_size(WG, 1, 1)fn main(@builtin(workgroup_id) wg: vec3<u32>, @builtin(local_invocation_id) lid: vec3<u32>) {// wg.y carries the row index past the dispatch fold width; wg.z is the part.let row = wg.x + wg.y * {{ DISPATCH_FOLD_WIDTH }}u;let part = wg.z;if (row >= params.rows) { return; }var pair = vec2<f32>(0.0);
6 unmodified lines789101112136 unmodified lines@compute @workgroup_size(WG, 1, 1)fn main(@builtin(workgroup_id) wg: vec3<u32>, @builtin(local_invocation_id) lid: vec3<u32>) {let row = wg.x;let part = wg.z;if (row >= params.rows) { return; }let tid = lid.x;6 unmodified lines78910111213146 unmodified lines@compute @workgroup_size(WG, 1, 1)fn main(@builtin(workgroup_id) wg: vec3<u32>, @builtin(local_invocation_id) lid: vec3<u32>) {// wg.y carries the row index past the dispatch fold width; wg.z is the part.let row = wg.x + wg.y * {{ DISPATCH_FOLD_WIDTH }}u;let part = wg.z;if (row >= params.rows) { return; }let tid = lid.x;
1234555 unmodified lines61626364656667{% if usesF16 %}enable f16;{% endif %}{{ env.wgsl.resourceDeclarations }}const HIDDEN: u32 = {{ hiddenSize }}u;55 unmodified linesreturn unpack2x16float(value & 0xffffu).x;}// ONNX GroupNormalization-21 expresses the stash_type=FLOAT16 stage as a// graph of f16 tensor operators. One invocation owns a complete group so each// intermediate addition and arithmetic stage remains f16.12355 unmodified lines596061626364{{ env.wgsl.resourceDeclarations }}const HIDDEN: u32 = {{ hiddenSize }}u;55 unmodified linesreturn unpack2x16float(value & 0xffffu).x;}// ONNX GroupNormalization-21 expresses the stash_type=FLOAT16 stage as a// graph of f16 tensor operators. One invocation owns a complete group so each// intermediate addition and arithmetic stage remains f16.
39 unmodified lines4041424344454647484950513 unmodified lines5556575859606162636465663 unmodified lines7071727374757616 unmodified lines939495969798998 unmodified lines1081091101111121131145 unmodified lines12012112212312412512612712812913013111 unmodified lines1431441451461471481491501511521531541555 unmodified lines1611621631641651661671685 unmodified lines1741751761771781791801811821831841851863 unmodified lines19019119219319419519619739 unmodified lines"groupSplitCovered": "groupRowCovered and groupRows <= tunables.SPLIT_STATS_MAX_ROWS and groupRows <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) and groupHidden >= tunables.SPLIT_STATS_MIN_HIDDEN and groupPartialBytes <= device.limits.maxStorageBufferBindingSize and groupPartialBytes <= device.limits.maxBufferSize"},"bindings": {"x": { "buffer": "read-only-storage", "elementType": "$ioElement" },"scale": { "buffer": "read-only-storage", "elementType": "$scalar" },"bias": { "buffer": "read-only-storage", "elementType": "$scalar" },"y": { "buffer": "storage", "elementType": "$ioElement" },"params": {"buffer": "uniform","struct": [{ "name": "rows", "type": "u32", "value": "groupRows" },{3 unmodified lines}]},"x_2": { "name": "x", "buffer": "read-only-storage", "elementType": "$scalar" },"params_2": {"name": "params","buffer": "uniform","struct": [{ "name": "rows", "type": "u32", "value": "groupRows" }]}},"variants": [{3 unmodified lines"derive": {"scalar": "dtypes.T","ioElement": "dtypes.T","usesF16": "dtypes.T == \"f16\"","hiddenSize": "groupHidden","spatial": "groupSpatial","channelsPerGroup": "groupChannelsPerGroup",16 unmodified lines"when": ["groupSplitCovered"],"derive": {"scalar": "dtypes.T","usesF16": "dtypes.T == \"f16\"","hiddenSize": "groupHidden","spatial": "groupSpatial","channelsPerGroup": "groupChannelsPerGroup",8 unmodified lines"id": "partials","name": "GroupNormalization.SplitKPartials","shader": "group-normalization-splitk-partials.wgsl.jinja","bindings": ["x_2", { "name": "partials", "buffer": "storage", "elementType": "vec2<f32>" }, "params_2"],"dispatch": {"x": "min(groupRows, DISPATCH_FOLD_WIDTH)","y": "ceilDiv(groupRows, DISPATCH_FOLD_WIDTH)",5 unmodified lines"name": "GroupNormalization.SplitKApply","shader": "group-normalization-splitk-apply.wgsl.jinja","bindings": ["x_2","scale","bias",{ "name": "partials", "buffer": "read-only-storage", "elementType": "vec2<f32>" },{ "arg": "y", "elementType": "$scalar" },"params_2"],"dispatch": {"x": "min(groupRows, DISPATCH_FOLD_WIDTH)",11 unmodified lines"passes": [{"id": "main","name": "GroupNormalization.group_subgroup_vec4","shader": "norm-row-stats.wgsl.jinja","derive": {"modeSpec": "\"group\"","vec4": true,"scalar": "dtypes.T","usesF16Spec": "dtypes.T == \"f16\"","hidden": "groupHidden","wg": "groupVec4Workgroup","epsilon": "attrs.epsilon",5 unmodified lines"combineSubgroups": "hasSubgroupId"},"bindings": ["x", "scale", "bias", "y", "params"],"dispatch": { "x": "min(groupRows, 65535)", "y": "ceilDiv(groupRows, 65535)", "z": 1 },"subgroupCollectivesWidth": "portable"}]},5 unmodified lines"passes": [{"id": "main","name": "GroupNormalization.group_subgroup","shader": "norm-row-stats.wgsl.jinja","derive": {"modeSpec": "\"group\"","vec4": false,"scalar": "dtypes.T","usesF16Spec": "dtypes.T == \"f16\"","hidden": "groupHidden","wg": "groupScalarWorkgroup","epsilon": "attrs.epsilon",3 unmodified lines"combineSubgroups": "hasSubgroupId"},"bindings": ["x", "scale", "bias", "y", "params"],"dispatch": { "x": "min(groupRows, 65535)", "y": "ceilDiv(groupRows, 65535)", "z": 1 },"subgroupCollectivesWidth": "portable"}]}39 unmodified lines40414243444546474849503 unmodified lines54555657585960613 unmodified lines65666768697016 unmodified lines8788899091928 unmodified lines1011021031041051061075 unmodified lines11311411511611711811912012112212312411 unmodified lines1361371381391401411421431441451465 unmodified lines1521531541551561571585 unmodified lines1641651661671681691701711721731743 unmodified lines17817918018118218318439 unmodified lines"groupSplitCovered": "groupRowCovered and groupRows <= tunables.SPLIT_STATS_MAX_ROWS and groupRows <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) and groupHidden >= tunables.SPLIT_STATS_MIN_HIDDEN and groupPartialBytes <= device.limits.maxStorageBufferBindingSize and groupPartialBytes <= device.limits.maxBufferSize"},"bindings": {"x": { "elementType": "$ioElement" },"scale": { "elementType": "$scalar" },"bias": { "elementType": "$scalar" },"y": { "elementType": "$ioElement" },"params": {"struct": [{ "name": "rows", "type": "u32", "value": "groupRows" },{3 unmodified lines}]},"x_apply": { "name": "x", "elementType": "$scalar" },"params_rows": { "name": "params", "struct": [{ "name": "rows", "type": "u32", "value": "groupRows" }] }},"variants": [{3 unmodified lines"derive": {"scalar": "dtypes.T","ioElement": "dtypes.T","hiddenSize": "groupHidden","spatial": "groupSpatial","channelsPerGroup": "groupChannelsPerGroup",16 unmodified lines"when": ["groupSplitCovered"],"derive": {"scalar": "dtypes.T","hiddenSize": "groupHidden","spatial": "groupSpatial","channelsPerGroup": "groupChannelsPerGroup",8 unmodified lines"id": "partials","name": "GroupNormalization.SplitKPartials","shader": "group-normalization-splitk-partials.wgsl.jinja","bindings": ["x_apply", { "name": "partials", "elementType": "vec2<f32>" }, "params_rows"],"dispatch": {"x": "min(groupRows, DISPATCH_FOLD_WIDTH)","y": "ceilDiv(groupRows, DISPATCH_FOLD_WIDTH)",5 unmodified lines"name": "GroupNormalization.SplitKApply","shader": "group-normalization-splitk-apply.wgsl.jinja","bindings": ["x_apply","scale","bias",{ "name": "partials", "buffer": "read-only-storage", "elementType": "vec2<f32>" },{ "arg": "y", "elementType": "$scalar" },"params_rows"],"dispatch": {"x": "min(groupRows, DISPATCH_FOLD_WIDTH)",11 unmodified lines"passes": [{"id": "main","name": "GroupNormalization.GroupSubgroupVec4","shader": "norm-row-stats.wgsl.jinja","derive": {"vec4": true,"scalar": "dtypes.T","hidden": "groupHidden","wg": "groupVec4Workgroup","epsilon": "attrs.epsilon",5 unmodified lines"combineSubgroups": "hasSubgroupId"},"bindings": ["x", "scale", "bias", "y", "params"],"dispatch": { "x": "min(groupRows, 65535)", "y": "ceilDiv(groupRows, 65535)", "z": 1 }}]},5 unmodified lines"passes": [{"id": "main","name": "GroupNormalization.GroupSubgroup","shader": "norm-row-stats.wgsl.jinja","derive": {"vec4": false,"scalar": "dtypes.T","hidden": "groupHidden","wg": "groupScalarWorkgroup","epsilon": "attrs.epsilon",3 unmodified lines"combineSubgroups": "hasSubgroupId"},"bindings": ["x", "scale", "bias", "y", "params"],"dispatch": { "x": "min(groupRows, 65535)", "y": "ceilDiv(groupRows, 65535)", "z": 1 }}]}
1234561 unmodified line89101112131415161718192021222324{"name": "ai.onnx.GroupNormalization","id": "_ai_onnx_groupnormalization_webgpu_a85b638","version": 1,"license": "Apache-2.0","backend": { "type": "webgpu" },1 unmodified line"algorithm": "sha256","files": {"bench.json": "gttctaT32ACO8eeDLTBubmz2KmY+JbRp40eLp4BLAiw=","group-normalization-splitk-apply.wgsl.jinja": "bJQ3aD6iCak7YjlH5yZZGPo8FIGY8CuCz3BwVnTnUPE=","group-normalization-splitk-partials.wgsl.jinja": "DVgljhomjpQ4XizLxIEh8NckAby7lIb6+plUaGh812A=","group-normalization-stash-f16-serial.wgsl.jinja": "Wez9kqS+lzZASbm2BpWZSsHuNTT4rqsus0NiyhmGmvY=","manifest.json": "A56uOwydeaOGyMd1ulwyeOrEUd7G8uLRbxougyW6s8g=","norm-row-stats.wgsl.jinja": "CyRuHHc7bYmXEhtvfCxLRvjhidAMvicRA5nuJJESwxg=","test.json": "jfHQT3aDoszhxWXbi2YtXb9bqMfNRQyaM3HFdPdOWA0="}},"provenance": { "kernel": { "sha": "91d990483a174128daf7673f3f37a7c890493ae1", "dirty": false } },"webgpu": {"manifestSpec": "2.0","variants": {"group_stash_f16_serial": ["group-normalization-stash-f16-serial.wgsl.jinja"],"group_splitk": ["group-normalization-splitk-apply.wgsl.jinja", "group-normalization-splitk-partials.wgsl.jinja"],1234561 unmodified line89101112131415161718192021222324{"name": "ai.onnx.GroupNormalization","id": "_ai_onnx_groupnormalization_webgpu_c63203e","version": 1,"license": "Apache-2.0","backend": { "type": "webgpu" },1 unmodified line"algorithm": "sha256","files": {"bench.json": "gttctaT32ACO8eeDLTBubmz2KmY+JbRp40eLp4BLAiw=","group-normalization-splitk-apply.wgsl.jinja": "teD7D7rpdNBVIoXSGMhWtjYhB5HegbAuP9Uq7u1socc=","group-normalization-splitk-partials.wgsl.jinja": "Tif7IYCZjN0rU9RwOjuDJRuL+nWRA+fP9NurRkyxfGA=","group-normalization-stash-f16-serial.wgsl.jinja": "R+PB+omhL6ghmEal1QbolJcaSJtiayYgBs0lPi3WcQA=","manifest.json": "QmDFj0Qi2AT20Sw051jLbEE+/46hPAiZMuFkp6ydMfE=","norm-row-stats.wgsl.jinja": "5fSl/yJ/eXZXSkHd/WTM3uDq8Wj6W/0geOtl9i36uXM=","test.json": "jfHQT3aDoszhxWXbi2YtXb9bqMfNRQyaM3HFdPdOWA0="}},"provenance": { "kernel": { "sha": "6fdf6301e2bbcc2f03bf1eaf493b7ad55ef33afc", "dirty": false } },"webgpu": {"manifestSpec": "2.1","variants": {"group_stash_f16_serial": ["group-normalization-stash-f16-serial.wgsl.jinja"],"group_splitk": ["group-normalization-splitk-apply.wgsl.jinja", "group-normalization-splitk-partials.wgsl.jinja"],
1234567891011121314151619 unmodified lines3637383940414243444546474849502 unmodified lines535455565758596061626364656667686970717273747576777879808182838485868788899091929394959651 unmodified lines1481491501511521531541551561571581591601611621631641651661671681691701711721 unmodified line1741751761771781791801811821831841851861871881891901911921931941951961971981998 unmodified lines208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255{% if usesF16Spec %}enable f16;{% endif %}{% set combineSubgroups = combineSubgroups %}{% set scalarIo = scalarIo if scalarIo is defined else false %}{% set packedBf16Embedding = packedBf16Embedding if packedBf16Embedding is defined else false %}{% set rmsChainNorm = rmsChainNorm if rmsChainNorm is defined else false %}{% set hiddenPairs = hiddenPairs | default(0) %}{% set numRows = numRows | default(0) %}{% set epsilon = epsilon | default("0.0") %}{% set epsilon2 = epsilon2 | default("0.0") %}{% set numGroupsSpec = numGroupsSpec | default(0) %}{% set cpg = cpg | default(0) %}{% set spatialVec = spatialVec | default(0) %}{% set spatial = spatial | default(0) %}{% set reduceThreadParameters = ", sg_lane: u32, sg_id: u32, num_sg: u32"19 unmodified lines{% if vec4 %}const HIDDEN_V: u32 = {{ hiddenVec }}u;{% endif %}{% if packedBf16Embedding %}const HIDDEN_PAIRS: u32 = {{ hiddenPairs }}u;const NUM_ROWS: u32 = {{ numRows }}u;{% endif %}const WG: u32 = {{ wg }}u;const EPSILON: f32 = {{ epsilon }};{% if rmsChainNorm %}const EPSILON2: f32 = {{ epsilon2 }};{% endif %}const NUM_GROUPS: u32 = {{ numGroupsSpec }}u;const CPG: u32 = {{ cpg }}u;{% if vec4 %}2 unmodified linesconst SPATIAL: u32 = {{ spatial }}u;{% endif %}{% if packedBf16Embedding %}{% if vec4 %}fn unpack_bf16_pair(word: u32) -> vec2<f32> {let bits = vec2<u32>(word & 0xffffu, word >> 16u);return bitcast<vec2<f32>>(bits << vec2<u32>(16u));}{% endif %}{% if not vec4 %}fn embedding_scalar(source_row: u32, hidden: u32) -> f32 {if (source_row >= NUM_ROWS) {return 0.0;}let word = x[source_row * HIDDEN_PAIRS + (hidden >> 1u)];let bits = select(word & 0xffffu, word >> 16u, (hidden & 1u) != 0u);return bitcast<f32>(bits << 16u);}{% endif %}{% if vec4 %}fn embedding_vec4(source_row: u32, hidden_vec: u32) -> vec4<f32> {if (source_row >= NUM_ROWS) {return vec4<f32>(0.0);}let base = source_row * HIDDEN_PAIRS + hidden_vec * 2u;let low = unpack_bf16_pair(x[base]);let high = unpack_bf16_pair(x[base + 1u]);return vec4<f32>(low, high);}{% endif %}{% endif %}{% if vec4 and scalarIo %}fn load_vec4(index: u32) -> vec4<f32> {return vec4<f32>(x[index], x[index + 1u], x[index + 2u], x[index + 3u]);}{% endif %}{% if combineSubgroups %}var<workgroup> sg_partials: array<vec2<f32>, WG>;51 unmodified linesreturn;}let tid = lid.x;{% if packedBf16Embedding %}let source_row = indices[row];{% if vec4 %}let base = row * HIDDEN_V;{% else %}let base = row * HIDDEN;{% endif %}{% elif vec4 and not scalarIo %}let base = row * HIDDEN_V;{% else %}let base = row * HIDDEN;{% endif %}{% if vec4 %}{% if scalarIo %}let shift = f32(x[base]);{% else %}let shift = f32(x[base].x);{% endif %}{% else %}let shift = f32(x[base]);{% endif %}1 unmodified linevar acc = vec2<f32>(0.0, 0.0);{% if vec4 %}for (var i = tid; i < HIDDEN_V; i = i + WG) {{% if packedBf16Embedding %}let v = embedding_vec4(source_row, i);embedding_out[base + i] = v;{% elif scalarIo %}let v = load_vec4(base + i * 4u);{% else %}let v = vec4<f32>(x[base + i]);{% endif %}let d = v - vec4<f32>(shift);acc.x = acc.x + d.x + d.y + d.z + d.w;acc.y = acc.y + dot(d, d);}{% else %}for (var i = tid; i < HIDDEN; i = i + WG) {{% if packedBf16Embedding %}let v = embedding_scalar(source_row, i);embedding_out[base + i] = v;{% else %}let v = f32(x[base + i]);{% endif %}let d = v - shift;acc.x = acc.x + d;acc.y = acc.y + d * d;8 unmodified lineslet row_mean = shift + mean_d;let g_ch_base = (row % NUM_GROUPS) * CPG;{% if rmsChainNorm %}var acc2 = 0.0;{% endif %}{% if vec4 %}for (var i = tid; i < HIDDEN_V; i = i + WG) {{% if packedBf16Embedding %}let idx = base + i;let v = embedding_vec4(source_row, i);{% elif scalarIo %}let idx = base + i * 4u;let v = load_vec4(idx);{% else %}let idx = base + i;let v = vec4<f32>(x[idx]);{% endif %}let ch = g_ch_base + i / SPATIAL_V;let normed = (v - vec4<f32>(row_mean)) / vec4<f32>(denom);y[idx] = {{ vecType }}(normed * vec4<f32>(f32(scale[ch])) + vec4<f32>(f32(bias[ch])));}{% if rmsChainNorm %}// The chained second norm reads the residual row this loop just stored. This// barrier completes those stores and any preceding shared-scratch use before// the next reduction reuses its scratch; each lane then re-reads only the// elements it wrote itself.workgroupBarrier();let total2 = reduce_scalar(acc2{{ reduceThreadArguments }});let inv2 = inverseSqrt(total2 / f32(HIDDEN) + EPSILON2);for (var i = tid; i < HIDDEN_V; i = i + WG) {let idx = base + i;let hv = vec4<f32>(y[idx]);normed2[idx] = {{ vecType }}(hv * inv2 * vec4<f32>(scale2[i]));}{% endif %}{% else %}for (var i = tid; i < HIDDEN; i = i + WG) {let idx = base + i;{% if packedBf16Embedding %}let v = embedding_scalar(source_row, i);{% else %}let v = f32(x[idx]);{% endif %}let ch = g_ch_base + i / SPATIAL;let normed = (v - row_mean) / denom;y[idx] = {{ scalar }}(normed * f32(scale[ch]) + f32(bias[ch]));1234519 unmodified lines25262728293031322 unmodified lines35363738394051 unmodified lines92939495969798991001011021031041051 unmodified line1071081091101111121131141151161171181191208 unmodified lines129130131132133134135136137138139140141142143144145146{% set scalarIo = false %}{% set packedF32 = "vec4<f32>" %}{% set spatialVec = spatialVec | default(0) %}{% set spatial = spatial | default(0) %}{% set reduceThreadParameters = ", sg_lane: u32, sg_id: u32, num_sg: u32"19 unmodified lines{% if vec4 %}const HIDDEN_V: u32 = {{ hiddenVec }}u;{% endif %}const WG: u32 = {{ wg }}u;const EPSILON: f32 = {{ epsilon }};const NUM_GROUPS: u32 = {{ numGroupsSpec }}u;const CPG: u32 = {{ cpg }}u;{% if vec4 %}2 unmodified linesconst SPATIAL: u32 = {{ spatial }}u;{% endif %}{% if combineSubgroups %}var<workgroup> sg_partials: array<vec2<f32>, WG>;51 unmodified linesreturn;}let tid = lid.x;{% if vec4 and not scalarIo %}let base = row * HIDDEN_V;{% else %}let base = row * HIDDEN;{% endif %}{% if vec4 %}let shift = f32(x[base].x);{% else %}let shift = f32(x[base]);{% endif %}1 unmodified linevar acc = vec2<f32>(0.0, 0.0);{% if vec4 %}for (var i = tid; i < HIDDEN_V; i = i + WG) {let v = {{ packedF32 }}(x[base + i]);let d = v - {{ packedF32 }}(shift);acc.x = acc.x + d.x + d.y + d.z + d.w;acc.y = acc.y + dot(d, d);}{% else %}for (var i = tid; i < HIDDEN; i = i + WG) {let v = f32(x[base + i]);let d = v - shift;acc.x = acc.x + d;acc.y = acc.y + d * d;8 unmodified lineslet row_mean = shift + mean_d;let g_ch_base = (row % NUM_GROUPS) * CPG;{% if vec4 %}for (var i = tid; i < HIDDEN_V; i = i + WG) {let idx = base + i;let v = {{ packedF32 }}(x[idx]);let ch = g_ch_base + i / SPATIAL_V;let normed = (v - vec4<f32>(row_mean)) / vec4<f32>(denom);y[idx] = {{ vecType }}(normed * vec4<f32>(f32(scale[ch])) + vec4<f32>(f32(bias[ch])));}{% else %}for (var i = tid; i < HIDDEN; i = i + WG) {let idx = base + i;let v = f32(x[idx]);let ch = g_ch_base + i / SPATIAL;let normed = (v - row_mean) / denom;y[idx] = {{ scalar }}(normed * f32(scale[ch]) + f32(bias[ch]));
README.md+2-2
build/webgpu/group-normalization-splitk-apply.wgsl.jinja+2-1
build/webgpu/group-normalization-splitk-partials.wgsl.jinja+2-1
build/webgpu/group-normalization-stash-f16-serial.wgsl.jinja-3
build/webgpu/manifest.json+13-26
build/webgpu/metadata.json+8-8
build/webgpu/norm-row-stats.wgsl.jinja+6-115