| { |
| "op": "com.microsoft.GatherBlockQuantized", |
| "fixtureArrays": { |
| "ort_q8_no_zero_input_dataT": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], |
| "q8_no_zero_multiblock_vec4_cols32_input_dataT": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127] |
| }, |
| "cases": [ |
| { |
| "name": "ort_q8_no_zero", |
| "provenance": { |
| "source": "onnxruntime/test/python/transformers/test_cuda_plugin_ep.py", |
| "test": "TestCudaPluginEP.test_op_gather_block_quantized" |
| }, |
| "attrs": { "bits": 8, "block_size": 16 }, |
| "inputs": { |
| "dataT": { |
| "dtype": "uint8", |
| "shape": [4, 16], |
| "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_q8_no_zero_input_dataT" } } |
| }, |
| "indicesT": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [0, 2] } }, |
| "scalesT": { |
| "dtype": "float32", |
| "shape": [4, 1], |
| "data": { "kind": "values", "values": [0.01, 0.02, 0.03, 0.04] } |
| } |
| }, |
| "outputs": { "outputT": { "dtype": "float32", "shape": [2, 16], "tolerance": 0.000001 } } |
| }, |
| { |
| "name": "ort_q8_no_zero_points_default_midpoint", |
| "provenance": { |
| "source": "onnxruntime/test/python/transformers/test_cuda_plugin_ep.py", |
| "test": "TestCudaPluginEP.test_op_gather_block_quantized", |
| "notes": "Pinned. With zero_points omitted the default zero point is 2^(bits-1) = 128 at 8 bits, because `data` is unsigned storage for signed values offset by the midpoint; the cited test states this and ORT's kernel applies it in the uint8 branch of contrib_ops/cpu/quantization/gather_block_quantized.cc. Values are chosen so every expected element is exact in f32 and the two rows use different scales, so a wrong default shifts each row by a different amount rather than by a common offset." |
| }, |
| "attrs": { "bits": 8, "block_size": 16 }, |
| "inputs": { |
| "dataT": { |
| "dtype": "uint8", |
| "shape": [2, 16], |
| "data": { |
| "kind": "values", |
| "values": [120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158] |
| } |
| }, |
| "indicesT": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [0, 1] } }, |
| "scalesT": { "dtype": "float32", "shape": [2, 1], "data": { "kind": "values", "values": [0.5, 0.25] } } |
| }, |
| "outputs": { |
| "outputT": { |
| "dtype": "float32", |
| "shape": [2, 16], |
| "tolerance": 0.000001, |
| "data": { |
| "kind": "values", |
| "values": [-4.0, -3.5, -3.0, -2.5, -2.0, -1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5] |
| } |
| } |
| } |
| }, |
| { |
| "name": "ort_projection_q4_zero_points_block16_tail_rows", |
| "provenance": { |
| "source": "onnxruntime/test/contrib_ops/gather_block_quantized_op_test.cc", |
| "test": "GatherBlockQuantizedOpTest.GatherAxis0WithZeroPoints_4Bits", |
| "notes": "Rank-2 projection of ORT's uint8 q4 gather-axis-0 case with block_size=16, packed tail block, and three gathered rows." |
| }, |
| "attrs": { "bits": 4, "block_size": 16 }, |
| "inputs": { |
| "dataT": { |
| "dtype": "uint8", |
| "shape": [6, 9], |
| "data": { |
| "kind": "values", |
| "values": [16, 50, 16, 50, 16, 50, 16, 50, 128, 84, 118, 84, 118, 84, 118, 84, 118, 132, 152, 186, 152, 186, 152, 186, 152, 186, 136, 220, 254, 220, 254, 220, 254, 220, 254, 140, 220, 254, 220, 254, 220, 254, 220, 254, 140, 84, 118, 84, 118, 84, 118, 84, 118, 132] |
| } |
| }, |
| "indicesT": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [3, 4, 5] } }, |
| "scalesT": { |
| "dtype": "float32", |
| "shape": [6, 2], |
| "data": { "kind": "values", "values": [1.0, 2.0, 1.0, 2.0, 1.0, 2.0, 2.0, 2.0, 1.0, 1.0, 2.0, 1.0] } |
| }, |
| "zeroPointsT": { |
| "dtype": "uint8", |
| "shape": [6, 1], |
| "data": { "kind": "values", "values": [151, 136, 121, 121, 137, 151] } |
| } |
| }, |
| "outputs": { |
| "outputT": { |
| "dtype": "float32", |
| "shape": [3, 18], |
| "tolerance": 0.000001, |
| "data": { |
| "kind": "values", |
| "values": [6.0, 8.0, 10.0, 12.0, 6.0, 8.0, 10.0, 12.0, 6.0, 8.0, 10.0, 12.0, 6.0, 8.0, 10.0, 12.0, 10.0, 2.0, 3.0, 4.0, 5.0, 6.0, 3.0, 4.0, 5.0, 6.0, 3.0, 4.0, 5.0, 6.0, 3.0, 4.0, 5.0, 6.0, 4.0, 0.0, -6.0, -4.0, -2.0, 0.0, -6.0, -4.0, -2.0, 0.0, -6.0, -4.0, -2.0, 0.0, -6.0, -4.0, -2.0, 0.0, -5.0, -1.0] |
| } |
| } |
| } |
| }, |
| { |
| "name": "q8_no_zero_multiblock_vec4_cols32", |
| "attrs": { "bits": 8, "block_size": 16 }, |
| "inputs": { |
| "dataT": { |
| "dtype": "uint8", |
| "shape": [4, 32], |
| "data": { |
| "kind": "values", |
| "values": { "$ref": "#/fixtureArrays/q8_no_zero_multiblock_vec4_cols32_input_dataT" } |
| } |
| }, |
| "indicesT": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [0, 3, 1] } }, |
| "scalesT": { |
| "dtype": "float32", |
| "shape": [4, 2], |
| "data": { "kind": "values", "values": [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08] } |
| } |
| }, |
| "outputs": { "outputT": { "dtype": "float32", "shape": [3, 32], "tolerance": 0.000001 } } |
| }, |
| { |
| "name": "q8_no_zero_wide_vec4_cols256_idx64", |
| "provenance": { |
| "notes": "Compact sibling for the q8 wide-column gather benchmark; preserves no-zero-point q8, blockSize=32, vec4-aligned columns, many gathered rows, and multiple scale blocks per source row." |
| }, |
| "attrs": { "bits": 8, "block_size": 32 }, |
| "inputs": { |
| "dataT": { |
| "dtype": "uint8", |
| "shape": [256, 256], |
| "data": { "kind": "cycle", "values": [0, 1, 2, 3, 4, 5, 31, 63, 127, 191, 255] } |
| }, |
| "indicesT": { |
| "dtype": "uint32", |
| "shape": [64], |
| "data": { "kind": "cycle", "values": [0, 17, 63, 128, 255, 3, 42, 191] } |
| }, |
| "scalesT": { |
| "dtype": "float32", |
| "shape": [256, 8], |
| "data": { "kind": "cycle", "values": [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08] } |
| } |
| }, |
| "outputs": { "outputT": { "dtype": "float32", "shape": [64, 256], "tolerance": 0.000001 } } |
| }, |
| { |
| "name": "q4_zero_points_block16_ort_valid", |
| "attrs": { "bits": 4, "block_size": 16 }, |
| "inputs": { |
| "dataT": { |
| "dtype": "uint8", |
| "shape": [4, 16], |
| "data": { |
| "kind": "values", |
| "values": [16, 50, 84, 118, 152, 186, 220, 254, 16, 33, 136, 119, 102, 85, 17, 34, 200, 152, 104, 56, 8, 216, 168, 120, 72, 24, 232, 184, 136, 88, 40, 248, 35, 70, 105, 140, 175, 210, 245, 21, 56, 91, 126, 161, 196, 231, 11, 46, 81, 116, 151, 186, 221, 0, 35, 70, 105, 140, 175, 210, 245, 21, 56, 91] |
| } |
| }, |
| "indicesT": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [3, 0, 2] } }, |
| "scalesT": { |
| "dtype": "float32", |
| "shape": [4, 2], |
| "data": { "kind": "values", "values": [0.1, 0.2, 0.05, 0.125, 0.25, 0.15, 0.075, 0.3] } |
| }, |
| "zeroPointsT": { |
| "dtype": "uint8", |
| "shape": [4, 1], |
| "data": { "kind": "values", "values": [120, 105, 135, 149] } |
| } |
| }, |
| "outputs": { "outputT": { "dtype": "float32", "shape": [3, 32], "tolerance": 0.000001 } } |
| }, |
| { |
| "name": "q8_with_zero_points_vec4_cols32", |
| "attrs": { "bits": 8, "block_size": 16 }, |
| "inputs": { |
| "dataT": { |
| "dtype": "uint8", |
| "shape": [4, 32], |
| "data": { |
| "kind": "values", |
| "values": { "$ref": "#/fixtureArrays/q8_no_zero_multiblock_vec4_cols32_input_dataT" } |
| } |
| }, |
| "indicesT": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [0, 3, 1] } }, |
| "scalesT": { |
| "dtype": "float32", |
| "shape": [4, 2], |
| "data": { "kind": "values", "values": [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08] } |
| }, |
| "zeroPointsT": { |
| "dtype": "uint8", |
| "shape": [4, 2], |
| "data": { "kind": "values", "values": [128, 100, 64, 90, 110, 130, 70, 120] } |
| } |
| }, |
| "outputs": { "outputT": { "dtype": "float32", "shape": [3, 32], "tolerance": 0.000001 } } |
| }, |
| { |
| "name": "empty_input_zero_dim", |
| "attrs": { "bits": 8, "block_size": 16 }, |
| "inputs": { |
| "dataT": { "dtype": "uint8", "shape": [0, 16], "data": { "kind": "values", "values": [] } }, |
| "indicesT": { "dtype": "uint32", "shape": [0], "data": { "kind": "values", "values": [] } }, |
| "scalesT": { "dtype": "float32", "shape": [0, 1], "data": { "kind": "values", "values": [] } } |
| }, |
| "outputs": { "outputT": { "dtype": "float32", "shape": [0, 16], "tolerance": 0 } } |
| }, |
| { |
| "name": "q8_empty_indices_populated_data", |
| "attrs": { "bits": 8, "block_size": 16 }, |
| "inputs": { |
| "dataT": { |
| "dtype": "uint8", |
| "shape": [4, 16], |
| "data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_q8_no_zero_input_dataT" } } |
| }, |
| "indicesT": { "dtype": "uint32", "shape": [0], "data": { "kind": "values", "values": [] } }, |
| "scalesT": { |
| "dtype": "float32", |
| "shape": [4, 1], |
| "data": { "kind": "values", "values": [0.01, 0.02, 0.03, 0.04] } |
| } |
| }, |
| "outputs": { "outputT": { "dtype": "float32", "shape": [0, 16], "tolerance": 0 } } |
| }, |
| { |
| "name": "q8_max_valid_index_and_duplicates_vec4", |
| "attrs": { "bits": 8, "block_size": 16 }, |
| "inputs": { |
| "dataT": { |
| "dtype": "uint8", |
| "shape": [4, 8], |
| "data": { |
| "kind": "values", |
| "values": [0, 1, 2, 3, 4, 5, 6, 7, 10, 20, 30, 40, 50, 60, 70, 80, 255, 128, 64, 32, 16, 8, 4, 2, 90, 100, 110, 120, 130, 140, 150, 160] |
| } |
| }, |
| "indicesT": { "dtype": "uint32", "shape": [5], "data": { "kind": "values", "values": [3, 3, 0, 3, 1] } }, |
| "scalesT": { |
| "dtype": "float32", |
| "shape": [4, 1], |
| "data": { "kind": "values", "values": [0.01, 0.02, 0.03, 0.04] } |
| } |
| }, |
| "outputs": { "outputT": { "dtype": "float32", "shape": [5, 8], "tolerance": 0.000001 } } |
| }, |
| { |
| "name": "ort_default_bits_and_block_size_q4", |
| "provenance": { |
| "source": "onnxruntime/core/graph/contrib_ops/contrib_defs.cc", |
| "test": "GatherBlockQuantized schema attribute defaults", |
| "notes": "Omitting `bits` and `block_size` exercises their standard defaults of 4 and 128." |
| }, |
| "inputs": { |
| "dataT": { |
| "dtype": "uint8", |
| "shape": [4, 8], |
| "data": { "kind": "cycle", "values": [7, 12, 3, 9, 14, 1, 5, 11] } |
| }, |
| "scalesT": { |
| "dtype": "float32", |
| "shape": [4, 1], |
| "data": { "kind": "values", "values": [0.5, 0.25, 1.5, 2.0] } |
| }, |
| "indicesT": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [3, 0] } } |
| }, |
| "outputs": { "outputT": { "dtype": "float32", "shape": [2, 16], "tolerance": 0.0001 } } |
| }, |
| { |
| "name": "q8_zero_points_tail_cols18", |
| "provenance": { |
| "notes": "Explicit q8 zero points with 18 output columns exercise the scalar tail after four complete vec4 groups; the final quantization block is partial and uses its own scale and zero point." |
| }, |
| "attrs": { "bits": 8, "block_size": 16 }, |
| "inputs": { |
| "dataT": { |
| "dtype": "uint8", |
| "shape": [3, 18], |
| "data": { "kind": "cycle", "values": [0, 17, 64, 99, 128, 143, 191, 255, 37, 211] } |
| }, |
| "indicesT": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [2, 0, 2] } }, |
| "scalesT": { |
| "dtype": "float32", |
| "shape": [3, 2], |
| "data": { "kind": "values", "values": [0.05, 0.2, 0.025, 0.125, 0.075, 0.3] } |
| }, |
| "zeroPointsT": { |
| "dtype": "uint8", |
| "shape": [3, 2], |
| "data": { "kind": "values", "values": [120, 130, 100, 140, 110, 150] } |
| } |
| }, |
| "outputs": { "outputT": { "dtype": "float32", "shape": [3, 18], "tolerance": 0.000001 } } |
| } |
| ] |
| } |
|
|