| { |
| "cases": [ |
| { |
| "name": "mixed_sign_values", |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [6], |
| "data": { "kind": "values", "values": [-1.0, -0.5, 0.0, 0.5, 1.0, 2.0] } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [6] }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [] } |
| } |
| }, |
| { |
| "name": "ort_mixed_sign_rounding_formulation", |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/tensor/dynamic_quantize_linear_test.cc", |
| "test": "QuantizeLinearOpTest.DynamicQuantizeLinear" |
| }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [6], |
| "data": { "kind": "values", "values": [0.0, 2.0, -3.0, -2.5, 1.34, 0.5] } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [6] }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [] } |
| } |
| }, |
| { |
| "name": "all_positive_includes_zero_range", |
| "inputs": { |
| "x": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0] } } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [4] }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [] } |
| } |
| }, |
| { |
| "name": "constant_zero_scale_fallback", |
| "inputs": { |
| "x": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0] } } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [4] }, |
| "y_scale": { "dtype": "float32", "shape": [] }, |
| "y_zero_point": { "dtype": "uint8", "shape": [] } |
| } |
| }, |
| { |
| "name": "subnormal_positive_range_preserves_scale_gpu_gap", |
| "skipGpu": { |
| "category": "permanent", |
| "reason": "Portable WGSL floating-point semantics do not guarantee preservation of the subnormal scale values required by this fixture. Backend evidence: DynamicQuantizeLinear computes scale=(max-min)/255 then x/scale; a subnormal input range yields a subnormal scale and Metal flushes denormals in floating-point division (-> NaN/0), so subnormal-range cases remain CPU-reference-only." |
| }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/tensor/dynamic_quantize_linear_test.cc", |
| "test": "QuantizeLinearOpTest.DynamicQuantizeLinear", |
| "notes": "Tiny but valid positive range: y_scale is a float32 subnormal, so a backend must not flush it to zero and take the constant-input fallback." |
| }, |
| "inputs": { "x": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 1e-40] } } }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [2], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "subnormal_negative_range_preserves_scale_gpu_gap", |
| "skipGpu": { |
| "category": "permanent", |
| "reason": "Portable WGSL floating-point semantics do not guarantee preservation of the subnormal scale values required by this fixture. Backend evidence: DynamicQuantizeLinear computes scale=(max-min)/255 then x/scale; a subnormal input range yields a subnormal scale and Metal flushes denormals in floating-point division (-> NaN/0), so subnormal-range cases remain CPU-reference-only." |
| }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/tensor/dynamic_quantize_linear_test.cc", |
| "test": "QuantizeLinearOpTest.DynamicQuantizeLinear_Max_Adjusted", |
| "notes": "Tiny but valid negative range: ONNX adjusts the max to zero, producing a float32 subnormal scale and a high zero point rather than the constant-input fallback." |
| }, |
| "inputs": { "x": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-1e-40, 0.0] } } }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [2], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "subnormal_mixed_sign_range_vec4_reduce_gpu_gap", |
| "skipGpu": { |
| "category": "permanent", |
| "reason": "Portable WGSL floating-point semantics do not guarantee preservation of the subnormal scale values required by this fixture. Backend evidence: DynamicQuantizeLinear computes scale=(max-min)/255 then x/scale; a subnormal input range yields a subnormal scale and Metal flushes denormals in floating-point division (-> NaN/0), so subnormal-range cases remain CPU-reference-only." |
| }, |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/tensor/dynamic_quantize_linear_test.cc", |
| "test": "QuantizeLinearOpTest.DynamicQuantizeLinear", |
| "notes": "Tiny mixed-sign range with four elements exercises the vec4 reduce path: ONNX should keep a subnormal scale and nonzero zero point." |
| }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [4], |
| "data": { "kind": "values", "values": [-1e-40, -5e-41, 5e-41, 1e-40] } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [4], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "min_adjusted_positive_2d_ort", |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/tensor/dynamic_quantize_linear_test.cc", |
| "test": "QuantizeLinearOpTest.DynamicQuantizeLinear_Min_Adjusted" |
| }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [3, 4], |
| "data": { "kind": "values", "values": [1.0, 2.1, 1.3, 2.5, 3.34, 4.0, 1.5, 2.6, 3.9, 4.0, 3.0, 2.345] } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [3, 4] }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [] } |
| } |
| }, |
| { |
| "name": "max_adjusted_negative_ort", |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/tensor/dynamic_quantize_linear_test.cc", |
| "test": "QuantizeLinearOpTest.DynamicQuantizeLinear_Max_Adjusted" |
| }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [6], |
| "data": { "kind": "values", "values": [-1.0, -2.1, -1.3, -2.5, -3.34, -4.0] } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [6] }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [] } |
| } |
| }, |
| { |
| "name": "singleton_positive_adjusts_min_to_zero", |
| "inputs": { "x": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [5.0] } } }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [1] }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [] } |
| } |
| }, |
| { |
| "name": "onnx_backend_dynamicquantizelinear", |
| "provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_dynamicquantizelinear" }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [6], |
| "data": { "kind": "values", "values": [0.0, 2.0, -3.0, -2.5, 1.340000033378601, 0.5] } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [6], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.00001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "onnx_backend_dynamicquantizelinear_max_adjusted", |
| "provenance": { |
| "source": "cmake/external/onnx/onnx/backend/test/data/node/test_dynamicquantizelinear_max_adjusted" |
| }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [6], |
| "data": { |
| "kind": "values", |
| "values": [-1.0, -2.0999999046325684, -1.2999999523162842, -2.5, -3.3399999141693115, -4.0] |
| } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [6], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.00001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "onnx_backend_dynamicquantizelinear_min_adjusted", |
| "provenance": { |
| "source": "cmake/external/onnx/onnx/backend/test/data/node/test_dynamicquantizelinear_min_adjusted" |
| }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [3, 4], |
| "data": { |
| "kind": "values", |
| "values": [1.0, 2.0999999046325684, 1.2999999523162842, 2.5, 3.3399999141693115, 4.0, 1.5, 2.5999999046325684, 3.9000000953674316, 4.0, 3.0, 2.3450000286102295] |
| } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [3, 4], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.00001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "parallel_mixed_sign_5000", |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [5000], |
| "data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.017, "scale": 3.0 } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [5000], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "parallel_all_negative_1500_tail", |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [1500], |
| "data": { |
| "kind": "cycle", |
| "values": [-1.0, -2.1, -1.3, -2.5, -3.34, -4.0, -0.25, -7.75, -0.001, -6.5, -2.75, -5.125, -3.5] |
| } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [1500], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "parallel_const_zero_1027_tail", |
| "inputs": { "x": { "dtype": "float32", "shape": [1027], "data": { "kind": "cycle", "values": [0.0] } } }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [1027], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "scalar_rank0_positive", |
| "inputs": { "x": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [5.0] } } }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "scalar_rank0_negative", |
| "provenance": { |
| "source": "onnxruntime/test/providers/cpu/tensor/dynamic_quantize_linear_test.cc", |
| "test": "QuantizeLinearOpTest.DynamicQuantizeLinear_Max_Adjusted", |
| "notes": "For an all-negative rank-0 input, the adjusted maximum includes zero and produces zero_point=255." |
| }, |
| "inputs": { "x": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [-5.0] } } }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "empty_zero_dim", |
| "inputs": { "x": { "dtype": "float32", "shape": [0], "data": { "kind": "values", "values": [] } } }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [0], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.0001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "ort_caseB_empty", |
| "inputs": { "x": { "dtype": "float32", "shape": [0], "data": { "kind": "values", "values": [] } } }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [0], "data": { "kind": "values", "values": [] }, "tolerance": 0.001 }, |
| "y_scale": { |
| "dtype": "float32", |
| "shape": [], |
| "data": { "kind": "values", "values": [1.0] }, |
| "tolerance": 0.001 |
| }, |
| "y_zero_point": { |
| "dtype": "uint8", |
| "shape": [], |
| "data": { "kind": "values", "values": [0] }, |
| "tolerance": 0.001 |
| } |
| } |
| }, |
| { |
| "name": "grid_stride_reduce_1m_mixed_sign", |
| "provenance": { |
| "notes": "A 1,048,576-element input selects a grid-stride reduction capped at 256 workgroups, each producing one extrema partial. The final fold must include all elements and reproduce the exact global minimum, maximum, scale, and zero point." |
| }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [1024, 1024], |
| "data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.017, "scale": 3.0 } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [1024, 1024], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "dispatch_cliff_blocks_65536", |
| "provenance": { |
| "notes": "A 67,108,864-element input produces 65,536 reduction blocks and a folded 65,535-by-2 dispatch. A linspace places the extrema in the first and final blocks, making incorrect two-dimensional block reconstruction or a missing over-dispatch guard observable in the scale." |
| }, |
| "inputs": { |
| "x": { "dtype": "float32", "shape": [67108864], "data": { "kind": "linspace", "start": -1.0, "end": 1.0 } } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [67108864], "tolerance": 1 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [] } |
| } |
| }, |
| { |
| "name": "grid_stride_reduce_clean_int_262145", |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [262145], |
| "data": { "kind": "cycle", "values": [0.0, 32.0, 64.0, 96.0, 128.0, 160.0, 192.0, 224.0, 255.0] } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [262145], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "non_vec4_large_finalize_fold_mixed_sign_corrected_division", |
| "provenance": { |
| "notes": "Half-integer quotient boundaries can change zero-point rounding when f32 division precision differs across backends. The integer-significand fallback must keep this odd-sized grid-stride result bit-exact." |
| }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [4194305], |
| "data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.017, "scale": 3.0 } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [4194305], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "per_token_activation_2d_vec4", |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [3, 4096], |
| "data": { "kind": "fillFloat32", "sinStep": 0.011, "cosStep": 0.019, "scale": 2.5 } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [3, 4096], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "non_vec4_odd_hidden_bridge", |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [2049], |
| "data": { |
| "kind": "cycle", |
| "values": [-1.0, -2.1, -1.3, 2.5, 3.34, 4.0, -0.25, 7.75, -0.001, 6.5, -2.75, 5.125, -3.5] |
| } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [2049], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "symmetric_half_step_tie_vec4_boundary", |
| "provenance": { |
| "notes": "The scale 2/255 puts the zero-point quotient just below 127.5 after correctly-rounded f32 division. The zero point must remain 127; rounding correction must not raise it to 128." |
| }, |
| "inputs": { |
| "x": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [-1.0, -0.5, 0.5, 1.0] } } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [4], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "intel_d3d_compensated_zero_point_regression", |
| "provenance": { |
| "notes": "An explicit expected output at a symmetric half-step boundary requires the correctly rounded zero point 127 rather than 128." |
| }, |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [8], |
| "data": { "kind": "values", "values": [-2.0, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0] } |
| } |
| }, |
| "outputs": { |
| "y": { |
| "dtype": "uint8", |
| "shape": [8], |
| "data": { "kind": "values", "values": [0, 63, 95, 127, 159, 191, 223, 254] }, |
| "tolerance": 0 |
| }, |
| "y_scale": { |
| "dtype": "float32", |
| "shape": [], |
| "data": { "kind": "values", "values": [0.01568627543747425] }, |
| "tolerance": 0 |
| }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "data": { "kind": "values", "values": [127] }, "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "grid_stride_threshold_boundary_vec4_262144", |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [262144], |
| "data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.017, "scale": 3.0 } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [262144], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| }, |
| { |
| "name": "multidim_non_vec4_parallel_reduce_2d", |
| "inputs": { |
| "x": { |
| "dtype": "float32", |
| "shape": [17, 120], |
| "data": { "kind": "fillFloat32", "sinStep": 0.031, "cosStep": 0.023, "scale": 2.0 } |
| } |
| }, |
| "outputs": { |
| "y": { "dtype": "uint8", "shape": [17, 120], "tolerance": 0 }, |
| "y_scale": { "dtype": "float32", "shape": [], "tolerance": 0.000001 }, |
| "y_zero_point": { "dtype": "uint8", "shape": [], "tolerance": 0 } |
| } |
| } |
| ] |
| } |
|
|