sync 6fdf6301e2bb
Browse filesFiles changed (7)
11 unmodified lines12131415151617182 unmodified lines212223242425262724 unmodified lines5253545556575859606162636465606667686970717266737475768 unmodified lines858687818283848889909192939411 unmodified lines
## Description
Multimodal rotary position embedding (M-RoPE) for Qwen models. Each token has temporal, height, and width position streams; `mrope_section` partitions the half-rotary axis and `mrope_layout` assigns them. Text-only tokens set all streams equal, reducing the op to `RotaryEmbedding`. The effective rotary dimension must be positive and even; an odd head size is supported with a smaller even `rotary_embedding_dim`. This package supports float16/float32 and non-packed mode; bfloat16 and packed batching are not implemented. Position ids must be valid non-negative cache-row indices.Multimodal rotary position embedding (M-RoPE) for Qwen models. Each token has temporal, height, and width position streams; `mrope_section` partitions the half-rotary axis and `mrope_layout` assigns them. Text-only tokens set all streams equal, reducing the op to `RotaryEmbedding`. The effective rotary dimension must be positive and even; an odd head size is supported with a smaller even `rotary_embedding_dim`. This package supports float16/float32 and non-packed mode; bfloat16 and packed batching are not implemented. An out-of-range position id copies its rotation pair through unchanged.
See the [ONNX Runtime `MRotaryEmbedding` contrib-operator spec](https://github.com/microsoft/onnxruntime/blob/main/docs/ContribOperators.md#com.microsoft.MRotaryEmbedding) for the reference semantics.
2 unmodified lines| Name | Upstream name | Logical dtype | WebGPU storage | Rank | Shape | Description | Presence || --- | --- | --- | --- | --- | --- | --- | --- || `x` | `input` | `T` | same as logical dtype | — | — | Input token embeddings. Shape is `(batch_size, sequence_length, hidden_size)` for rank 3 or `(batch_size, num_heads, sequence_length, head_size)` for rank 4. The effective rotary dimension must be even, and `num_heads` is required for rank-3 input. | required || `positionIds` | `position_ids` | `M` | `uint32` | `3` | — | Logical int64 position indices of shape `(3, batch_size, sequence_length)`, holding the temporal, height and width streams in that order along the first axis. Valid positions are non-negative cache-row indices and use uint32 WebGPU storage. | required || `positionIds` | `position_ids` | `M` | `int32` | `3` | — | Logical int64 position indices of shape `(3, batch_size, sequence_length)` for temporal, height and width streams. Signed int32 storage saturates larger values; negative or out-of-cache indices copy the corresponding pair unchanged. | required || `cos` | `cos_cache` | `T` | same as logical dtype | `2` | — | Precomputed cosine values of shape `(max_sequence_length, rotary_dim/2)`, shared by all three position streams. | required || `sin` | `sin_cache` | `T` | same as logical dtype | `2` | — | Precomputed sine values with the same shape and type as `cos_cache`. | required |
24 unmodified lines| `T` | `float32`, `float16` || `M` | `int64` |
## Implementation variants
One implementation is selected per call from the device capabilities, the request shapes and the dtypes; these notes say what each one covers.
- `pairs4` — Four contiguous split-half pairs share vector activation loads and stores. Each component gathers its own position stream and preserves scaled-coefficient rounding to the storage type.
## 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 + tuning cases- [`bench.json`](build/webgpu/bench.json) — benchmark cases- [`mrotary-embedding-vector.wgsl.jinja`](build/webgpu/mrotary-embedding-vector.wgsl.jinja)- [`mrotary-embedding.wgsl.jinja`](build/webgpu/mrotary-embedding.wgsl.jinja)
## Use with `@huggingface/kernels`
```shnpm install --save-exact @huggingface/kernels@0.0.1-preview.2npm 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.8 unmodified lines
const kernel = await getKernel("webgpu-kernels/com.microsoft.MRotaryEmbedding", { version: 1 });const { y } = await kernel({ x: { data: xData, shape: [1, 4, 16] }, positionIds: { data: positionIdsData, shape: [3, 1, 4] }, cos: { data: cosData, shape: [8, 4] }, sin: { data: sinData, shape: [8, 4] }, x: { data: xData, shape: [2, 2, 16] }, positionIds: { data: positionIdsData, shape: [3, 2, 2] }, cos: { data: cosData, shape: [2, 4] }, sin: { data: sinData, shape: [2, 4] },}, { attrs: { num_heads: 2, mrope_section: [2, 1, 1] },});13 unmodified lines141516171718192020 unmodified lines41424344454647484950514445464729 unmodified lines777879878081828332 unmodified lines11611711812612712812913013113213311912012112229 unmodified lines15215315416915515615715834 unmodified lines19319419521019619719819930 unmodified lines23023123224723323423523614 unmodified lines25125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336413 unmodified lines "vars": { "elems": 16384, "rotPairs": 8192 }, "inputs": { "x": { "shape": [1, 4, 64, 64], "dtype": "float32", "dist": "normal", "seed": 1000, "scale": 0.2 }, "positionIds": { "shape": [3, 1, 64], "dtype": "uint32", "dist": "uniform", "seed": 1001, "min": 0, "max": 127 }, "positionIds": { "shape": [3, 1, 64], "dtype": "int32", "dist": "uniform", "seed": 1001, "min": 0, "max": 127 }, "cos": { "shape": [128, 32], "dtype": "float32", "dist": "uniform", "seed": 1002, "scale": 0.1, "offset": 0.9 }, "sin": { "shape": [128, 32], "dtype": "float32", "dist": "uniform", "seed": 1003, "scale": 0.1 } },20 unmodified lines }, "inputs": { "x": { "shape": [1, 16, 1, 128], "dtype": "float32", "dist": "normal", "seed": 1000, "scale": 0.2 }, "positionIds": { "shape": [3, 1, 1], "dtype": "uint32", "dist": "uniform", "seed": 1001, "min": 0, "max": 32767 }, "positionIds": { "shape": [3, 1, 1], "dtype": "int32", "dist": "uniform", "seed": 1001, "min": 0, "max": 32767 }, "cos": { "shape": [32768, 64], "dtype": "float32",29 unmodified lines "x": { "shape": [1, 16, 512, 128], "dtype": "float32", "dist": "normal", "seed": 1000, "scale": 0.2 }, "positionIds": { "shape": [3, 1, 512], "dtype": "uint32", "dtype": "int32", "dist": "uniform", "seed": 1001, "min": 0,32 unmodified lines }, "inputs": { "x": { "shape": [1, 8, 1, 128], "dtype": "float32", "dist": "normal", "seed": 1000, "scale": 0.2 }, "positionIds": { "shape": [3, 1, 1], "dtype": "uint32", "dist": "uniform", "seed": 1001, "min": 0, "max": 32767 }, "positionIds": { "shape": [3, 1, 1], "dtype": "int32", "dist": "uniform", "seed": 1001, "min": 0, "max": 32767 }, "cos": { "shape": [32768, 64], "dtype": "float32",29 unmodified lines "x": { "shape": [1, 16, 512, 128], "dtype": "float32", "dist": "normal", "seed": 1000, "scale": 0.2 }, "positionIds": { "shape": [3, 1, 512], "dtype": "uint32", "dtype": "int32", "dist": "uniform", "seed": 1001, "min": 0,34 unmodified lines "x": { "shape": [1, 16, 512, 128], "dtype": "float16", "dist": "normal", "seed": 1000, "scale": 0.2 }, "positionIds": { "shape": [3, 1, 512], "dtype": "uint32", "dtype": "int32", "dist": "uniform", "seed": 1001, "min": 0,30 unmodified lines "x": { "shape": [4, 32, 2048, 128], "dtype": "float32", "dist": "normal", "seed": 1000, "scale": 0.2 }, "positionIds": { "shape": [3, 4, 2048], "dtype": "uint32", "dtype": "int32", "dist": "uniform", "seed": 1001, "min": 0,14 unmodified lines "primary": false, "metrics": [{ "type": "bandwidth", "value": "args.elems * 4 * 2 + args.rotPairs * 4 * 2" }] } }, { "name": "mrope-vector-neighbor-rank3-d136-float32", "preset": "model", "attrs": { "mrope_layout": 0, "interleaved": 0, "mrope_section": [1, 7, 60], "rotary_embedding_dim": 136, "scale": 0.5, "num_heads": 5 }, "vars": { "elems": 349520, "rotPairs": 174760, "dtype": "float32" }, "provenance": { "notes": "Aligned non-power-of-two head width, multiple batches, odd sequence, section-crossing vectors and non-unit cache scale. Counts logical input/output plus coefficient loads, excluding position indices and cache reuse." }, "inputs": { "x": { "shape": [2, 257, 680], "dtype": "float32", "dist": "normal", "seed": 1000, "scale": 0.2 }, "positionIds": { "shape": [3, 2, 257], "dtype": "int32", "dist": "uniform", "seed": 1001, "min": 0, "max": 512 }, "cos": { "shape": [513, 68], "dtype": "float32", "dist": "uniform", "seed": 1002, "scale": 0.1, "offset": 0.9 }, "sin": { "shape": [513, 68], "dtype": "float32", "dist": "uniform", "seed": 1003, "scale": 0.1 } }, "outputs": { "y": { "shape": [2, 257, 680], "dtype": "float32" } }, "bench": { "primary": false, "metrics": [{ "type": "bandwidth", "value": "(args.elems * 2 + args.rotPairs * 2) * dtypeBytes(args.dtype)" }] } }, { "name": "mrope-vector-neighbor-rank4-d136-float32", "preset": "model", "attrs": { "mrope_layout": 1, "interleaved": 0, "mrope_section": [1, 7, 60], "rotary_embedding_dim": 136, "scale": 0.5, "num_heads": 5 }, "vars": { "elems": 349520, "rotPairs": 174760, "dtype": "float32" }, "provenance": { "notes": "Aligned non-power-of-two head width, multiple batches, odd sequence, section-crossing vectors and non-unit cache scale. Counts logical input/output plus coefficient loads, excluding position indices and cache reuse." }, "inputs": { "x": { "shape": [2, 5, 257, 136], "dtype": "float32", "dist": "normal", "seed": 1000, "scale": 0.2 }, "positionIds": { "shape": [3, 2, 257], "dtype": "int32", "dist": "uniform", "seed": 1001, "min": 0, "max": 512 }, "cos": { "shape": [513, 68], "dtype": "float32", "dist": "uniform", "seed": 1002, "scale": 0.1, "offset": 0.9 }, "sin": { "shape": [513, 68], "dtype": "float32", "dist": "uniform", "seed": 1003, "scale": 0.1 } }, "outputs": { "y": { "shape": [2, 5, 257, 136], "dtype": "float32" } }, "bench": { "primary": false, "metrics": [{ "type": "bandwidth", "value": "(args.elems * 2 + args.rotPairs * 2) * dtypeBytes(args.dtype)" }] } }, { "name": "mrope-vector-neighbor-rank3-d136-float16", "preset": "model", "attrs": { "mrope_layout": 0, "interleaved": 0, "mrope_section": [1, 7, 60], "rotary_embedding_dim": 136, "scale": 0.5, "num_heads": 5 }, "vars": { "elems": 349520, "rotPairs": 174760, "dtype": "float16" }, "provenance": { "notes": "Aligned non-power-of-two head width, multiple batches, odd sequence, section-crossing vectors and non-unit cache scale. Counts logical input/output plus coefficient loads, excluding position indices and cache reuse." }, "inputs": { "x": { "shape": [2, 257, 680], "dtype": "float16", "dist": "normal", "seed": 1000, "scale": 0.2 }, "positionIds": { "shape": [3, 2, 257], "dtype": "int32", "dist": "uniform", "seed": 1001, "min": 0, "max": 512 }, "cos": { "shape": [513, 68], "dtype": "float16", "dist": "uniform", "seed": 1002, "scale": 0.1, "offset": 0.9 }, "sin": { "shape": [513, 68], "dtype": "float16", "dist": "uniform", "seed": 1003, "scale": 0.1 } }, "outputs": { "y": { "shape": [2, 257, 680], "dtype": "float16" } }, "bench": { "primary": false, "metrics": [{ "type": "bandwidth", "value": "(args.elems * 2 + args.rotPairs * 2) * dtypeBytes(args.dtype)" }] } }, { "name": "mrope-vector-neighbor-rank4-d136-float16", "preset": "model", "attrs": { "mrope_layout": 1, "interleaved": 0, "mrope_section": [1, 7, 60], "rotary_embedding_dim": 136, "scale": 0.5, "num_heads": 5 }, "vars": { "elems": 349520, "rotPairs": 174760, "dtype": "float16" }, "provenance": { "notes": "Aligned non-power-of-two head width, multiple batches, odd sequence, section-crossing vectors and non-unit cache scale. Counts logical input/output plus coefficient loads, excluding position indices and cache reuse." }, "inputs": { "x": { "shape": [2, 5, 257, 136], "dtype": "float16", "dist": "normal", "seed": 1000, "scale": 0.2 }, "positionIds": { "shape": [3, 2, 257], "dtype": "int32", "dist": "uniform", "seed": 1001, "min": 0, "max": 512 }, "cos": { "shape": [513, 68], "dtype": "float16", "dist": "uniform", "seed": 1002, "scale": 0.1, "offset": 0.9 }, "sin": { "shape": [513, 68], "dtype": "float16", "dist": "uniform", "seed": 1003, "scale": 0.1 } }, "outputs": { "y": { "shape": [2, 5, 257, 136], "dtype": "float16" } }, "bench": { "primary": false, "metrics": [{ "type": "bandwidth", "value": "(args.elems * 2 + args.rotPairs * 2) * dtypeBytes(args.dtype)" }] } } ]}3 unmodified lines45677891026 unmodified lines373839404041424343444546474849454647484950515152535556575455565758596061636263646566676866676869707172737475727374757677788081798081828384858686878788898990919192939495969797989910098991001011021021031031041051061071071081091101111101111121131141151151161171181191201211211221231241231241251261273 unmodified lines "sinceVersion": 1, "inputs": { "x": { "onnx": "input", "dtype": "T" }, "positionIds": { "onnx": "position_ids", "dtype": "M", "rank": 3, "storage": "uint32", "narrowing": "checked" }, "positionIds": { "onnx": "position_ids", "dtype": "M", "rank": 3, "storage": "int32", "narrowing": "saturating" }, "cos": { "onnx": "cos_cache", "dtype": "T", "rank": 2 }, "sin": { "onnx": "sin_cache", "dtype": "T", "rank": 2 } },26 unmodified lines "sectionsDefined": "attrs.mrope_section is defined and (attrs.mrope_section | length) == 3", "sectionsValid": "sectionsDefined and attrs.mrope_section[0] >= 0 and attrs.mrope_section[1] >= 0 and attrs.mrope_section[2] >= 0 and attrs.mrope_section[0] + attrs.mrope_section[1] + attrs.mrope_section[2] == halfRotaryDim", "commonContract": "f16Ok(dtypes.T) and sameShape(shapes.x, shapes.y) and (attrs.interleaved == 0 or attrs.interleaved == 1) and (attrs.mrope_layout == 0 or attrs.mrope_layout == 1) and attrs.num_heads >= 0 and attrs.rotary_embedding_dim >= 0 and (attrs.rotary_embedding_dim == 0 or attrs.num_heads > 0) and sameShape(shapes.cos, shapes.sin) and ranks.cos == 2 and ranks.sin == 2 and sectionsValid and ranks.positionIds == 3 and dim(shapes.positionIds, 0) == 3 and dim(shapes.positionIds, 1) == dim(shapes.x, 0) and dim(shapes.positionIds, 2) == dim(shapes.x, 1 if ranks.x == 3 else 2)", "rank3Contract": "commonContract and ranks.x == 3 and ranks.y == 3 and attrs.num_heads is defined and attrs.num_heads >= 1 and dim(shapes.x, 2) % attrs.num_heads == 0 and rank3HeadSize > 0 and effectiveRotaryDim % 2 == 0 and (attrs.rotary_embedding_dim == 0 or attrs.rotary_embedding_dim <= rank3HeadSize) and halfRotaryDim * 2 == effectiveRotaryDim", "rank3Contract": "commonContract and ranks.x == 3 and ranks.y == 3 and attrs.num_heads is defined and attrs.num_heads >= 1 and dim(shapes.x, 2) % attrs.num_heads == 0 and (rank3HeadSize > 0 or numel(shapes.x) == 0) and effectiveRotaryDim % 2 == 0 and (attrs.rotary_embedding_dim == 0 or attrs.rotary_embedding_dim <= rank3HeadSize) and halfRotaryDim * 2 == effectiveRotaryDim", "rank4Contract": "commonContract and ranks.x == 4 and ranks.y == 4 and dim(shapes.x, 3) > 0 and effectiveRotaryDim % 2 == 0 and (attrs.rotary_embedding_dim == 0 or attrs.rotary_embedding_dim <= dim(shapes.x, 3)) and halfRotaryDim * 2 == effectiveRotaryDim" }, "when": ["pairDispatchOk"], "when": ["pairDispatchOk", "rank3Contract or rank4Contract"], "bindings": { "x": { "buffer": "read-only-storage", "elementType": "$T" }, "position_ids": { "arg": "positionIds", "buffer": "read-only-storage", "elementType": "u32" }, "cos_cache": { "arg": "cos", "buffer": "read-only-storage", "elementType": "$T" }, "sin_cache": { "arg": "sin", "buffer": "read-only-storage", "elementType": "$T" }, "y": { "buffer": "storage", "elementType": "$T" }, "x": { "elementType": "$T" }, "position_ids": { "arg": "positionIds", "elementType": "i32" }, "cos_cache": { "arg": "cos", "elementType": "$T" }, "sin_cache": { "arg": "sin", "elementType": "$T" }, "y": { "elementType": "$T" }, "params": { "buffer": "uniform", "struct": [ { "name": "pairCount", "type": "u32", "value": "pairCount" }, { "name": "batchSize", "type": "u32", "value": "dim(shapes.x, 0)" }, { "name": "sequenceLength", "type": "u32", "value": "dim(shapes.x, 1)" }, { "name": "numHeads", "type": "u32", "value": "attrs.num_heads" }, { "name": "headSize", "type": "u32", "value": "rank3HeadSize" }, { "name": "sequenceLength", "type": "u32", "value": "dim(shapes.x, 1 if ranks.x == 3 else 2)" }, { "name": "numHeads", "type": "u32", "value": "attrs.num_heads if ranks.x == 3 else dim(shapes.x, 1)" }, { "name": "headSize", "type": "u32", "value": "headSize" }, { "name": "rotaryDim", "type": "u32", "value": "halfRotaryDim * 2" }, { "name": "halfRotaryDim", "type": "u32", "value": "halfRotaryDim" }, { "name": "section0", "type": "u32", "value": "attrs.mrope_section[0]" }, { "name": "section1", "type": "u32", "value": "attrs.mrope_section[1]" }, { "name": "section2", "type": "u32", "value": "attrs.mrope_section[2]" }, { "name": "scale", "type": "f32", "value": "attrs.scale" } { "name": "scale", "type": "f32", "value": "attrs.scale" }, { "name": "maxSequenceLength", "type": "u32", "value": "dim(shapes.cos, 0)" } ] }, "params_2": { "name": "params", "buffer": "uniform", "x_vector": { "arg": "x", "name": "x", "elementType": "$vectorScalar" }, "y_vector": { "arg": "y", "name": "y", "elementType": "$vectorScalar" }, "params_vector": { "struct": [ { "name": "pairCount", "type": "u32", "value": "pairCount" }, { "name": "batchSize", "type": "u32", "value": "dim(shapes.x, 0)" }, { "name": "sequenceLength", "type": "u32", "value": "dim(shapes.x, 2)" }, { "name": "numHeads", "type": "u32", "value": "dim(shapes.x, 1)" }, { "name": "headSize", "type": "u32", "value": "dim(shapes.x, 3)" }, { "name": "rotaryDim", "type": "u32", "value": "halfRotaryDim * 2" }, { "name": "sequenceLength", "type": "u32", "value": "dim(shapes.x, 1 if ranks.x == 3 else 2)" }, { "name": "numHeads", "type": "u32", "value": "attrs.num_heads if ranks.x == 3 else dim(shapes.x, 1)" }, { "name": "headSize", "type": "u32", "value": "headSize" }, { "name": "halfRotaryDim", "type": "u32", "value": "halfRotaryDim" }, { "name": "section0", "type": "u32", "value": "attrs.mrope_section[0]" }, { "name": "section1", "type": "u32", "value": "attrs.mrope_section[1]" }, { "name": "section2", "type": "u32", "value": "attrs.mrope_section[2]" }, { "name": "scale", "type": "f32", "value": "attrs.scale" } ] { "name": "scale", "type": "f32", "value": "attrs.scale" }, { "name": "maxSequenceLength", "type": "u32", "value": "dim(shapes.cos, 0)" } ], "name": "params" } }, "variants": [ { "id": "rank3", "when": ["rank3Contract"], "id": "pairs4", "when": ["headSize % 8 == 0", "effectiveRotaryDim == headSize", "attrs.interleaved == 0"], "derive": { "interleaved": "attrs.interleaved != 0", "mropeSectioned": "attrs.mrope_layout == 0", "usesF16": "dtypes.T == \"f16\"", "pairWidth": "4", "vectorScalar": "\"vec4<\" ~ dtypes.T ~ \">\"", "scalar": "dtypes.T" }, "passes": [ { "id": "main", "name": "mrotary_embedding3d", "shader": "mrotary-embedding.wgsl.jinja", "derive": { "rank": 3 }, "bindings": ["x", "position_ids", "cos_cache", "sin_cache", "y", "params"], "name": "MRotaryEmbedding.Vector", "shader": "mrotary-embedding-vector.wgsl.jinja", "derive": { "rank": "ranks.x" }, "bindings": ["x_vector", "position_ids", "cos_cache", "sin_cache", "y_vector", "params_vector"], "dispatch": { "x": "min(ceilDiv((pairCount), (tunables.WORKGROUP_SIZE)), 65535)", "y": "ceilDiv(ceilDiv((pairCount), (tunables.WORKGROUP_SIZE)), 65535)", "x": "min(ceilDiv((pairCount / 4), (tunables.WORKGROUP_SIZE)), 65535)", "y": "ceilDiv(ceilDiv((pairCount / 4), (tunables.WORKGROUP_SIZE)), 65535)", "z": 1 } } ] ], "priority": 10 }, { "id": "rank4", "when": ["rank4Contract"], "id": "pairs", "derive": { "interleaved": "attrs.interleaved != 0", "mropeSectioned": "attrs.mrope_layout == 0", "usesF16": "dtypes.T == \"f16\"", "scalar": "dtypes.T" }, "passes": [ { "id": "main", "name": "mrotary_embedding4d", "name": "MRotaryEmbedding", "shader": "mrotary-embedding.wgsl.jinja", "derive": { "rank": 4 }, "bindings": ["x", "position_ids", "cos_cache", "sin_cache", "y", "params_2"], "derive": { "rank": "ranks.x" }, "bindings": ["x", "position_ids", "cos_cache", "sin_cache", "y", "params"], "dispatch": { "x": "min(ceilDiv((pairCount), (tunables.WORKGROUP_SIZE)), 65535)", "y": "ceilDiv(ceilDiv((pairCount), (tunables.WORKGROUP_SIZE)), 65535)",12334567891011121310111213141516161718181919202122{ "name": "com.microsoft.MRotaryEmbedding", "id": "_com_microsoft_mrotaryembedding_webgpu_83feafb", "id": "_com_microsoft_mrotaryembedding_webgpu_9f14b3e", "version": 1, "license": "Apache-2.0", "backend": { "type": "webgpu" }, "digest": { "algorithm": "sha256", "files": { "bench.json": "46hHXwN4zErrNbI5Kkvb00wSEt7LAjuixrnpiOUnuC8=", "manifest.json": "n2gNx3yadn8wpDXYWYTOGWFQVAiDogbtn03dXyQEAfE=", "mrotary-embedding.wgsl.jinja": "meXniZyv3KTe/4K0hd7HSYDjxS0ADty/sNevs/l3es8=", "test.json": "mQy2yFi3T6iEpqSliA+KGAipEQeV8moe0jnzSwH9ICI=" "bench.json": "O2zNl+WongpRuCa+0uG2J/53uKtH0dOeHjs0V/SP5NQ=", "manifest.json": "m6PieJLI+fSwIhyAV5llQg4PcQyE9OtvRC0w/Z3jOy0=", "mrotary-embedding-vector.wgsl.jinja": "MZwbSQREHhZKFMGn1YC7CJATkbgtimGoPwdnzafMOn8=", "mrotary-embedding.wgsl.jinja": "bMGNQWBiANeYtK1oQO0dRJjn/JwkB8ZTu/Zw/uKW2M4=", "test.json": "TLcimbROUuwC6I8+3L/QcPyKX9brKS3g2eH68BRDfqI=" } }, "provenance": { "kernel": { "sha": "91d990483a174128daf7673f3f37a7c890493ae1", "dirty": false } }, "provenance": { "kernel": { "sha": "6fdf6301e2bbcc2f03bf1eaf493b7ad55ef33afc", "dirty": false } }, "webgpu": { "manifestSpec": "2.0", "variants": { "rank3": ["mrotary-embedding.wgsl.jinja"], "rank4": ["mrotary-embedding.wgsl.jinja"] } "manifestSpec": "2.1", "variants": { "pairs4": ["mrotary-embedding-vector.wgsl.jinja"], "pairs": ["mrotary-embedding.wgsl.jinja"] } }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475{% macro mrope_cache_index(pair, suffix="") %} // Which of the three position streams owns this cache column. var stream{{ suffix }} = 0u;{% if mropeSectioned %} // Sectioned (Qwen2-VL, Qwen2.5-VL): three contiguous chunks [T | H | W]. if ({{ pair }} >= params.section0 && {{ pair }} < params.section0 + params.section1) { stream{{ suffix }} = 1u; } else if ({{ pair }} >= params.section0 + params.section1) { stream{{ suffix }} = 2u; }{% else %} // Interleaved (Qwen3-VL, Qwen3.5): T everywhere, then H over every third column // from offset 1 and W over every third column from offset 2, each bounded by its // own section length. if ({{ pair }} % 3u == 1u && {{ pair }} / 3u < params.section1) { stream{{ suffix }} = 1u; } else if ({{ pair }} % 3u == 2u && {{ pair }} / 3u < params.section2) { stream{{ suffix }} = 2u; }{% endif %}
let pos{{ suffix }} = position_ids[(stream{{ suffix }} * params.batchSize + batch) * params.sequenceLength + token]; let valid{{ suffix }} = pos{{ suffix }} >= 0 && u32(pos{{ suffix }}) < params.maxSequenceLength; let cache{{ suffix }} = u32(pos{{ suffix }}) * params.halfRotaryDim + {{ pair }};{% 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.{% if bound == "" %} let {{ name }} = gid.x + gid.y * {{ DISPATCH_FOLD_WIDTH }}u * {{ wgTerm }};{% elif guardInline %} let {{ name }} = gid.x + gid.y * {{ DISPATCH_FOLD_WIDTH }}u * {{ wgTerm }}; if ({{ name }} >= {{ bound }}) { return; }{% else %} let {{ name }} = gid.x + gid.y * {{ DISPATCH_FOLD_WIDTH }}u * {{ wgTerm }}; if ({{ name }} >= {{ bound }}) { return; }{% endif %}{% endmacro %}{{ env.wgsl.resourceDeclarations }}// A contiguous vector owns several split-half rotation pairs. Each component// gathers its own stream position, including vectors crossing section boundaries.@compute @workgroup_size({{ tunables.WORKGROUP_SIZE }})fn main(@builtin(global_invocation_id) gid: vec3<u32>) {{{ flat_index_2d(tunables.WORKGROUP_SIZE, "p", "params.pairCount / " ~ pairWidth ~ "u") }} let tasksPerHead = params.headSize / {{ 2 * pairWidth }}u; let task = p % tasksPerHead; let headFlat = p / tasksPerHead; let base = headFlat * (params.headSize / {{ pairWidth }}u);{% if rank == 3 %} let token = (headFlat / params.numHeads) % params.sequenceLength; let batch = headFlat / (params.numHeads * params.sequenceLength);{% else %} let token = headFlat % params.sequenceLength; let batch = (headFlat / params.sequenceLength) / params.numHeads;{% endif %}{% for i in range(pairWidth) %} let pair{{ i }} = task * {{ pairWidth }}u + {{ i }}u;{{ mrope_cache_index("pair" ~ i, i) }}{% endfor %} let a = vec{{ pairWidth }}<f32>(x[base + task]); let bIndex = base + params.halfRotaryDim / {{ pairWidth }}u + task; let b = vec{{ pairWidth }}<f32>(x[bIndex]); var outA = x[base + task]; var outB = x[bIndex];{% for i in range(pairWidth) %} if (valid{{ i }}) { // Round scaled coefficients to storage T before evaluating the rotation. let cf = f32({{ scalar }}(f32(cos_cache[cache{{ i }}]) * params.scale)); let sf = f32({{ scalar }}(f32(sin_cache[cache{{ i }}]) * params.scale)); outA[{{ i }}] = {{ scalar }}(a[{{ i }}] * cf - b[{{ i }}] * sf); outB[{{ i }}] = {{ scalar }}(a[{{ i }}] * sf + b[{{ i }}] * cf); }{% endfor %} y[base + task] = outA; y[bIndex] = outB;}12345678910111213141516171234567891011121314151617181920212223242526272829202122302324252627313230313233343533343536371 unmodified line394041434243444521 unmodified lines6768697172737475767778798081828384858687888990919293949596707172731 unmodified line757677787980818283848586878889{% macro flat_index_2d(name="i", bound="params.count", guardInline=false, note="dispatch-limit") %}{% if note == "dispatch-limit" %} // 2D-folded flat index: gid.y carries the high bits past the dispatch's // per-axis workgroup fold width (outputs > 16.7M elements).{% elif note == "limit" %} // 2D-folded flat index: gid.y carries the high bits past the dispatch's // per-axis workgroup fold width.{% elif note == "device-axis" %} // The flat dispatch is folded across x/y at a fixed per-axis workgroup // width; gid.y carries the high portion of the output index.{% elif note == "vec4-limit" %} // 2D-folded flat vec4 index: gid.y carries the high bits past the dispatch's // per-axis workgroup fold width (the dispatch caps x and spills into y).{% elif note == "element-limit" %} // 2D-folded flat element index: gid.y carries the high bits past the // dispatch's per-axis workgroup fold width.{% elif note == "dispatch" %}{% macro mrope_cache_index(pair, suffix="") %} // Which of the three position streams owns this cache column. var stream{{ suffix }} = 0u;{% if mropeSectioned %} // Sectioned (Qwen2-VL, Qwen2.5-VL): three contiguous chunks [T | H | W]. if ({{ pair }} >= params.section0 && {{ pair }} < params.section0 + params.section1) { stream{{ suffix }} = 1u; } else if ({{ pair }} >= params.section0 + params.section1) { stream{{ suffix }} = 2u; }{% else %} // Interleaved (Qwen3-VL, Qwen3.5): T everywhere, then H over every third column // from offset 1 and W over every third column from offset 2, each bounded by its // own section length. if ({{ pair }} % 3u == 1u && {{ pair }} / 3u < params.section1) { stream{{ suffix }} = 1u; } else if ({{ pair }} % 3u == 2u && {{ pair }} / 3u < params.section2) { stream{{ suffix }} = 2u; }{% endif %}
let pos{{ suffix }} = position_ids[(stream{{ suffix }} * params.batchSize + batch) * params.sequenceLength + token]; let valid{{ suffix }} = pos{{ suffix }} >= 0 && u32(pos{{ suffix }}) < params.maxSequenceLength; let cache{{ suffix }} = u32(pos{{ suffix }}) * params.halfRotaryDim + {{ pair }};{% 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.{% endif %}{% if bound == "" %} let {{ name }} = gid.x + gid.y * {{ DISPATCH_FOLD_WIDTH }}u * {{ tunables.WORKGROUP_SIZE }}u; let {{ name }} = gid.x + gid.y * {{ DISPATCH_FOLD_WIDTH }}u * {{ wgTerm }};{%- elif guardInline %} let {{ name }} = gid.x + gid.y * {{ DISPATCH_FOLD_WIDTH }}u * {{ tunables.WORKGROUP_SIZE }}u; if ({{ name }} >= {{ bound }}) { return; }{%- else %} let {{ name }} = gid.x + gid.y * {{ DISPATCH_FOLD_WIDTH }}u * {{ tunables.WORKGROUP_SIZE }}u; if ({{ name }} >= {{ bound }}) { return; }{%- endif %}{% endmacro %}
{% if usesF16 %}enable f16;{% endif %}{{ env.wgsl.resourceDeclarations }} }{% endmacro %}{{ env.wgsl.resourceDeclarations }}// M-RoPE: three position streams (temporal, height, width) index one cos/sin cache.// The half-rotary axis is partitioned among the streams, so each rotated pair picks// its own stream and gathers that stream's position for this token. One invocation1 unmodified line// use the remaining pair lanes to copy two unchanged tail values.@compute @workgroup_size({{ tunables.WORKGROUP_SIZE }})fn main(@builtin(global_invocation_id) gid: vec3<u32>) {{{ flat_index_2d("p", "params.pairCount", note="") }}{{ flat_index_2d(tunables.WORKGROUP_SIZE, "p", "params.pairCount") }}
let tasksPerHead = (params.headSize + 1u) / 2u; let task = p % tasksPerHead;21 unmodified lines let batch = (headFlat / params.sequenceLength) / params.numHeads;{% endif %}
// Which of the three position streams owns this cache column. var stream = 0u;{% if mropeSectioned %} // Sectioned (Qwen2-VL, Qwen2.5-VL): three contiguous chunks [T | H | W]. if (pair >= params.section0 && pair < params.section0 + params.section1) { stream = 1u; } else if (pair >= params.section0 + params.section1) { stream = 2u; }{% else %} // Interleaved (Qwen3-VL, Qwen3.5): T everywhere, then H over every third column // from offset 1 and W over every third column from offset 2, each bounded by its // own section length. if (pair % 3u == 1u && pair / 3u < params.section1) { stream = 1u; } else if (pair % 3u == 2u && pair / 3u < params.section2) { stream = 2u; }{% endif %}
let pos = position_ids[(stream * params.batchSize + batch) * params.sequenceLength + token]; let cache = pos * params.halfRotaryDim + pair; // Round scaled cache values to T before rotation. This intermediate cast is // observable for f16 and must not be deferred to the output store. let cf = f32({{ scalar }}(f32(cos_cache[cache]) * params.scale)); let sf = f32({{ scalar }}(f32(sin_cache[cache]) * params.scale));{{ mrope_cache_index("pair") }}{% if interleaved %} let aOffset = pair * 2u; let bOffset = aOffset + 1u;1 unmodified line let aOffset = pair; let bOffset = pair + params.halfRotaryDim;{% endif %} if (!valid) { y[base + aOffset] = x[base + aOffset]; y[base + bOffset] = x[base + bOffset]; return; } // Round scaled cache values to T before rotation. This intermediate cast is // observable for f16 and must not be deferred to the output store. let cf = f32({{ scalar }}(f32(cos_cache[cache]) * params.scale)); let sf = f32({{ scalar }}(f32(sin_cache[cache]) * params.scale)); let a = f32(x[base + aOffset]); let b = f32(x[base + bOffset]); y[base + aOffset] = {{ scalar }}(a * cf - b * sf);12334567812 unmodified lines212223222425262724 unmodified lines525354535556575813 unmodified lines727374737475767576777819 unmodified lines989910010210110210310413 unmodified lines11811912012212312412512112212312413 unmodified lines13813914014514114214314418 unmodified lines16316416517016616716816911 unmodified lines18118218318818418518618717 unmodified lines20520620721220820921021116 unmodified lines2282292302352312322332341 unmodified line23623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283{ "fixtureArrays": { "ort_sectioned_rank3_input_x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24] "ort_sectioned_rank3_input_x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], "ort_sectioned_rank3_output_y": [0.6, 1.42, 2.34, 4.1, 5.87, 7.98, 6, 7.12, 8.34, 10.7, 13.49, 16.62, 11.9, 13.37, 14.94, 19.55, 23.51, 27.81, 17.6, 19.37, 21.24, 27.05, 32.03, 37.35], "ort_interleaved_rank4_output_y": [0.4, 1.05, 1.345, 2.46, 2.39, 4.21, 3.25, 4.925, 4.395, 6.995, 5.64, 9.405, 5.8, 7.65, 7.045, 10.08, 8.39, 12.85, 8.95, 12.425, 10.395, 15.515, 11.94, 18.945] }, "cases": [ {12 unmodified lines "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 2, 5], "data": { "kind": "linspace", "start": -1.25, "end": 1.5 } }, "positionIds": { "dtype": "uint32", "dtype": "int32", "shape": [3, 1, 2], "data": { "kind": "values", "values": [0, 1, 1, 2, 2, 0] } },24 unmodified lines "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_sectioned_rank3_input_x" } } }, "positionIds": { "dtype": "uint32", "dtype": "int32", "shape": [3, 1, 2], "data": { "kind": "values", "values": [0, 1, 1, 2, 2, 3] } },13 unmodified lines "dtype": "float32", "shape": [1, 2, 12], "tolerance": 0.00001, "data": { "kind": "values", "values": [0.6, 1.42, 2.34, 4.1, 5.87, 7.98, 6.0, 7.12, 8.34, 10.7, 13.49, 16.62, 11.9, 13.37, 14.94, 19.55, 23.51, 27.81, 17.6, 19.37, 21.24, 27.05, 32.03, 37.35] } "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_sectioned_rank3_output_y" } } } } },19 unmodified lines "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_sectioned_rank3_input_x" } } }, "positionIds": { "dtype": "uint32", "dtype": "int32", "shape": [3, 1, 2], "data": { "kind": "values", "values": [0, 1, 1, 2, 2, 3] } },13 unmodified lines "dtype": "float32", "shape": [1, 2, 2, 6], "tolerance": 0.00001, "data": { "kind": "values", "values": [0.4, 1.05, 1.345, 2.46, 2.39, 4.21, 3.25, 4.925, 4.395, 6.995, 5.64, 9.405, 5.8, 7.65, 7.045, 10.08, 8.39, 12.85, 8.95, 12.425, 10.395, 15.515, 11.94, 18.945] } "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_interleaved_rank4_output_y" } } } } },13 unmodified lines "inputs": { "x": { "dtype": "float32", "shape": [2, 3, 32], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } }, "positionIds": { "dtype": "uint32", "dtype": "int32", "shape": [3, 2, 3], "data": { "kind": "values", "values": [0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7] } },18 unmodified lines "inputs": { "x": { "dtype": "float32", "shape": [1, 2, 4, 12], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } }, "positionIds": { "dtype": "uint32", "dtype": "int32", "shape": [3, 1, 4], "data": { "kind": "values", "values": [0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5] } },11 unmodified lines "inputs": { "x": { "dtype": "float32", "shape": [1, 4, 16], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } }, "positionIds": { "dtype": "uint32", "dtype": "int32", "shape": [3, 1, 4], "data": { "kind": "values", "values": [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3] } },17 unmodified lines "inputs": { "x": { "dtype": "float16", "shape": [1, 2, 3, 12], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } }, "positionIds": { "dtype": "uint32", "dtype": "int32", "shape": [3, 1, 3], "data": { "kind": "values", "values": [0, 1, 2, 1, 2, 3, 2, 3, 4] } },16 unmodified lines "inputs": { "x": { "dtype": "float32", "shape": [2, 2, 16], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } }, "positionIds": { "dtype": "uint32", "dtype": "int32", "shape": [3, 2, 2], "data": { "kind": "values", "values": [0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 0, 1] } },1 unmodified line "sin": { "dtype": "float32", "shape": [5, 4], "data": { "kind": "linspace", "start": 1.0, "end": -1.0 } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 2, 16], "tolerance": 0.00001, "relTolerance": 0.00001 } } }, { "name": "vector_boundary_float32_rank3_d8_layout0_zero1", "attrs": { "num_heads": 3, "rotary_embedding_dim": 8, "interleaved": 0, "mrope_layout": 0, "mrope_section": [0, 3, 1], "scale": 0.3 }, "inputs": { "x": { "dtype": "float32", "shape": [2, 5, 24], "data": { "kind": "fillFloat32", "sinStep": 0.113, "cosStep": 0.317, "scale": 3.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 5], "data": { "kind": "cycle", "values": [0, 4, 2, 1, 3, 4, 0] } }, "cos": { "dtype": "float32", "shape": [5, 4], "data": { "kind": "fillFloat32", "sinStep": 0.213, "cosStep": 0.437, "scale": 0.71 } }, "sin": { "dtype": "float32", "shape": [5, 4], "data": { "kind": "fillFloat32", "sinStep": 0.619, "cosStep": 0.137, "scale": 0.83 } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 5, 24], "tolerance": 0.00001, "relTolerance": 0.00001 } }, "provenance": { "notes": "Aligned vector pairs with a partial final workgroup, section-crossing cache columns, multiple batches, non-unit scale and both tensor ranks. Zero temporal section is covered at the smallest head width." } }, { "name": "vector_boundary_float32_rank3_d16_layout0_zero0", "attrs": { "num_heads": 3, "rotary_embedding_dim": 16, "interleaved": 0, "mrope_layout": 0, "mrope_section": [1, 2, 5], "scale": 0.3 }, "inputs": { "x": { "dtype": "float32", "shape": [2, 5, 48], "data": { "kind": "fillFloat32", "sinStep": 0.113, "cosStep": 0.317, "scale": 3.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 5], "data": { "kind": "cycle", "values": [0, 4, 2, 1, 3, 4, 0] } }, "cos": { "dtype": "float32", "shape": [5, 8], "data": { "kind": "fillFloat32", "sinStep": 0.213, "cosStep": 0.437, "scale": 0.71 } }, "sin": { "dtype": "float32", "shape": [5, 8], "data": { "kind": "fillFloat32", "sinStep": 0.619, "cosStep": 0.137, "scale": 0.83 } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 5, 48], "tolerance": 0.00001, "relTolerance": 0.00001 } }, "provenance": { "notes": "Aligned vector pairs with a partial final workgroup, section-crossing cache columns, multiple batches, non-unit scale and both tensor ranks. Zero temporal section is covered at the smallest head width." } }, { "name": "vector_boundary_float32_rank3_d24_layout0_zero0", "attrs": { "num_heads": 3, "rotary_embedding_dim": 24, "interleaved": 0, "mrope_layout": 0, "mrope_section": [1, 2, 9], "scale": 0.3 }, "inputs": { "x": { "dtype": "float32", "shape": [2, 5, 72], "data": { "kind": "fillFloat32", "sinStep": 0.113, "cosStep": 0.317, "scale": 3.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 5], "data": { "kind": "cycle", "values": [0, 4, 2, 1, 3, 4, 0] } }, "cos": { "dtype": "float32", "shape": [5, 12], "data": { "kind": "fillFloat32", "sinStep": 0.213, "cosStep": 0.437, "scale": 0.71 } }, "sin": { "dtype": "float32", "shape": [5, 12], "data": { "kind": "fillFloat32", "sinStep": 0.619, "cosStep": 0.137, "scale": 0.83 } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 5, 72], "tolerance": 0.00001, "relTolerance": 0.00001 } }, "provenance": { "notes": "Aligned vector pairs with a partial final workgroup, section-crossing cache columns, multiple batches, non-unit scale and both tensor ranks. Zero temporal section is covered at the smallest head width." } }, { "name": "vector_boundary_float32_rank4_d8_layout1_zero1", "attrs": { "num_heads": 3, "rotary_embedding_dim": 8, "interleaved": 0, "mrope_layout": 1, "mrope_section": [0, 3, 1], "scale": 0.3 }, "inputs": { "x": { "dtype": "float32", "shape": [2, 3, 5, 8], "data": { "kind": "fillFloat32", "sinStep": 0.113, "cosStep": 0.317, "scale": 3.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 5], "data": { "kind": "cycle", "values": [0, 4, 2, 1, 3, 4, 0] } }, "cos": { "dtype": "float32", "shape": [5, 4], "data": { "kind": "fillFloat32", "sinStep": 0.213, "cosStep": 0.437, "scale": 0.71 } }, "sin": { "dtype": "float32", "shape": [5, 4], "data": { "kind": "fillFloat32", "sinStep": 0.619, "cosStep": 0.137, "scale": 0.83 } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 3, 5, 8], "tolerance": 0.00001, "relTolerance": 0.00001 } }, "provenance": { "notes": "Aligned vector pairs with a partial final workgroup, section-crossing cache columns, multiple batches, non-unit scale and both tensor ranks. Zero temporal section is covered at the smallest head width." } }, { "name": "vector_boundary_float32_rank4_d16_layout1_zero0", "attrs": { "num_heads": 3, "rotary_embedding_dim": 16, "interleaved": 0, "mrope_layout": 1, "mrope_section": [1, 2, 5], "scale": 0.3 }, "inputs": { "x": { "dtype": "float32", "shape": [2, 3, 5, 16], "data": { "kind": "fillFloat32", "sinStep": 0.113, "cosStep": 0.317, "scale": 3.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 5], "data": { "kind": "cycle", "values": [0, 4, 2, 1, 3, 4, 0] } }, "cos": { "dtype": "float32", "shape": [5, 8], "data": { "kind": "fillFloat32", "sinStep": 0.213, "cosStep": 0.437, "scale": 0.71 } }, "sin": { "dtype": "float32", "shape": [5, 8], "data": { "kind": "fillFloat32", "sinStep": 0.619, "cosStep": 0.137, "scale": 0.83 } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 3, 5, 16], "tolerance": 0.00001, "relTolerance": 0.00001 } }, "provenance": { "notes": "Aligned vector pairs with a partial final workgroup, section-crossing cache columns, multiple batches, non-unit scale and both tensor ranks. Zero temporal section is covered at the smallest head width." } }, { "name": "vector_boundary_float32_rank4_d24_layout1_zero0", "attrs": { "num_heads": 3, "rotary_embedding_dim": 24, "interleaved": 0, "mrope_layout": 1, "mrope_section": [1, 2, 9], "scale": 0.3 }, "inputs": { "x": { "dtype": "float32", "shape": [2, 3, 5, 24], "data": { "kind": "fillFloat32", "sinStep": 0.113, "cosStep": 0.317, "scale": 3.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 5], "data": { "kind": "cycle", "values": [0, 4, 2, 1, 3, 4, 0] } }, "cos": { "dtype": "float32", "shape": [5, 12], "data": { "kind": "fillFloat32", "sinStep": 0.213, "cosStep": 0.437, "scale": 0.71 } }, "sin": { "dtype": "float32", "shape": [5, 12], "data": { "kind": "fillFloat32", "sinStep": 0.619, "cosStep": 0.137, "scale": 0.83 } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 3, 5, 24], "tolerance": 0.00001, "relTolerance": 0.00001 } }, "provenance": { "notes": "Aligned vector pairs with a partial final workgroup, section-crossing cache columns, multiple batches, non-unit scale and both tensor ranks. Zero temporal section is covered at the smallest head width." } }, { "name": "vector_boundary_float16_rank3_d8_layout0_zero1", "attrs": { "num_heads": 3, "rotary_embedding_dim": 8, "interleaved": 0, "mrope_layout": 0, "mrope_section": [0, 3, 1], "scale": 0.3 }, "inputs": { "x": { "dtype": "float16", "shape": [2, 5, 24], "data": { "kind": "fillFloat32", "sinStep": 0.113, "cosStep": 0.317, "scale": 3.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 5], "data": { "kind": "cycle", "values": [0, 4, 2, 1, 3, 4, 0] } }, "cos": { "dtype": "float16", "shape": [5, 4], "data": { "kind": "fillFloat32", "sinStep": 0.213, "cosStep": 0.437, "scale": 0.71 } }, "sin": { "dtype": "float16", "shape": [5, 4], "data": { "kind": "fillFloat32", "sinStep": 0.619, "cosStep": 0.137, "scale": 0.83 } } }, "outputs": { "y": { "dtype": "float16", "shape": [2, 5, 24], "tolerance": 0.01, "relTolerance": 0.01 } }, "provenance": { "notes": "Aligned vector pairs with a partial final workgroup, section-crossing cache columns, multiple batches, non-unit scale and both tensor ranks. Zero temporal section is covered at the smallest head width." } }, { "name": "vector_boundary_float16_rank3_d16_layout0_zero0", "attrs": { "num_heads": 3, "rotary_embedding_dim": 16, "interleaved": 0, "mrope_layout": 0, "mrope_section": [1, 2, 5], "scale": 0.3 }, "inputs": { "x": { "dtype": "float16", "shape": [2, 5, 48], "data": { "kind": "fillFloat32", "sinStep": 0.113, "cosStep": 0.317, "scale": 3.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 5], "data": { "kind": "cycle", "values": [0, 4, 2, 1, 3, 4, 0] } }, "cos": { "dtype": "float16", "shape": [5, 8], "data": { "kind": "fillFloat32", "sinStep": 0.213, "cosStep": 0.437, "scale": 0.71 } }, "sin": { "dtype": "float16", "shape": [5, 8], "data": { "kind": "fillFloat32", "sinStep": 0.619, "cosStep": 0.137, "scale": 0.83 } } }, "outputs": { "y": { "dtype": "float16", "shape": [2, 5, 48], "tolerance": 0.01, "relTolerance": 0.01 } }, "provenance": { "notes": "Aligned vector pairs with a partial final workgroup, section-crossing cache columns, multiple batches, non-unit scale and both tensor ranks. Zero temporal section is covered at the smallest head width." } }, { "name": "vector_boundary_float16_rank3_d24_layout0_zero0", "attrs": { "num_heads": 3, "rotary_embedding_dim": 24, "interleaved": 0, "mrope_layout": 0, "mrope_section": [1, 2, 9], "scale": 0.3 }, "inputs": { "x": { "dtype": "float16", "shape": [2, 5, 72], "data": { "kind": "fillFloat32", "sinStep": 0.113, "cosStep": 0.317, "scale": 3.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 5], "data": { "kind": "cycle", "values": [0, 4, 2, 1, 3, 4, 0] } }, "cos": { "dtype": "float16", "shape": [5, 12], "data": { "kind": "fillFloat32", "sinStep": 0.213, "cosStep": 0.437, "scale": 0.71 } }, "sin": { "dtype": "float16", "shape": [5, 12], "data": { "kind": "fillFloat32", "sinStep": 0.619, "cosStep": 0.137, "scale": 0.83 } } }, "outputs": { "y": { "dtype": "float16", "shape": [2, 5, 72], "tolerance": 0.01, "relTolerance": 0.01 } }, "provenance": { "notes": "Aligned vector pairs with a partial final workgroup, section-crossing cache columns, multiple batches, non-unit scale and both tensor ranks. Zero temporal section is covered at the smallest head width." } }, { "name": "vector_boundary_float16_rank4_d8_layout1_zero1", "attrs": { "num_heads": 3, "rotary_embedding_dim": 8, "interleaved": 0, "mrope_layout": 1, "mrope_section": [0, 3, 1], "scale": 0.3 }, "inputs": { "x": { "dtype": "float16", "shape": [2, 3, 5, 8], "data": { "kind": "fillFloat32", "sinStep": 0.113, "cosStep": 0.317, "scale": 3.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 5], "data": { "kind": "cycle", "values": [0, 4, 2, 1, 3, 4, 0] } }, "cos": { "dtype": "float16", "shape": [5, 4], "data": { "kind": "fillFloat32", "sinStep": 0.213, "cosStep": 0.437, "scale": 0.71 } }, "sin": { "dtype": "float16", "shape": [5, 4], "data": { "kind": "fillFloat32", "sinStep": 0.619, "cosStep": 0.137, "scale": 0.83 } } }, "outputs": { "y": { "dtype": "float16", "shape": [2, 3, 5, 8], "tolerance": 0.01, "relTolerance": 0.01 } }, "provenance": { "notes": "Aligned vector pairs with a partial final workgroup, section-crossing cache columns, multiple batches, non-unit scale and both tensor ranks. Zero temporal section is covered at the smallest head width." } }, { "name": "vector_boundary_float16_rank4_d16_layout1_zero0", "attrs": { "num_heads": 3, "rotary_embedding_dim": 16, "interleaved": 0, "mrope_layout": 1, "mrope_section": [1, 2, 5], "scale": 0.3 }, "inputs": { "x": { "dtype": "float16", "shape": [2, 3, 5, 16], "data": { "kind": "fillFloat32", "sinStep": 0.113, "cosStep": 0.317, "scale": 3.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 5], "data": { "kind": "cycle", "values": [0, 4, 2, 1, 3, 4, 0] } }, "cos": { "dtype": "float16", "shape": [5, 8], "data": { "kind": "fillFloat32", "sinStep": 0.213, "cosStep": 0.437, "scale": 0.71 } }, "sin": { "dtype": "float16", "shape": [5, 8], "data": { "kind": "fillFloat32", "sinStep": 0.619, "cosStep": 0.137, "scale": 0.83 } } }, "outputs": { "y": { "dtype": "float16", "shape": [2, 3, 5, 16], "tolerance": 0.01, "relTolerance": 0.01 } }, "provenance": { "notes": "Aligned vector pairs with a partial final workgroup, section-crossing cache columns, multiple batches, non-unit scale and both tensor ranks. Zero temporal section is covered at the smallest head width." } }, { "name": "vector_boundary_float16_rank4_d24_layout1_zero0", "attrs": { "num_heads": 3, "rotary_embedding_dim": 24, "interleaved": 0, "mrope_layout": 1, "mrope_section": [1, 2, 9], "scale": 0.3 }, "inputs": { "x": { "dtype": "float16", "shape": [2, 3, 5, 24], "data": { "kind": "fillFloat32", "sinStep": 0.113, "cosStep": 0.317, "scale": 3.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 5], "data": { "kind": "cycle", "values": [0, 4, 2, 1, 3, 4, 0] } }, "cos": { "dtype": "float16", "shape": [5, 12], "data": { "kind": "fillFloat32", "sinStep": 0.213, "cosStep": 0.437, "scale": 0.71 } }, "sin": { "dtype": "float16", "shape": [5, 12], "data": { "kind": "fillFloat32", "sinStep": 0.619, "cosStep": 0.137, "scale": 0.83 } } }, "outputs": { "y": { "dtype": "float16", "shape": [2, 3, 5, 24], "tolerance": 0.01, "relTolerance": 0.01 } }, "provenance": { "notes": "Aligned vector pairs with a partial final workgroup, section-crossing cache columns, multiple batches, non-unit scale and both tensor ranks. Zero temporal section is covered at the smallest head width." } }, { "name": "ort_partial_rotary_dim_copies_tail_rank3", "attrs": { "num_heads": 1, "rotary_embedding_dim": 6, "mrope_layout": 0, "interleaved": 0, "scale": 1, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 8], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [0, 0, 0] } }, "cos": { "dtype": "float32", "shape": [4, 3], "data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] } }, "sin": { "dtype": "float32", "shape": [4, 3], "data": { "kind": "values", "values": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 8], "tolerance": 0.000001, "relTolerance": 0.000001 } } }, { "name": "ort_empty_rank3_input", "attrs": { "num_heads": 1, "mrope_layout": 0, "interleaved": 0, "mrope_section": [0, 0, 0] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 0], "data": { "kind": "values", "values": [] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [0, 0, 0] } }, "cos": { "dtype": "float32", "shape": [1, 0], "data": { "kind": "values", "values": [] } }, "sin": { "dtype": "float32", "shape": [1, 0], "data": { "kind": "values", "values": [] } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 0], "tolerance": 0.000001, "relTolerance": 0.000001 } } }, { "name": "ort_empty_rank4_input", "attrs": { "num_heads": 2, "rotary_embedding_dim": 6, "mrope_layout": 0, "interleaved": 0, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 2, 0, 6], "data": { "kind": "values", "values": [] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 0], "data": { "kind": "values", "values": [] } }, "cos": { "dtype": "float32", "shape": [1, 3], "data": { "kind": "values", "values": [1.0, 1.0, 1.0] } }, "sin": { "dtype": "float32", "shape": [1, 3], "data": { "kind": "values", "values": [0.0, 0.0, 0.0] } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 2, 0, 6], "tolerance": 0.000001, "relTolerance": 0.000001 } } }, { "name": "ort_sectioned_rank3_f16", "attrs": { "num_heads": 2, "rotary_embedding_dim": 6, "mrope_layout": 0, "interleaved": 0, "scale": 1, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float16", "shape": [1, 2, 12], "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_sectioned_rank3_input_x" } } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 2], "data": { "kind": "values", "values": [0, 1, 1, 2, 2, 3] } }, "cos": { "dtype": "float16", "shape": [4, 3], "data": { "kind": "values", "values": [1.0, 1.01, 1.02, 1.1, 1.11, 1.12, 1.2, 1.21, 1.22, 1.3, 1.31, 1.32] } }, "sin": { "dtype": "float16", "shape": [4, 3], "data": { "kind": "values", "values": [0.1, 0.11, 0.12, 0.15, 0.16, 0.17, 0.2, 0.21, 0.22, 0.25, 0.26, 0.27] } } }, "outputs": { "y": { "dtype": "float16", "shape": [1, 2, 12], "tolerance": 0.01, "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_sectioned_rank3_output_y" } }, "relTolerance": 0.01 } } }, { "name": "ort_interleaved_rank4_f16", "attrs": { "num_heads": 2, "rotary_embedding_dim": 6, "mrope_layout": 1, "interleaved": 1, "scale": 0.5, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float16", "shape": [1, 2, 2, 6], "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_sectioned_rank3_input_x" } } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 2], "data": { "kind": "values", "values": [0, 1, 1, 2, 2, 3] } }, "cos": { "dtype": "float16", "shape": [4, 3], "data": { "kind": "values", "values": [1.0, 1.01, 1.02, 1.1, 1.11, 1.12, 1.2, 1.21, 1.22, 1.3, 1.31, 1.32] } }, "sin": { "dtype": "float16", "shape": [4, 3], "data": { "kind": "values", "values": [0.1, 0.11, 0.12, 0.15, 0.16, 0.17, 0.2, 0.21, 0.22, 0.25, 0.26, 0.27] } } }, "outputs": { "y": { "dtype": "float16", "shape": [1, 2, 2, 6], "tolerance": 0.01, "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_interleaved_rank4_output_y" } }, "relTolerance": 0.01 } } }, { "name": "ort_oob_negative_stream0", "provenance": { "source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc", "test": "PositionIdsOOBPassthroughAllStreams", "notes": "Each invalid stream copies only its own rotation pair. Values outside int32 are saturated by the host projection." }, "attrs": { "num_heads": 1, "rotary_embedding_dim": 6, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [-1, 0, 0] } }, "cos": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 0.0 } }, "sin": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 1.0 } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, -5.0, -6.0, 4.0, 2.0, 3.0] } } } }, { "name": "ort_oob_upper_bound_stream0", "provenance": { "source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc", "test": "PositionIdsOOBPassthroughAllStreams", "notes": "Each invalid stream copies only its own rotation pair. Values outside int32 are saturated by the host projection." }, "attrs": { "num_heads": 1, "rotary_embedding_dim": 6, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [2, 0, 0] } }, "cos": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 0.0 } }, "sin": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 1.0 } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, -5.0, -6.0, 4.0, 2.0, 3.0] } } } }, { "name": "ort_oob_saturated_high_stream0", "provenance": { "source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc", "test": "PositionIdsOOBPassthroughAllStreams", "notes": "Each invalid stream copies only its own rotation pair. Values outside int32 are saturated by the host projection." }, "attrs": { "num_heads": 1, "rotary_embedding_dim": 6, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [2147483647, 0, 0] } }, "cos": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 0.0 } }, "sin": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 1.0 } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, -5.0, -6.0, 4.0, 2.0, 3.0] } } } }, { "name": "ort_oob_saturated_low_stream0", "provenance": { "source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc", "test": "PositionIdsOOBPassthroughAllStreams", "notes": "Each invalid stream copies only its own rotation pair. Values outside int32 are saturated by the host projection." }, "attrs": { "num_heads": 1, "rotary_embedding_dim": 6, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [-2147483648, 0, 0] } }, "cos": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 0.0 } }, "sin": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 1.0 } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, -5.0, -6.0, 4.0, 2.0, 3.0] } } } }, { "name": "ort_oob_negative_stream1", "provenance": { "source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc", "test": "PositionIdsOOBPassthroughAllStreams", "notes": "Each invalid stream copies only its own rotation pair. Values outside int32 are saturated by the host projection." }, "attrs": { "num_heads": 1, "rotary_embedding_dim": 6, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [0, -1, 0] } }, "cos": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 0.0 } }, "sin": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 1.0 } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [-4.0, 2.0, -6.0, 1.0, 5.0, 3.0] } } } }, { "name": "ort_oob_upper_bound_stream1", "provenance": { "source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc", "test": "PositionIdsOOBPassthroughAllStreams", "notes": "Each invalid stream copies only its own rotation pair. Values outside int32 are saturated by the host projection." }, "attrs": { "num_heads": 1, "rotary_embedding_dim": 6, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [0, 2, 0] } }, "cos": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 0.0 } }, "sin": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 1.0 } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [-4.0, 2.0, -6.0, 1.0, 5.0, 3.0] } } } }, { "name": "ort_oob_saturated_high_stream1", "provenance": { "source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc", "test": "PositionIdsOOBPassthroughAllStreams", "notes": "Each invalid stream copies only its own rotation pair. Values outside int32 are saturated by the host projection." }, "attrs": { "num_heads": 1, "rotary_embedding_dim": 6, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [0, 2147483647, 0] } }, "cos": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 0.0 } }, "sin": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 1.0 } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [-4.0, 2.0, -6.0, 1.0, 5.0, 3.0] } } } }, { "name": "ort_oob_saturated_low_stream1", "provenance": { "source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc", "test": "PositionIdsOOBPassthroughAllStreams", "notes": "Each invalid stream copies only its own rotation pair. Values outside int32 are saturated by the host projection." }, "attrs": { "num_heads": 1, "rotary_embedding_dim": 6, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [0, -2147483648, 0] } }, "cos": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 0.0 } }, "sin": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 1.0 } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [-4.0, 2.0, -6.0, 1.0, 5.0, 3.0] } } } }, { "name": "ort_oob_negative_stream2", "provenance": { "source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc", "test": "PositionIdsOOBPassthroughAllStreams", "notes": "Each invalid stream copies only its own rotation pair. Values outside int32 are saturated by the host projection." }, "attrs": { "num_heads": 1, "rotary_embedding_dim": 6, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [0, 0, -1] } }, "cos": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 0.0 } }, "sin": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 1.0 } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [-4.0, -5.0, 3.0, 1.0, 2.0, 6.0] } } } }, { "name": "ort_oob_upper_bound_stream2", "provenance": { "source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc", "test": "PositionIdsOOBPassthroughAllStreams", "notes": "Each invalid stream copies only its own rotation pair. Values outside int32 are saturated by the host projection." }, "attrs": { "num_heads": 1, "rotary_embedding_dim": 6, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [0, 0, 2] } }, "cos": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 0.0 } }, "sin": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 1.0 } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [-4.0, -5.0, 3.0, 1.0, 2.0, 6.0] } } } }, { "name": "ort_oob_saturated_high_stream2", "provenance": { "source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc", "test": "PositionIdsOOBPassthroughAllStreams", "notes": "Each invalid stream copies only its own rotation pair. Values outside int32 are saturated by the host projection." }, "attrs": { "num_heads": 1, "rotary_embedding_dim": 6, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [0, 0, 2147483647] } }, "cos": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 0.0 } }, "sin": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 1.0 } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [-4.0, -5.0, 3.0, 1.0, 2.0, 6.0] } } } }, { "name": "ort_oob_saturated_low_stream2", "provenance": { "source": "onnxruntime/test/contrib_ops/mrotary_embedding_op_test.cc", "test": "PositionIdsOOBPassthroughAllStreams", "notes": "Each invalid stream copies only its own rotation pair. Values outside int32 are saturated by the host projection." }, "attrs": { "num_heads": 1, "rotary_embedding_dim": 6, "mrope_section": [1, 1, 1] }, "inputs": { "x": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] } }, "positionIds": { "dtype": "int32", "shape": [3, 1, 1], "data": { "kind": "values", "values": [0, 0, -2147483648] } }, "cos": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 0.0 } }, "sin": { "dtype": "float32", "shape": [2, 3], "data": { "kind": "constant", "value": 1.0 } } }, "outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 6], "data": { "kind": "values", "values": [-4.0, -5.0, 3.0, 1.0, 2.0, 6.0] } } } }, { "name": "oob_mixed_rank3_float32_interleaved0", "attrs": { "num_heads": 2, "mrope_section": [2, 1, 1], "mrope_layout": 0, "interleaved": 0 }, "inputs": { "x": { "dtype": "float32", "shape": [2, 2, 16], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 2], "data": { "kind": "values", "values": [-1, 0, 1, 2, 0, -1, 2, 1, 2, 1, 0, -1] } }, "cos": { "dtype": "float32", "shape": [2, 4], "data": { "kind": "linspace", "start": 0.1, "end": 0.8 } }, "sin": { "dtype": "float32", "shape": [2, 4], "data": { "kind": "linspace", "start": -0.8, "end": -0.1 } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 2, 16], "tolerance": 0.00001, "relTolerance": 0.00001 } } }, { "name": "oob_mixed_rank3_float32_interleaved1", "attrs": { "num_heads": 2, "mrope_section": [2, 1, 1], "mrope_layout": 1, "interleaved": 1 }, "inputs": { "x": { "dtype": "float32", "shape": [2, 2, 16], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 2], "data": { "kind": "values", "values": [-1, 0, 1, 2, 0, -1, 2, 1, 2, 1, 0, -1] } }, "cos": { "dtype": "float32", "shape": [2, 4], "data": { "kind": "linspace", "start": 0.1, "end": 0.8 } }, "sin": { "dtype": "float32", "shape": [2, 4], "data": { "kind": "linspace", "start": -0.8, "end": -0.1 } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 2, 16], "tolerance": 0.00001, "relTolerance": 0.00001 } } }, { "name": "oob_mixed_rank3_float16_interleaved0", "attrs": { "num_heads": 2, "mrope_section": [2, 1, 1], "mrope_layout": 0, "interleaved": 0 }, "inputs": { "x": { "dtype": "float16", "shape": [2, 2, 16], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 2], "data": { "kind": "values", "values": [-1, 0, 1, 2, 0, -1, 2, 1, 2, 1, 0, -1] } }, "cos": { "dtype": "float16", "shape": [2, 4], "data": { "kind": "linspace", "start": 0.1, "end": 0.8 } }, "sin": { "dtype": "float16", "shape": [2, 4], "data": { "kind": "linspace", "start": -0.8, "end": -0.1 } } }, "outputs": { "y": { "dtype": "float16", "shape": [2, 2, 16], "tolerance": 0.002, "relTolerance": 0.001 } } }, { "name": "oob_mixed_rank3_float16_interleaved1", "attrs": { "num_heads": 2, "mrope_section": [2, 1, 1], "mrope_layout": 1, "interleaved": 1 }, "inputs": { "x": { "dtype": "float16", "shape": [2, 2, 16], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 2], "data": { "kind": "values", "values": [-1, 0, 1, 2, 0, -1, 2, 1, 2, 1, 0, -1] } }, "cos": { "dtype": "float16", "shape": [2, 4], "data": { "kind": "linspace", "start": 0.1, "end": 0.8 } }, "sin": { "dtype": "float16", "shape": [2, 4], "data": { "kind": "linspace", "start": -0.8, "end": -0.1 } } }, "outputs": { "y": { "dtype": "float16", "shape": [2, 2, 16], "tolerance": 0.002, "relTolerance": 0.001 } } }, { "name": "oob_mixed_rank4_float32_interleaved0", "attrs": { "num_heads": 2, "mrope_section": [2, 1, 1], "mrope_layout": 0, "interleaved": 0 }, "inputs": { "x": { "dtype": "float32", "shape": [2, 2, 2, 8], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 2], "data": { "kind": "values", "values": [-1, 0, 1, 2, 0, -1, 2, 1, 2, 1, 0, -1] } }, "cos": { "dtype": "float32", "shape": [2, 4], "data": { "kind": "linspace", "start": 0.1, "end": 0.8 } }, "sin": { "dtype": "float32", "shape": [2, 4], "data": { "kind": "linspace", "start": -0.8, "end": -0.1 } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 2, 2, 8], "tolerance": 0.00001, "relTolerance": 0.00001 } } }, { "name": "oob_mixed_rank4_float32_interleaved1", "attrs": { "num_heads": 2, "mrope_section": [2, 1, 1], "mrope_layout": 1, "interleaved": 1 }, "inputs": { "x": { "dtype": "float32", "shape": [2, 2, 2, 8], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 2], "data": { "kind": "values", "values": [-1, 0, 1, 2, 0, -1, 2, 1, 2, 1, 0, -1] } }, "cos": { "dtype": "float32", "shape": [2, 4], "data": { "kind": "linspace", "start": 0.1, "end": 0.8 } }, "sin": { "dtype": "float32", "shape": [2, 4], "data": { "kind": "linspace", "start": -0.8, "end": -0.1 } } }, "outputs": { "y": { "dtype": "float32", "shape": [2, 2, 2, 8], "tolerance": 0.00001, "relTolerance": 0.00001 } } }, { "name": "oob_mixed_rank4_float16_interleaved0", "attrs": { "num_heads": 2, "mrope_section": [2, 1, 1], "mrope_layout": 0, "interleaved": 0 }, "inputs": { "x": { "dtype": "float16", "shape": [2, 2, 2, 8], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 2], "data": { "kind": "values", "values": [-1, 0, 1, 2, 0, -1, 2, 1, 2, 1, 0, -1] } }, "cos": { "dtype": "float16", "shape": [2, 4], "data": { "kind": "linspace", "start": 0.1, "end": 0.8 } }, "sin": { "dtype": "float16", "shape": [2, 4], "data": { "kind": "linspace", "start": -0.8, "end": -0.1 } } }, "outputs": { "y": { "dtype": "float16", "shape": [2, 2, 2, 8], "tolerance": 0.002, "relTolerance": 0.001 } } }, { "name": "oob_mixed_rank4_float16_interleaved1", "attrs": { "num_heads": 2, "mrope_section": [2, 1, 1], "mrope_layout": 1, "interleaved": 1 }, "inputs": { "x": { "dtype": "float16", "shape": [2, 2, 2, 8], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } }, "positionIds": { "dtype": "int32", "shape": [3, 2, 2], "data": { "kind": "values", "values": [-1, 0, 1, 2, 0, -1, 2, 1, 2, 1, 0, -1] } }, "cos": { "dtype": "float16", "shape": [2, 4], "data": { "kind": "linspace", "start": 0.1, "end": 0.8 } }, "sin": { "dtype": "float16", "shape": [2, 4], "data": { "kind": "linspace", "start": -0.8, "end": -0.1 } } }, "outputs": { "y": { "dtype": "float16", "shape": [2, 2, 2, 8], "tolerance": 0.002, "relTolerance": 0.001 } } } ]}README.md+15-8
build/webgpu/bench.json+115-21
build/webgpu/manifest.json+39-39
build/webgpu/metadata.json+9-8
build/webgpu/mrotary-embedding-vector.wgsl.jinjaAdded+75
build/webgpu/mrotary-embedding.wgsl.jinja+41-58
build/webgpu/test.json+1055-17