{ "domain": "com.microsoft", "name": "SkipSimplifiedLayerNormalization", "sinceVersion": 1, "description": "Adds `input` and `skip` (plus optional `bias`), then applies RMS normalization scaled by `gamma`. The optional second output exposes the pre-normalization sum. The schema's training-only mean and inverse-standard-deviation outputs are not implemented.", "inputs": [ { "role": "input", "dtype": "T", "description": "Input tensor of shape `(token_count, hidden_size)` or `(batch, sequence, hidden_size)`, normalized over the last axis." }, { "role": "skip", "dtype": "T", "description": "Residual tensor of the same shape as `input`, added before normalization." }, { "role": "gamma", "dtype": "T", "rank": 1, "description": "1-D scale tensor with shape `(hidden_size)` applied after normalization." }, { "role": "bias", "dtype": "T", "rank": 1, "optional": true, "description": "Optional 1-D bias tensor with shape `(hidden_size)` added to the `input + skip` sum." } ], "outputs": [ { "role": "output", "dtype": "T", "rank": "ranks.inputT", "shape": "shapes.inputT", "description": "Normalized output tensor with the same shape as `input`." }, { "role": "input_skip_bias_sum", "dtype": "T", "optional": true, "rank": "ranks.inputT", "shape": "shapes.inputT", "description": "Sum of `input`, `skip`, and optional `bias` before normalization, with the same shape as `input`." } ], "attributes": { "epsilon": 9.999999960041972e-13 }, "attributeDescriptions": { "epsilon": "Non-negative epsilon added to the mean square before taking the square root." }, "args": { "inputT": { "kind": "tensor", "semantic": "input", "role": "input" }, "skipT": { "kind": "tensor", "semantic": "skip", "role": "input" }, "gammaT": { "kind": "tensor", "semantic": "gamma", "role": "input" }, "biasT": { "kind": "tensor", "semantic": "bias", "role": "input", "required": false }, "outputT": { "kind": "tensor", "semantic": "output", "role": "output" }, "residualT": { "kind": "tensor", "semantic": "input_skip_bias_sum", "role": "output", "required": false } }, "typeConstraints": { "T": ["float32", "float16"] }, "derive": { "rowCount": "numel(shapes.inputT) / max(1, dim(shapes.inputT, -1))", "hiddenSize": "dim(shapes.inputT, -1)", "skipWg": "max(1, min(tunables.MAX_WORKGROUP_SIZE, device.limits.maxComputeInvocationsPerWorkgroup, device.limits.maxComputeWorkgroupSizeX, pow2ceil(hiddenSize)))", "skipWgVec4": "max(1, min(tunables.MAX_WORKGROUP_SIZE, device.limits.maxComputeInvocationsPerWorkgroup, device.limits.maxComputeWorkgroupSizeX, pow2ceil(ceilDiv(hiddenSize, 4))))", "rowDispatchFits": "rowCount <= device.limits.maxComputeWorkgroupsPerDimension * device.limits.maxComputeWorkgroupsPerDimension", "normResourcesFit": "skipWg * 8 <= device.limits.maxComputeWorkgroupStorageSize and skipWgVec4 * 8 <= device.limits.maxComputeWorkgroupStorageSize", "epsilonOk": "attrs.epsilon >= 0", "coreContract": "epsilonOk and (ranks.inputT == 2 or ranks.inputT == 3) and ranks.skipT == ranks.inputT and ranks.gammaT == 1 and ranks.outputT == ranks.inputT and sameShape(shapes.inputT, shapes.skipT) and sameShape(shapes.outputT, shapes.inputT) and dim(shapes.inputT, -1) > 0 and dim(shapes.gammaT, 0) == dim(shapes.inputT, -1)", "residualOutputContract": "present.residualT and sameShape(shapes.residualT, shapes.inputT)", "outputOnlyContract": "not present.residualT", "f32MainDtypes": "tensorDtypes.inputT == \"float32\" and tensorDtypes.skipT == \"float32\" and tensorDtypes.gammaT == \"float32\" and tensorDtypes.outputT == \"float32\"", "f16MainDtypes": "tensorDtypes.inputT == \"float16\" and tensorDtypes.skipT == \"float16\" and tensorDtypes.gammaT == \"float16\" and tensorDtypes.outputT == \"float16\"", "f32ResidualDtypes": "f32MainDtypes and tensorDtypes.residualT == \"float32\" if present.residualT else false", "f16ResidualDtypes": "f16MainDtypes and tensorDtypes.residualT == \"float16\" if present.residualT else false", "vec4Aligned": "dim(shapes.inputT, -1) % 4 == 0", "hasSubgroups": "device.features.has(\"subgroups\") and device.wgslLanguageFeatures.has(\"subgroup_id\")", "hasF16": "device.features.has(\"shader-f16\")", "no_bias_contract": "not present.biasT", "f32_bias_contract": "false if not present.biasT else (ranks.biasT == 1 and tensorDtypes.biasT == \"float32\" and dim(shapes.biasT, 0) == hiddenSize)", "f16_bias_contract": "false if not present.biasT else (ranks.biasT == 1 and tensorDtypes.biasT == \"float16\" and dim(shapes.biasT, 0) == hiddenSize)", "f32_no_bias_residual_contract": "coreContract and residualOutputContract and f32ResidualDtypes and no_bias_contract", "f32_bias_residual_contract": "coreContract and residualOutputContract and f32ResidualDtypes and f32_bias_contract", "f16_no_bias_residual_contract": "hasF16 and coreContract and residualOutputContract and f16ResidualDtypes and no_bias_contract", "f16_bias_residual_contract": "hasF16 and coreContract and residualOutputContract and f16ResidualDtypes and f16_bias_contract", "f32_no_bias_output_contract": "coreContract and outputOnlyContract and f32MainDtypes and no_bias_contract", "f32_bias_output_contract": "coreContract and outputOnlyContract and f32MainDtypes and f32_bias_contract", "f16_no_bias_output_contract": "hasF16 and coreContract and outputOnlyContract and f16MainDtypes and no_bias_contract", "f16_bias_output_contract": "hasF16 and coreContract and outputOnlyContract and f16MainDtypes and f16_bias_contract" }, "bindingSets": { "vec4_no_bias_residual": [ { "name": "input", "arg": "inputT", "semantic": "input", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar" }, { "name": "skip", "arg": "skipT", "semantic": "skip", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar" }, { "name": "gamma", "arg": "gammaT", "semantic": "gamma", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar", "length": "$HIDDEN_LEN" }, { "name": "output", "arg": "outputT", "semantic": "output", "buffer": { "type": "storage" }, "elementType": "$vectorScalar" }, { "name": "input_skip_bias_sum", "arg": "residualT", "semantic": "input_skip_bias_sum", "buffer": { "type": "storage" }, "elementType": "$vectorScalar" }, { "name": "params", "semantic": "kernel.params", "buffer": { "type": "uniform" }, "struct": { "name": "Params", "fields": [ { "name": "rows", "type": "u32", "value": "rowCount" }, { "name": "rowStride", "type": "u32", "value": "max(1, min(rowCount, device.limits.maxComputeWorkgroupsPerDimension))" }, { "name": "epsilon", "type": "f32", "value": "attrs.epsilon" } ] } } ], "vec4_bias_residual": [ { "name": "input", "arg": "inputT", "semantic": "input", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar" }, { "name": "skip", "arg": "skipT", "semantic": "skip", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar" }, { "name": "gamma", "arg": "gammaT", "semantic": "gamma", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar", "length": "$HIDDEN_LEN" }, { "name": "bias", "arg": "biasT", "semantic": "bias", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar", "length": "$HIDDEN_LEN" }, { "name": "output", "arg": "outputT", "semantic": "output", "buffer": { "type": "storage" }, "elementType": "$vectorScalar" }, { "name": "input_skip_bias_sum", "arg": "residualT", "semantic": "input_skip_bias_sum", "buffer": { "type": "storage" }, "elementType": "$vectorScalar" }, { "name": "params", "semantic": "kernel.params", "buffer": { "type": "uniform" }, "struct": { "name": "Params", "fields": [ { "name": "rows", "type": "u32", "value": "rowCount" }, { "name": "rowStride", "type": "u32", "value": "max(1, min(rowCount, device.limits.maxComputeWorkgroupsPerDimension))" }, { "name": "epsilon", "type": "f32", "value": "attrs.epsilon" } ] } } ], "vec4_no_bias_output_only": [ { "name": "input", "arg": "inputT", "semantic": "input", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar" }, { "name": "skip", "arg": "skipT", "semantic": "skip", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar" }, { "name": "gamma", "arg": "gammaT", "semantic": "gamma", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar", "length": "$HIDDEN_LEN" }, { "name": "output", "arg": "outputT", "semantic": "output", "buffer": { "type": "storage" }, "elementType": "$vectorScalar" }, { "name": "params", "semantic": "kernel.params", "buffer": { "type": "uniform" }, "struct": { "name": "Params", "fields": [ { "name": "rows", "type": "u32", "value": "rowCount" }, { "name": "rowStride", "type": "u32", "value": "max(1, min(rowCount, device.limits.maxComputeWorkgroupsPerDimension))" }, { "name": "epsilon", "type": "f32", "value": "attrs.epsilon" } ] } } ], "vec4_bias_output_only": [ { "name": "input", "arg": "inputT", "semantic": "input", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar" }, { "name": "skip", "arg": "skipT", "semantic": "skip", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar" }, { "name": "gamma", "arg": "gammaT", "semantic": "gamma", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar", "length": "$HIDDEN_LEN" }, { "name": "bias", "arg": "biasT", "semantic": "bias", "buffer": { "type": "read-only-storage" }, "elementType": "$vectorScalar", "length": "$HIDDEN_LEN" }, { "name": "output", "arg": "outputT", "semantic": "output", "buffer": { "type": "storage" }, "elementType": "$vectorScalar" }, { "name": "params", "semantic": "kernel.params", "buffer": { "type": "uniform" }, "struct": { "name": "Params", "fields": [ { "name": "rows", "type": "u32", "value": "rowCount" }, { "name": "rowStride", "type": "u32", "value": "max(1, min(rowCount, device.limits.maxComputeWorkgroupsPerDimension))" }, { "name": "epsilon", "type": "f32", "value": "attrs.epsilon" } ] } } ], "scalar_no_bias_residual": [ { "name": "input", "arg": "inputT", "semantic": "input", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar" }, { "name": "skip", "arg": "skipT", "semantic": "skip", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar" }, { "name": "gamma", "arg": "gammaT", "semantic": "gamma", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar", "length": "$HIDDEN_LEN" }, { "name": "output", "arg": "outputT", "semantic": "output", "buffer": { "type": "storage" }, "elementType": "$scalar" }, { "name": "input_skip_bias_sum", "arg": "residualT", "semantic": "input_skip_bias_sum", "buffer": { "type": "storage" }, "elementType": "$scalar" }, { "name": "params", "semantic": "kernel.params", "buffer": { "type": "uniform" }, "struct": { "name": "Params", "fields": [ { "name": "rows", "type": "u32", "value": "rowCount" }, { "name": "epsilon", "type": "f32", "value": "attrs.epsilon" } ] } } ], "scalar_bias_residual": [ { "name": "input", "arg": "inputT", "semantic": "input", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar" }, { "name": "skip", "arg": "skipT", "semantic": "skip", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar" }, { "name": "gamma", "arg": "gammaT", "semantic": "gamma", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar", "length": "$HIDDEN_LEN" }, { "name": "bias", "arg": "biasT", "semantic": "bias", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar", "length": "$HIDDEN_LEN" }, { "name": "output", "arg": "outputT", "semantic": "output", "buffer": { "type": "storage" }, "elementType": "$scalar" }, { "name": "input_skip_bias_sum", "arg": "residualT", "semantic": "input_skip_bias_sum", "buffer": { "type": "storage" }, "elementType": "$scalar" }, { "name": "params", "semantic": "kernel.params", "buffer": { "type": "uniform" }, "struct": { "name": "Params", "fields": [ { "name": "rows", "type": "u32", "value": "rowCount" }, { "name": "epsilon", "type": "f32", "value": "attrs.epsilon" } ] } } ], "scalar_no_bias_output_only": [ { "name": "input", "arg": "inputT", "semantic": "input", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar" }, { "name": "skip", "arg": "skipT", "semantic": "skip", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar" }, { "name": "gamma", "arg": "gammaT", "semantic": "gamma", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar", "length": "$HIDDEN_LEN" }, { "name": "output", "arg": "outputT", "semantic": "output", "buffer": { "type": "storage" }, "elementType": "$scalar" }, { "name": "params", "semantic": "kernel.params", "buffer": { "type": "uniform" }, "struct": { "name": "Params", "fields": [ { "name": "rows", "type": "u32", "value": "rowCount" }, { "name": "epsilon", "type": "f32", "value": "attrs.epsilon" } ] } } ], "scalar_bias_output_only": [ { "name": "input", "arg": "inputT", "semantic": "input", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar" }, { "name": "skip", "arg": "skipT", "semantic": "skip", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar" }, { "name": "gamma", "arg": "gammaT", "semantic": "gamma", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar", "length": "$HIDDEN_LEN" }, { "name": "bias", "arg": "biasT", "semantic": "bias", "buffer": { "type": "read-only-storage" }, "elementType": "$scalar", "length": "$HIDDEN_LEN" }, { "name": "output", "arg": "outputT", "semantic": "output", "buffer": { "type": "storage" }, "elementType": "$scalar" }, { "name": "params", "semantic": "kernel.params", "buffer": { "type": "uniform" }, "struct": { "name": "Params", "fields": [ { "name": "rows", "type": "u32", "value": "rowCount" }, { "name": "epsilon", "type": "f32", "value": "attrs.epsilon" } ] } } ] }, "tunables": { "MAX_WORKGROUP_SIZE": 256 }, "variants": [ { "id": "no_bias_vec4_f16", "priority": 21, "when": ["f16_no_bias_residual_contract", "vec4Aligned", "normResourcesFit", "rowDispatchFits"], "constants": { "scalar": "\"f16\"", "vectorScalar": "\"vec4\"", "hasBias": "\"no_bias\" == \"bias\"", "HIDDEN_LEN": "hiddenSize / 4" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization.Vec4", "source": { "shader": "norm-skip-row-vec4.wgsl.jinja", "inputs": { "simplified": true, "hasBias": "\"no_bias\" == \"bias\"", "hasBeta": false, "writeResidualSum": true, "usesF16": true, "hidden": "hiddenSize", "hiddenVec": "hiddenSize / 4", "wg": "skipWgVec4", "vecType": "\"vec4\"", "useSubgroups": "hasSubgroups" } }, "subgroupCollectivesWidth": "portable", "bindings": "vec4_no_bias_residual", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "no_bias_vec4", "priority": 20, "when": ["f32_no_bias_residual_contract", "vec4Aligned", "normResourcesFit", "rowDispatchFits"], "constants": { "scalar": "\"f32\"", "vectorScalar": "\"vec4\"", "hasBias": "\"no_bias\" == \"bias\"", "HIDDEN_LEN": "hiddenSize / 4" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization.Vec4", "source": { "shader": "norm-skip-row-vec4.wgsl.jinja", "inputs": { "simplified": true, "hasBias": "\"no_bias\" == \"bias\"", "hasBeta": false, "writeResidualSum": true, "usesF16": false, "hidden": "hiddenSize", "hiddenVec": "hiddenSize / 4", "wg": "skipWgVec4", "vecType": "\"vec4\"", "useSubgroups": "hasSubgroups" } }, "subgroupCollectivesWidth": "portable", "bindings": "vec4_no_bias_residual", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "no_bias_output_only_vec4", "priority": 20, "when": ["f32_no_bias_output_contract", "vec4Aligned", "normResourcesFit", "rowDispatchFits"], "constants": { "scalar": "\"f32\"", "vectorScalar": "\"vec4\"", "hasBias": "\"no_bias\" == \"bias\"", "HIDDEN_LEN": "hiddenSize / 4" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization.Vec4OutputOnly", "source": { "shader": "norm-skip-row-vec4.wgsl.jinja", "inputs": { "simplified": true, "hasBias": "\"no_bias\" == \"bias\"", "hasBeta": false, "writeResidualSum": false, "usesF16": false, "hidden": "hiddenSize", "hiddenVec": "hiddenSize / 4", "wg": "skipWgVec4", "vecType": "\"vec4\"", "useSubgroups": "hasSubgroups" } }, "subgroupCollectivesWidth": "portable", "bindings": "vec4_no_bias_output_only", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "no_bias_output_only_vec4_f16", "priority": 21, "when": ["f16_no_bias_output_contract", "vec4Aligned", "normResourcesFit", "rowDispatchFits"], "constants": { "scalar": "\"f16\"", "vectorScalar": "\"vec4\"", "hasBias": "\"no_bias\" == \"bias\"", "HIDDEN_LEN": "hiddenSize / 4" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization.Vec4OutputOnly", "source": { "shader": "norm-skip-row-vec4.wgsl.jinja", "inputs": { "simplified": true, "hasBias": "\"no_bias\" == \"bias\"", "hasBeta": false, "writeResidualSum": false, "usesF16": true, "hidden": "hiddenSize", "hiddenVec": "hiddenSize / 4", "wg": "skipWgVec4", "vecType": "\"vec4\"", "useSubgroups": "hasSubgroups" } }, "subgroupCollectivesWidth": "portable", "bindings": "vec4_no_bias_output_only", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "no_bias", "priority": 0, "when": ["f32_no_bias_residual_contract", "normResourcesFit", "rowDispatchFits"], "constants": { "simplified": true, "useSubgroups": false, "hasBeta": false, "writeResidualSum": true, "hasBias": "\"no_bias\" == \"bias\"", "scalar": "\"f32\"", "hiddenSize": "dim(shapes.inputT, -1)", "workgroupSize": "skipWg", "HIDDEN_LEN": "hiddenSize" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization", "shader": "norm-skip-row.wgsl.jinja", "bindings": "scalar_no_bias_residual", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "no_bias_f16", "requires": { "features": ["shader-f16"] }, "priority": 0, "when": ["f16_no_bias_residual_contract", "normResourcesFit", "rowDispatchFits"], "constants": { "simplified": true, "useSubgroups": false, "hasBeta": false, "writeResidualSum": true, "hasBias": "\"no_bias\" == \"bias\"", "scalar": "\"f16\"", "usesF16": true, "hiddenSize": "dim(shapes.inputT, -1)", "workgroupSize": "skipWg", "HIDDEN_LEN": "hiddenSize" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization", "shader": "norm-skip-row.wgsl.jinja", "bindings": "scalar_no_bias_residual", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "no_bias_output_only_f16", "requires": { "features": ["shader-f16"] }, "priority": 0, "when": ["f16_no_bias_output_contract", "normResourcesFit", "rowDispatchFits"], "constants": { "simplified": true, "useSubgroups": false, "hasBeta": false, "writeResidualSum": false, "hasBias": "\"no_bias\" == \"bias\"", "scalar": "\"f16\"", "usesF16": true, "hiddenSize": "dim(shapes.inputT, -1)", "workgroupSize": "skipWg", "HIDDEN_LEN": "hiddenSize" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization.OutputOnly", "shader": "norm-skip-row.wgsl.jinja", "bindings": "scalar_no_bias_output_only", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "no_bias_output_only", "priority": 0, "when": ["f32_no_bias_output_contract", "normResourcesFit", "rowDispatchFits"], "constants": { "simplified": true, "useSubgroups": false, "hasBeta": false, "writeResidualSum": false, "hasBias": "\"no_bias\" == \"bias\"", "scalar": "\"f32\"", "hiddenSize": "dim(shapes.inputT, -1)", "workgroupSize": "skipWg", "HIDDEN_LEN": "hiddenSize" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization.OutputOnly", "shader": "norm-skip-row.wgsl.jinja", "bindings": "scalar_no_bias_output_only", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "bias_vec4_f16", "priority": 21, "when": ["f16_bias_residual_contract", "vec4Aligned", "normResourcesFit", "rowDispatchFits"], "constants": { "scalar": "\"f16\"", "vectorScalar": "\"vec4\"", "hasBias": "\"bias\" == \"bias\"", "HIDDEN_LEN": "hiddenSize / 4" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization.Vec4", "source": { "shader": "norm-skip-row-vec4.wgsl.jinja", "inputs": { "simplified": true, "hasBias": "\"bias\" == \"bias\"", "hasBeta": false, "writeResidualSum": true, "usesF16": true, "hidden": "hiddenSize", "hiddenVec": "hiddenSize / 4", "wg": "skipWgVec4", "vecType": "\"vec4\"", "useSubgroups": "hasSubgroups" } }, "subgroupCollectivesWidth": "portable", "bindings": "vec4_bias_residual", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "bias_vec4", "priority": 20, "when": ["f32_bias_residual_contract", "vec4Aligned", "normResourcesFit", "rowDispatchFits"], "constants": { "scalar": "\"f32\"", "vectorScalar": "\"vec4\"", "hasBias": "\"bias\" == \"bias\"", "HIDDEN_LEN": "hiddenSize / 4" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization.Vec4", "source": { "shader": "norm-skip-row-vec4.wgsl.jinja", "inputs": { "simplified": true, "hasBias": "\"bias\" == \"bias\"", "hasBeta": false, "writeResidualSum": true, "usesF16": false, "hidden": "hiddenSize", "hiddenVec": "hiddenSize / 4", "wg": "skipWgVec4", "vecType": "\"vec4\"", "useSubgroups": "hasSubgroups" } }, "subgroupCollectivesWidth": "portable", "bindings": "vec4_bias_residual", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "bias_output_only_vec4", "priority": 20, "when": ["f32_bias_output_contract", "vec4Aligned", "normResourcesFit", "rowDispatchFits"], "constants": { "scalar": "\"f32\"", "vectorScalar": "\"vec4\"", "hasBias": "\"bias\" == \"bias\"", "HIDDEN_LEN": "hiddenSize / 4" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization.Vec4OutputOnly", "source": { "shader": "norm-skip-row-vec4.wgsl.jinja", "inputs": { "simplified": true, "hasBias": "\"bias\" == \"bias\"", "hasBeta": false, "writeResidualSum": false, "usesF16": false, "hidden": "hiddenSize", "hiddenVec": "hiddenSize / 4", "wg": "skipWgVec4", "vecType": "\"vec4\"", "useSubgroups": "hasSubgroups" } }, "subgroupCollectivesWidth": "portable", "bindings": "vec4_bias_output_only", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "bias_output_only_vec4_f16", "priority": 21, "when": ["f16_bias_output_contract", "vec4Aligned", "normResourcesFit", "rowDispatchFits"], "constants": { "scalar": "\"f16\"", "vectorScalar": "\"vec4\"", "hasBias": "\"bias\" == \"bias\"", "HIDDEN_LEN": "hiddenSize / 4" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization.Vec4OutputOnly", "source": { "shader": "norm-skip-row-vec4.wgsl.jinja", "inputs": { "simplified": true, "hasBias": "\"bias\" == \"bias\"", "hasBeta": false, "writeResidualSum": false, "usesF16": true, "hidden": "hiddenSize", "hiddenVec": "hiddenSize / 4", "wg": "skipWgVec4", "vecType": "\"vec4\"", "useSubgroups": "hasSubgroups" } }, "subgroupCollectivesWidth": "portable", "bindings": "vec4_bias_output_only", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "bias", "priority": 0, "when": ["f32_bias_residual_contract", "normResourcesFit", "rowDispatchFits"], "constants": { "simplified": true, "useSubgroups": false, "hasBeta": false, "writeResidualSum": true, "hasBias": "\"bias\" == \"bias\"", "scalar": "\"f32\"", "hiddenSize": "dim(shapes.inputT, -1)", "workgroupSize": "skipWg", "HIDDEN_LEN": "hiddenSize" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization", "shader": "norm-skip-row.wgsl.jinja", "bindings": "scalar_bias_residual", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "bias_f16", "requires": { "features": ["shader-f16"] }, "priority": 0, "when": ["f16_bias_residual_contract", "normResourcesFit", "rowDispatchFits"], "constants": { "simplified": true, "useSubgroups": false, "hasBeta": false, "writeResidualSum": true, "hasBias": "\"bias\" == \"bias\"", "scalar": "\"f16\"", "usesF16": true, "hiddenSize": "dim(shapes.inputT, -1)", "workgroupSize": "skipWg", "HIDDEN_LEN": "hiddenSize" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization", "shader": "norm-skip-row.wgsl.jinja", "bindings": "scalar_bias_residual", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "bias_output_only_f16", "requires": { "features": ["shader-f16"] }, "priority": 0, "when": ["f16_bias_output_contract", "normResourcesFit", "rowDispatchFits"], "constants": { "simplified": true, "useSubgroups": false, "hasBeta": false, "writeResidualSum": false, "hasBias": "\"bias\" == \"bias\"", "scalar": "\"f16\"", "usesF16": true, "hiddenSize": "dim(shapes.inputT, -1)", "workgroupSize": "skipWg", "HIDDEN_LEN": "hiddenSize" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization.OutputOnly", "shader": "norm-skip-row.wgsl.jinja", "bindings": "scalar_bias_output_only", "dispatch": { "workgroups": "rowCount" } } ] }, { "id": "bias_output_only", "priority": 0, "when": ["f32_bias_output_contract", "normResourcesFit", "rowDispatchFits"], "constants": { "simplified": true, "useSubgroups": false, "hasBeta": false, "writeResidualSum": false, "hasBias": "\"bias\" == \"bias\"", "scalar": "\"f32\"", "hiddenSize": "dim(shapes.inputT, -1)", "workgroupSize": "skipWg", "HIDDEN_LEN": "hiddenSize" }, "passes": [ { "id": "main", "name": "SkipSimplifiedLayerNormalization.OutputOnly", "shader": "norm-skip-row.wgsl.jinja", "bindings": "scalar_bias_output_only", "dispatch": { "workgroups": "rowCount" } } ] } ] }