ai.onnx.Scan / build /webgpu /test.json
Xenova's picture
Xenova HF Staff
sync 6fdf6301e2bb
83fa505 verified
Raw History Blame
24.4 kB
{
"cases": [
{
"name": "lowered_prefix_sum_state",
"inputs": {
"initial_state": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [1.0, 10.0] } },
"scan_input": {
"dtype": "float32",
"shape": [3, 2],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
"scan_output": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 }
}
},
{
"name": "lowered_prefix_sum_reverse",
"attrs": { "reverse": 1 },
"inputs": {
"initial_state": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [0.0] } },
"scan_input": {
"dtype": "float32",
"shape": [4, 1],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0] }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [1], "tolerance": 0.000001 },
"scan_output": { "dtype": "float32", "shape": [4, 1], "tolerance": 0.000001 }
}
},
{
"name": "lowered_ort_projection_short_sequence_two_state_lanes",
"provenance": {
"source": "onnxruntime/test/providers/cpu/controlflow/scan_test.cc",
"test": "Scan8.ShortSequenceTwoInBatchOneLoopStateVar",
"notes": "The internal lowered prefix-sum variant processes a short sequence with two carried-state lanes."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 10.0] } },
"scan_input": {
"dtype": "float32",
"shape": [2, 2],
"data": { "kind": "values", "values": [1.0, -1.0, 4.0, -4.0] }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
"scan_output": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 }
}
},
{
"name": "lowered_ort_projection_reverse_two_state_lanes",
"attrs": { "reverse": 1 },
"provenance": {
"source": "onnxruntime/test/providers/cpu/controlflow/scan_test.cc",
"test": "Scan8.MixedSequenceLensReverse",
"notes": "The internal lowered reverse prefix-sum variant processes two carried-state lanes in reverse sequence order."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 10.0] } },
"scan_input": {
"dtype": "float32",
"shape": [2, 2],
"data": { "kind": "values", "values": [1.0, -1.0, 4.0, -4.0] }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
"scan_output": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.000001 }
}
},
{
"name": "lowered_ort_projection_scalar_loop_state",
"provenance": {
"source": "onnxruntime/test/providers/cpu/controlflow/scan_test.cc",
"test": "Scan8.OnnxScalarLoopState",
"notes": "The internal lowered prefix-sum variant processes a scalar carried state."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [0.0] } },
"scan_input": { "dtype": "float32", "shape": [3, 1], "data": { "kind": "values", "values": [1.0, 2.0, 3.0] } }
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [1], "tolerance": 0.000001 },
"scan_output": { "dtype": "float32", "shape": [3, 1], "tolerance": 0.000001 }
}
},
{
"name": "lowered_prefix_sum_zero_steps",
"inputs": {
"initial_state": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [2.0, -3.0] } },
"scan_input": { "dtype": "float32", "shape": [0, 2], "data": { "kind": "values", "values": [] } }
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
"scan_output": { "dtype": "float32", "shape": [0, 2], "tolerance": 0.000001 }
}
},
{
"name": "lowered_prefix_sum_reverse_rank2_signed",
"attrs": { "reverse": 1 },
"inputs": {
"initial_state": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [10.0, -10.0] } },
"scan_input": {
"dtype": "float32",
"shape": [3, 2],
"data": { "kind": "values", "values": [1.0, -1.0, 2.0, -2.0, 3.0, -3.0] }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
"scan_output": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 }
}
},
{
"name": "lowered_prefix_sum_reverse_zero_steps",
"attrs": { "reverse": 1 },
"inputs": {
"initial_state": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [7.0, -8.0] } },
"scan_input": { "dtype": "float32", "shape": [0, 2], "data": { "kind": "values", "values": [] } }
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
"scan_output": { "dtype": "float32", "shape": [0, 2], "tolerance": 0.000001 }
}
},
{
"name": "lowered_prefix_sum_zero_delta_lane",
"inputs": {
"initial_state": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [1.0, 10.0, -5.0] } },
"scan_input": {
"dtype": "float32",
"shape": [3, 3],
"data": { "kind": "values", "values": [0.0, 2.0, -1.0, 0.0, -3.0, 4.0, 0.0, 1.0, -2.0] }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [3], "tolerance": 0.000001 },
"scan_output": { "dtype": "float32", "shape": [3, 3], "tolerance": 0.000001 }
}
},
{
"name": "coop_channel_prefix_sum_128x64",
"provenance": {
"notes": "A 128-step prefix sum across 64 independent state lanes exercises cooperative accumulation. The tolerance allows the f32 reassociation introduced by the parallel scan."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [64] },
"scan_input": { "dtype": "float32", "shape": [128, 64] }
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [64], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [128, 64], "tolerance": 0.0001 }
}
},
{
"name": "coop_channel_prefix_sum_reverse_300x96",
"attrs": { "reverse": 1 },
"provenance": {
"notes": "A reverse 300-step prefix sum across 96 state lanes leaves a 44-step final chunk, exercising identity padding in the cooperative scan."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [96] },
"scan_input": { "dtype": "float32", "shape": [300, 96] }
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [96], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [300, 96], "tolerance": 0.0001 }
}
},
{
"name": "coop_channel_prefix_sum_dim512_steps256_perf_compact",
"provenance": {
"notes": "A 256-step prefix sum across 512 state lanes exercises one full cooperative scan chunk."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [512] },
"scan_input": { "dtype": "float32", "shape": [256, 512] }
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [512], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [256, 512], "tolerance": 0.0001 }
}
},
{
"name": "coop_channel_prefix_sum_dim1024_steps256",
"provenance": {
"notes": "A 256-step prefix sum across 1,024 state lanes exercises a wide cooperative dispatch and one full scan chunk. The tolerance allows within-chunk f32 reassociation."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [1024] },
"scan_input": { "dtype": "float32", "shape": [256, 1024] }
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [1024], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [256, 1024], "tolerance": 0.0001 }
}
},
{
"name": "coop_dim1025_above_fixed_gate",
"provenance": {
"notes": "A 1025-element state, one past 1024, runs a 256-step prefix sum; checks correctness when the per-step state exceeds a 1024-lane count on adapters whose limits allow it."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [1025] },
"scan_input": { "dtype": "float32", "shape": [256, 1025] }
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [1025], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [256, 1025], "tolerance": 0.0001 }
}
},
{
"name": "coop_channel_prefix_sum_dim64_steps64_min_gate",
"provenance": {
"notes": "Exactly 64 steps and 64 state lanes exercise the inclusive lower boundary of the cooperative prefix-sum specialization."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [64] },
"scan_input": { "dtype": "float32", "shape": [64, 64] }
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [64], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [64, 64], "tolerance": 0.0001 }
}
},
{
"name": "lowered_dim64_steps63_below_steps_gate",
"provenance": {
"notes": "A 63-step scan across 64 state lanes exercises the lowered prefix sum immediately below the cooperative specialization's 64-step boundary."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [64] },
"scan_input": { "dtype": "float32", "shape": [63, 64] }
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [64], "tolerance": 0.000001 },
"scan_output": { "dtype": "float32", "shape": [63, 64], "tolerance": 0.000001 }
}
},
{
"name": "lowered_prefix_sum_subnormal_residuals_gpu_gap",
"skipGpu": {
"category": "permanent",
"reason": "Portable WGSL floating-point semantics do not guarantee preservation of the subnormal values required by this fixture. Backend evidence: Metal flushes denormals to zero in the ALU; this lowered prefix-sum accumulates subnormal residuals that flush on GPU. Permanent FTZ limitation."
},
"provenance": {
"source": "onnxruntime/test/providers/cpu/controlflow/scan_test.cc",
"test": "Scan8.ShortSequenceTwoInBatchOneLoopStateVar",
"notes": "Projection onto the lowered prefix-sum variant: finite subnormal loop-state increments are valid residuals and must not flush to zero."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.0, 0.0] } },
"scan_input": {
"dtype": "float32",
"shape": [4, 2],
"data": { "kind": "values", "values": [1e-40, -1e-40, 1e-40, -1e-40, -1e-40, 1e-40, 2e-40, -2e-40] }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [2], "tolerance": 0 },
"scan_output": { "dtype": "float32", "shape": [4, 2], "tolerance": 0 }
}
},
{
"name": "lowered_prefix_sum_reverse_subnormal_residuals_gpu_gap",
"skipGpu": {
"category": "permanent",
"reason": "Portable WGSL floating-point semantics do not guarantee preservation of the subnormal values required by this fixture. Backend evidence: Metal flushes denormals to zero in the ALU; this lowered prefix-sum accumulates subnormal residuals that flush on GPU. Permanent FTZ limitation."
},
"attrs": { "reverse": 1 },
"provenance": {
"source": "onnxruntime/test/providers/cpu/controlflow/scan_test.cc",
"test": "Scan8.MixedSequenceLensReverse",
"notes": "A reverse prefix sum of finite subnormal residuals must write finite subnormal sums into reverse traversal slots."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [0.0] } },
"scan_input": {
"dtype": "float32",
"shape": [3, 1],
"data": { "kind": "values", "values": [1e-40, 2e-40, 3e-40] }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [1], "tolerance": 0 },
"scan_output": { "dtype": "float32", "shape": [3, 1], "tolerance": 0 }
}
},
{
"name": "coop_channel_prefix_sum_dim64_steps257_chunk_carry",
"provenance": {
"notes": "A 257-step scan across 64 state lanes creates one full 256-step chunk followed by a one-step chunk. Both scan output and final state verify carry propagation through the identity-padded tail; the tolerance allows parallel f32 reassociation."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [64] },
"scan_input": { "dtype": "float32", "shape": [257, 64] }
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [64], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [257, 64], "tolerance": 0.0001 }
}
},
{
"name": "coop_channel_prefix_sum_reverse_dim64_steps257_chunk_carry",
"attrs": { "reverse": 1 },
"provenance": {
"notes": "A reverse 257-step scan across 64 state lanes creates one full chunk for source steps 256 through 1 and a one-step tail for source step 0. Both outputs verify reversed addressing and cross-chunk carry; the tolerance allows parallel f32 reassociation."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [64] },
"scan_input": { "dtype": "float32", "shape": [257, 64] }
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [64], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [257, 64], "tolerance": 0.0001 }
}
},
{
"name": "lowered_dim1_steps2000_singlechannel_serial",
"provenance": {
"notes": "One state lane runs a 2,000-step serial prefix sum with address `t`. Both scan output and final state are checked at a tight tolerance because this route preserves sequential accumulation order."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [3.5] } },
"scan_input": {
"dtype": "float32",
"shape": [2000, 1],
"data": { "kind": "fillFloat32", "sinStep": 0.017, "scale": 0.25, "offset": 0.01 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [1], "tolerance": 0.000001 },
"scan_output": { "dtype": "float32", "shape": [2000, 1], "tolerance": 0.000001 }
}
},
{
"name": "multichunk_small_state_dim2_steps4096",
"provenance": {
"notes": "A long sequence with two independent state lanes checks recurrent state across chunk boundaries."
},
"inputs": {
"initial_state": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [1.5, -2.0] } },
"scan_input": {
"dtype": "float32",
"shape": [4096, 2],
"data": { "kind": "fillFloat32", "sinStep": 0.017, "cosStep": 0.013, "scale": 0.01, "offset": 0.0001 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [2], "tolerance": 0.001, "relTolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [4096, 2], "tolerance": 0.001, "relTolerance": 0.0001 }
}
},
{
"name": "vector_channel_full_lowered_prefix_sum_256x512",
"inputs": {
"initial_state": {
"dtype": "float32",
"shape": [512],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31, "scale": 0.1 }
},
"scan_input": {
"dtype": "float32",
"shape": [256, 512],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.029, "scale": 0.1 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [512], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [256, 512], "tolerance": 0.0001 }
}
},
{
"name": "vector_channel_full_lowered_prefix_sum_2048x512",
"inputs": {
"initial_state": {
"dtype": "float32",
"shape": [512],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31, "scale": 0.1 }
},
"scan_input": {
"dtype": "float32",
"shape": [2048, 512],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.029, "scale": 0.1 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [512], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [2048, 512], "tolerance": 0.0001 }
}
},
{
"name": "vector_channel_full_lowered_prefix_sum_256x128",
"inputs": {
"initial_state": {
"dtype": "float32",
"shape": [128],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31, "scale": 0.1 }
},
"scan_input": {
"dtype": "float32",
"shape": [256, 128],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.029, "scale": 0.1 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [128], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [256, 128], "tolerance": 0.0001 }
}
},
{
"name": "vector_channel_full_coop_control_dim512_steps4096",
"inputs": {
"initial_state": {
"dtype": "float32",
"shape": [512],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31, "scale": 0.1 }
},
"scan_input": {
"dtype": "float32",
"shape": [4096, 512],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.029, "scale": 0.1 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [512], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [4096, 512], "tolerance": 0.0001 }
}
},
{
"name": "vector_channel_full_lowered_largedim_fallback_dim4096_steps1024",
"inputs": {
"initial_state": {
"dtype": "float32",
"shape": [4096],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31, "scale": 0.1 }
},
"scan_input": {
"dtype": "float32",
"shape": [1024, 4096],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.029, "scale": 0.1 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [4096], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [1024, 4096], "tolerance": 0.0001 }
}
},
{
"name": "vector_channel_full_coop_reverse_partialchunk_dim512_steps300",
"attrs": { "reverse": 1 },
"inputs": {
"initial_state": {
"dtype": "float32",
"shape": [512],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31, "scale": 0.1 }
},
"scan_input": {
"dtype": "float32",
"shape": [300, 512],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.029, "scale": 0.1 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [512], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [300, 512], "tolerance": 0.0001 }
}
},
{
"name": "vector_channel_boundary_t63_d12_reverse0",
"attrs": { "reverse": 0 },
"inputs": {
"initial_state": {
"dtype": "float32",
"shape": [12],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31, "scale": 0.1 }
},
"scan_input": {
"dtype": "float32",
"shape": [63, 12],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.029, "scale": 0.1 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [12], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [63, 12], "tolerance": 0.0001 }
}
},
{
"name": "vector_channel_boundary_t64_d12_reverse0",
"attrs": { "reverse": 0 },
"inputs": {
"initial_state": {
"dtype": "float32",
"shape": [12],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31, "scale": 0.1 }
},
"scan_input": {
"dtype": "float32",
"shape": [64, 12],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.029, "scale": 0.1 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [12], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [64, 12], "tolerance": 0.0001 }
}
},
{
"name": "vector_channel_boundary_t65_d12_reverse1",
"attrs": { "reverse": 1 },
"inputs": {
"initial_state": {
"dtype": "float32",
"shape": [12],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31, "scale": 0.1 }
},
"scan_input": {
"dtype": "float32",
"shape": [65, 12],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.029, "scale": 0.1 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [12], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [65, 12], "tolerance": 0.0001 }
}
},
{
"name": "vector_channel_boundary_t255_d4_reverse0",
"attrs": { "reverse": 0 },
"inputs": {
"initial_state": {
"dtype": "float32",
"shape": [4],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31, "scale": 0.1 }
},
"scan_input": {
"dtype": "float32",
"shape": [255, 4],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.029, "scale": 0.1 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [4], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [255, 4], "tolerance": 0.0001 }
}
},
{
"name": "vector_channel_boundary_t257_d68_reverse1",
"attrs": { "reverse": 1 },
"inputs": {
"initial_state": {
"dtype": "float32",
"shape": [68],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31, "scale": 0.1 }
},
"scan_input": {
"dtype": "float32",
"shape": [257, 68],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.029, "scale": 0.1 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [68], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [257, 68], "tolerance": 0.0001 }
}
},
{
"name": "vector_channel_boundary_t257_d69_reverse1",
"attrs": { "reverse": 1 },
"inputs": {
"initial_state": {
"dtype": "float32",
"shape": [69],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31, "scale": 0.1 }
},
"scan_input": {
"dtype": "float32",
"shape": [257, 69],
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.029, "scale": 0.1 }
}
},
"outputs": {
"final_state": { "dtype": "float32", "shape": [69], "tolerance": 0.0001 },
"scan_output": { "dtype": "float32", "shape": [257, 69], "tolerance": 0.0001 }
}
}
]
}