diff --git a/dnn-providers/integration-tests/integration-test-bundles/README.md b/dnn-providers/integration-tests/integration-test-bundles/README.md index 2f0bb9711b39..be1464fc9557 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/README.md +++ b/dnn-providers/integration-tests/integration-test-bundles/README.md @@ -127,6 +127,37 @@ Template-sweep segments: | `Operation` | PascalCase op name | `BatchnormFwdInference` | | `TopologyName` | Stable graph skeleton name | `Inference` | +### `tensor_patches` (per-case structural tensor edits) + +A `sweep.json` case can carry an optional `tensor_patches` array to make +structural edits to a tensor after `graph.template.json` placeholders are +expanded, but before the graph is sealed into a flatbuffer. This covers cases +that differ from the template by more than a placeholder substitution — e.g. a +case where a tensor is runtime-pass-by-value and must not also carry a baked +`value`/`value_type`. + +Each entry targets one tensor by `uid` and supports two operations: + +```json +"tensor_patches": [ + { + "uid": 4, + "set": { "is_runtime_pass_by_value": true }, + "remove": ["value", "value_type"] + } +] +``` + +- `set` (object): upserts the given fields on the target tensor. +- `remove` (array of strings): erases the given fields from the target tensor. +- `uid` must match a tensor present in the expanded graph, or loading the case + fails with an error. + +`set` is applied before `remove` for a given patch entry. A tensor marked +`is_runtime_pass_by_value: true` that still carries `value`/`value_type` after +patching fails validation at load time — use `remove` to drop the baked +fallback fields when converting a tensor to runtime pass-by-value. + ## Pull Data Locally Bundles are optional. Skip this step if you only need computed (GPU/CPU) diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/Batchnorm/Variant2/sweep.json b/dnn-providers/integration-tests/integration-test-bundles/quick/Batchnorm/Variant2/sweep.json index 96620c530ef1..87165314916c 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/Batchnorm/Variant2/sweep.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/Batchnorm/Variant2/sweep.json @@ -9180,6 +9180,135 @@ }, "seed": 42 } + }, + { + "id": "2_3_1_bfp16_ncl_cd34ad", + "values": { + "io_data_type": "bfloat16", + "tensors": [ + { + "uid": 0, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 1, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 2, + "dims": [ + 2, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 3, + "dims": [ + 2, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 4, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 5, + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "double" + }, + { + "uid": 6, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + } + ] + }, + "tensor_patches": [ + { + "uid": 5, + "set": { + "is_runtime_pass_by_value": true + }, + "remove": [ + "value_type", + "value" + ] + } + ], + "metadata": { + "format_version": 1, + "operation": "BatchnormFwdTraining", + "generator": "manual", + "generator_version": "1.0.0", + "generated_at": "2026-07-27T00:00:00Z", + "seed": 42, + "notes": "Runtime PBV scalars: epsilon (uid=5) promoted to is_runtime_pass_by_value=true, detection value 1.0. The harness supplies the detection value(s) via inputs; both the CPU reference and the provider read from the variantPack. A provider that ignores the runtime tensor and uses any other value produces diverging output.", + "inputs": { + "5": { + "kind": "fixed", + "value": 1.0 + } + } + } } ] } diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormBackward/Default/sweep.json b/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormBackward/Default/sweep.json index 04e7579a5aeb..6c816fcfabc9 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormBackward/Default/sweep.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormBackward/Default/sweep.json @@ -9228,6 +9228,149 @@ }, "seed": 1 } + }, + { + "id": "runtime_epsilon", + "values": { + "io_data_type": "bfloat16", + "tensors": [ + { + "uid": 0, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 1, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 2, + "dims": [ + 2, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 3, + "dims": [ + 2, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 4, + "dims": [ + 2, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 5, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 6, + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "double" + }, + { + "uid": 7, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + } + ] + }, + "tensor_patches": [ + { + "uid": 6, + "set": { + "is_runtime_pass_by_value": true + }, + "remove": [ + "value_type", + "value" + ] + } + ], + "metadata": { + "format_version": 1, + "operation": "BatchnormPointwise", + "generator": "manual", + "generator_version": "1.0.0", + "generated_at": "2026-07-27T00:00:00Z", + "seed": 42, + "notes": "Runtime PBV scalars: epsilon (uid=6) promoted to is_runtime_pass_by_value=true, detection value 1.0. The harness supplies the detection value(s) via inputs; both the CPU reference and the provider read from the variantPack. A provider that ignores the runtime tensor and uses any other value produces diverging output.", + "inputs": { + "6": { + "kind": "fixed", + "value": 1.0 + } + } + } } ] } diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormInferenceAttributesVarianceExt/Default/sweep.json b/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormInferenceAttributesVarianceExt/Default/sweep.json index 265096b5e6e3..7d9b30517e3a 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormInferenceAttributesVarianceExt/Default/sweep.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormInferenceAttributesVarianceExt/Default/sweep.json @@ -10656,6 +10656,135 @@ "seed": 1, "reference_source": "c++ integration suite: Smoke/IntegrationGpuBatchnormFwdInferenceVariance3dFp32.Correctness_3" } + }, + { + "id": "runtime_epsilon", + "values": { + "io_data_type": "bfloat16", + "tensors": [ + { + "uid": 0, + "dims": [ + 1, + 3, + 224 + ], + "strides": [ + 672, + 224, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 1, + "dims": [ + 1, + 3, + 224 + ], + "strides": [ + 672, + 224, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 2, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 3, + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "double" + }, + { + "uid": 4, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 5, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 6, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + } + ] + }, + "tensor_patches": [ + { + "uid": 3, + "set": { + "is_runtime_pass_by_value": true + }, + "remove": [ + "value_type", + "value" + ] + } + ], + "metadata": { + "format_version": 1, + "operation": "BatchnormFwdInferenceVarianceExt", + "generator": "manual", + "generator_version": "1.0.0", + "generated_at": "2026-07-27T00:00:00Z", + "seed": 42, + "notes": "Runtime PBV scalar: epsilon (uid=3) promoted to is_runtime_pass_by_value=true, detection value 1.0. The harness supplies the detection value via inputs; both the CPU reference and the provider read from the variantPack. A provider that ignores the runtime tensor and uses any other value produces diverging output.", + "inputs": { + "3": { + "kind": "fixed", + "value": 1.0 + } + } + } } ] } diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormInferenceAttributesVarianceExtPointwise/Default/sweep.json b/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormInferenceAttributesVarianceExtPointwise/Default/sweep.json index 916e32507949..d83f190284d4 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormInferenceAttributesVarianceExtPointwise/Default/sweep.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormInferenceAttributesVarianceExtPointwise/Default/sweep.json @@ -11784,6 +11784,149 @@ "seed": 1, "reference_source": "c++ integration suite: Smoke/IntegrationGpuBatchnormFwdInferenceVarianceActiv3dFp32.Correctness_3" } + }, + { + "id": "runtime_epsilon", + "values": { + "io_data_type": "bfloat16", + "tensors": [ + { + "uid": 0, + "dims": [ + 1, + 3, + 224 + ], + "strides": [ + 672, + 224, + 1 + ], + "data_type": "float" + }, + { + "uid": 1, + "dims": [ + 1, + 3, + 224 + ], + "strides": [ + 672, + 224, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 2, + "dims": [ + 1, + 3, + 224 + ], + "strides": [ + 672, + 224, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 3, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 4, + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "double" + }, + { + "uid": 5, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 6, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 7, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + } + ] + }, + "tensor_patches": [ + { + "uid": 4, + "set": { + "is_runtime_pass_by_value": true + }, + "remove": [ + "value_type", + "value" + ] + } + ], + "metadata": { + "format_version": 1, + "operation": "BatchnormInferenceVarianceExtPointwise", + "generator": "manual", + "generator_version": "1.0.0", + "generated_at": "2026-07-27T00:00:00Z", + "seed": 42, + "notes": "Runtime PBV scalars: epsilon (uid=4) promoted to is_runtime_pass_by_value=true, detection value 1.0. The harness supplies the detection value(s) via inputs; both the CPU reference and the provider read from the variantPack. A provider that ignores the runtime tensor and uses any other value produces diverging output.", + "inputs": { + "4": { + "kind": "fixed", + "value": 1.0 + } + } + } } ] } diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormPointwise/Default/sweep.json b/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormPointwise/Default/sweep.json index 412a93656e3c..c8fb75eb3901 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormPointwise/Default/sweep.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/BatchnormPointwise/Default/sweep.json @@ -10164,6 +10164,229 @@ }, "seed": 42 } + }, + { + "id": "runtime_epsilon_momentum", + "values": { + "io_data_type": "bfloat16", + "tensors": [ + { + "uid": 0, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 1, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 2, + "dims": [ + 2, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 3, + "dims": [ + 2, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 4, + "dims": [ + 2, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 5, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 6, + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "double" + }, + { + "uid": 7, + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "double" + }, + { + "uid": 8, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 9, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 10, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 11, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 12, + "dims": [ + 1, + 3, + 1 + ], + "strides": [ + 3, + 1, + 1 + ], + "data_type": "float" + } + ] + }, + "tensor_patches": [ + { + "uid": 6, + "set": { + "is_runtime_pass_by_value": true + }, + "remove": [ + "value_type", + "value" + ] + }, + { + "uid": 7, + "set": { + "is_runtime_pass_by_value": true + }, + "remove": [ + "value_type", + "value" + ] + } + ], + "metadata": { + "format_version": 1, + "operation": "BatchnormPointwise", + "generator": "manual", + "generator_version": "1.0.0", + "generated_at": "2026-07-27T00:00:00Z", + "seed": 42, + "notes": "Runtime PBV scalars: epsilon (uid=6) promoted to is_runtime_pass_by_value=true, detection value 1.0; momentum (uid=7) promoted to is_runtime_pass_by_value=true, detection value 0.9. The harness supplies the detection value(s) via inputs; both the CPU reference and the provider read from the variantPack. A provider that ignores the runtime tensor and uses any other value produces diverging output.", + "inputs": { + "6": { + "kind": "fixed", + "value": 1.0 + }, + "7": { + "kind": "fixed", + "value": 0.9 + } + } + } } ] } diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Default/sweep.json b/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Default/sweep.json index 33ee514ff160..ec5df5345f07 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Default/sweep.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Default/sweep.json @@ -4494,6 +4494,131 @@ "seed": 1, "reference_source": "c++ integration suite: Smoke/IntegrationGpuRMSNormFp32.Correctness_7" } + }, + { + "id": "runtime_epsilon", + "values": { + "io_data_type": "bfloat16", + "tensors": [ + { + "uid": 0, + "dims": [ + 2, + 16, + 8, + 1 + ], + "strides": [ + 128, + 8, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 1, + "dims": [ + 2, + 16, + 8, + 8 + ], + "strides": [ + 1024, + 64, + 8, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 2, + "dims": [ + 1, + 1, + 1, + 8 + ], + "strides": [ + 8, + 8, + 8, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 3, + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float" + }, + { + "uid": 4, + "dims": [ + 1, + 1, + 1, + 8 + ], + "strides": [ + 8, + 8, + 8, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 5, + "dims": [ + 2, + 16, + 8, + 8 + ], + "strides": [ + 1024, + 64, + 8, + 1 + ], + "data_type": "bfloat16" + } + ] + }, + "tensor_patches": [ + { + "uid": 3, + "set": { + "is_runtime_pass_by_value": true + }, + "remove": [ + "value_type", + "value" + ] + } + ], + "metadata": { + "format_version": 1, + "operation": "RMSNorm", + "generator": "manual", + "generator_version": "1.0.0", + "generated_at": "2026-07-27T00:00:00Z", + "seed": 42, + "notes": "Runtime PBV scalars: epsilon (uid=3) promoted to is_runtime_pass_by_value=true, detection value 1.0. The harness supplies the detection value(s) via inputs; both the CPU reference and the provider read from the variantPack. A provider that ignores the runtime tensor and uses any other value produces diverging output.", + "inputs": { + "3": { + "kind": "fixed", + "value": 1.0 + } + } + } } ] } diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Variant2/sweep.json b/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Variant2/sweep.json index a22444e0c13d..43ee126193e2 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Variant2/sweep.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Variant2/sweep.json @@ -3822,6 +3822,115 @@ "seed": 1, "reference_source": "c++ integration suite: Smoke/IntegrationGpuRMSNormFp32.Correctness_6" } + }, + { + "id": "runtime_epsilon", + "values": { + "io_data_type": "bfloat16", + "tensors": [ + { + "uid": 0, + "dims": [ + 2, + 16, + 8, + 1 + ], + "strides": [ + 128, + 8, + 1, + 1 + ], + "data_type": "float" + }, + { + "uid": 1, + "dims": [ + 2, + 16, + 8, + 8 + ], + "strides": [ + 1024, + 64, + 8, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 2, + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float" + }, + { + "uid": 3, + "dims": [ + 1, + 1, + 1, + 8 + ], + "strides": [ + 8, + 8, + 8, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 4, + "dims": [ + 2, + 16, + 8, + 8 + ], + "strides": [ + 1024, + 64, + 8, + 1 + ], + "data_type": "bfloat16" + } + ] + }, + "tensor_patches": [ + { + "uid": 2, + "set": { + "is_runtime_pass_by_value": true + }, + "remove": [ + "value_type", + "value" + ] + } + ], + "metadata": { + "format_version": 1, + "operation": "RMSNorm", + "generator": "manual", + "generator_version": "1.0.0", + "generated_at": "2026-07-27T00:00:00Z", + "seed": 42, + "notes": "Runtime PBV scalars: epsilon (uid=2) promoted to is_runtime_pass_by_value=true, detection value 1.0. The harness supplies the detection value(s) via inputs; both the CPU reference and the provider read from the variantPack. A provider that ignores the runtime tensor and uses any other value produces diverging output.", + "inputs": { + "2": { + "kind": "fixed", + "value": 1.0 + } + } + } } ] } diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Variant3/sweep.json b/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Variant3/sweep.json index 15c68576970c..d28f558c3eac 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Variant3/sweep.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Variant3/sweep.json @@ -3150,6 +3150,99 @@ "seed": 1, "reference_source": "c++ integration suite: Smoke/IntegrationGpuRMSNormFp32.Correctness_8" } + }, + { + "id": "runtime_epsilon", + "values": { + "io_data_type": "bfloat16", + "tensors": [ + { + "uid": 0, + "dims": [ + 2, + 16, + 8, + 8 + ], + "strides": [ + 1024, + 64, + 8, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 1, + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float" + }, + { + "uid": 2, + "dims": [ + 1, + 16, + 8, + 8 + ], + "strides": [ + 1024, + 64, + 8, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 3, + "dims": [ + 2, + 16, + 8, + 8 + ], + "strides": [ + 1024, + 64, + 8, + 1 + ], + "data_type": "bfloat16" + } + ] + }, + "tensor_patches": [ + { + "uid": 1, + "set": { + "is_runtime_pass_by_value": true + }, + "remove": [ + "value_type", + "value" + ] + } + ], + "metadata": { + "format_version": 1, + "operation": "RMSNorm", + "generator": "manual", + "generator_version": "1.0.0", + "generated_at": "2026-07-27T00:00:00Z", + "seed": 42, + "notes": "Runtime PBV scalars: epsilon (uid=1) promoted to is_runtime_pass_by_value=true, detection value 1.0. The harness supplies the detection value(s) via inputs; both the CPU reference and the provider read from the variantPack. A provider that ignores the runtime tensor and uses any other value produces diverging output.", + "inputs": { + "1": { + "kind": "fixed", + "value": 1.0 + } + } + } } ] } diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Variant4/sweep.json b/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Variant4/sweep.json index 9fc9e017f812..35390cb310bf 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Variant4/sweep.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/RMSNorm/Variant4/sweep.json @@ -3822,6 +3822,115 @@ "seed": 1, "reference_source": "c++ integration suite: Smoke/IntegrationGpuRMSNormFp32.Correctness_9" } + }, + { + "id": "runtime_epsilon", + "values": { + "io_data_type": "bfloat16", + "tensors": [ + { + "uid": 0, + "dims": [ + 2, + 16, + 8, + 8 + ], + "strides": [ + 1024, + 64, + 8, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 1, + "dims": [ + 1, + 16, + 8, + 8 + ], + "strides": [ + 1024, + 64, + 8, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 2, + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float" + }, + { + "uid": 3, + "dims": [ + 1, + 16, + 8, + 8 + ], + "strides": [ + 1024, + 64, + 8, + 1 + ], + "data_type": "bfloat16" + }, + { + "uid": 4, + "dims": [ + 2, + 16, + 8, + 8 + ], + "strides": [ + 1024, + 64, + 8, + 1 + ], + "data_type": "bfloat16" + } + ] + }, + "tensor_patches": [ + { + "uid": 2, + "set": { + "is_runtime_pass_by_value": true + }, + "remove": [ + "value_type", + "value" + ] + } + ], + "metadata": { + "format_version": 1, + "operation": "RMSNorm", + "generator": "manual", + "generator_version": "1.0.0", + "generated_at": "2026-07-27T00:00:00Z", + "seed": 42, + "notes": "Runtime PBV scalars: epsilon (uid=2) promoted to is_runtime_pass_by_value=true, detection value 1.0. The harness supplies the detection value(s) via inputs; both the CPU reference and the provider read from the variantPack. A provider that ignores the runtime tensor and uses any other value produces diverging output.", + "inputs": { + "2": { + "kind": "fixed", + "value": 1.0 + } + } + } } ] } diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_causal_batch/Small/Small.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_causal_batch/Small/Small.json new file mode 100644 index 000000000000..1183bb9e3a54 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_causal_batch/Small/Small.json @@ -0,0 +1,147 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": null, + "seq_len_kv_tensor_uid": null, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": null, + "descale_k_tensor_uid": null, + "descale_v_tensor_uid": null, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": null, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": null, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": true, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": -1, + "right_bound": 0, + "max_seq_len_kv": null, + "diagonal_alignment": "BOTTOM_RIGHT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "bfloat16", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_bf16_hd128_causal_batch_Small" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_causal_batch/Small/Small.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_causal_batch/Small/Small.meta.json new file mode 100644 index 000000000000..9c48a68d8eac --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_causal_batch/Small/Small.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:47Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_causal_group/Small/Small.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_causal_group/Small/Small.json new file mode 100644 index 000000000000..30e2f565f95d --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_causal_group/Small/Small.json @@ -0,0 +1,171 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": 5, + "seq_len_kv_tensor_uid": 6, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": null, + "descale_k_tensor_uid": null, + "descale_v_tensor_uid": null, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": null, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": null, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": true, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": -1, + "right_bound": 0, + "max_seq_len_kv": null, + "diagonal_alignment": "BOTTOM_RIGHT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 3, + 4, + 512, + 128 + ], + "strides": [ + 262144, + 65536, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 3, + 4, + 512, + 128 + ], + "strides": [ + 262144, + 65536, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 3, + 4, + 512, + 128 + ], + "strides": [ + 262144, + 65536, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 3, + 4, + 512, + 128 + ], + "strides": [ + 262144, + 65536, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 5, + "name": "SeqLenQ", + "dims": [ + 4 + ], + "strides": [ + 1 + ], + "data_type": "int32", + "virtual": false + }, + { + "uid": 6, + "name": "SeqLenKv", + "dims": [ + 4 + ], + "strides": [ + 1 + ], + "data_type": "int32", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "bfloat16", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_bf16_hd128_causal_group_Small" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_causal_group/Small/Small.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_causal_group/Small/Small.meta.json new file mode 100644 index 000000000000..9aa05042ce6d --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_causal_group/Small/Small.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:48Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_batch/Small/Small.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_batch/Small/Small.json new file mode 100644 index 000000000000..8f02b60b13fe --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_batch/Small/Small.json @@ -0,0 +1,147 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": null, + "seq_len_kv_tensor_uid": null, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": null, + "descale_k_tensor_uid": null, + "descale_v_tensor_uid": null, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": null, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": null, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": false, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": null, + "right_bound": null, + "max_seq_len_kv": null, + "diagonal_alignment": "TOP_LEFT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "bfloat16", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_bf16_hd128_nomask_batch_Small" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_batch/Small/Small.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_batch/Small/Small.meta.json new file mode 100644 index 000000000000..ea561a360b05 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_batch/Small/Small.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:45Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_batch_stats/SmallStats/SmallStats.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_batch_stats/SmallStats/SmallStats.json new file mode 100644 index 000000000000..501921ecaf26 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_batch_stats/SmallStats/SmallStats.json @@ -0,0 +1,165 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": null, + "seq_len_kv_tensor_uid": null, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": null, + "descale_k_tensor_uid": null, + "descale_v_tensor_uid": null, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": 4, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": true, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": false, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": null, + "right_bound": null, + "max_seq_len_kv": null, + "diagonal_alignment": "TOP_LEFT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 4, + "name": "LSE", + "dims": [ + 2, + 4, + 256, + 1 + ], + "strides": [ + 1024, + 256, + 1, + 1 + ], + "data_type": "float", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "bfloat16", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_bf16_hd128_nomask_batch_stats_SmallStats" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_batch_stats/SmallStats/SmallStats.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_batch_stats/SmallStats/SmallStats.meta.json new file mode 100644 index 000000000000..96e63e71512a --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_batch_stats/SmallStats/SmallStats.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:46Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_group/Small/Small.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_group/Small/Small.json new file mode 100644 index 000000000000..20fb8e59837e --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_group/Small/Small.json @@ -0,0 +1,171 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": 5, + "seq_len_kv_tensor_uid": 6, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": null, + "descale_k_tensor_uid": null, + "descale_v_tensor_uid": null, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": null, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": null, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": false, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": null, + "right_bound": null, + "max_seq_len_kv": null, + "diagonal_alignment": "TOP_LEFT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 3, + 4, + 512, + 128 + ], + "strides": [ + 262144, + 65536, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 3, + 4, + 512, + 128 + ], + "strides": [ + 262144, + 65536, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 3, + 4, + 512, + 128 + ], + "strides": [ + 262144, + 65536, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 3, + 4, + 512, + 128 + ], + "strides": [ + 262144, + 65536, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 5, + "name": "SeqLenQ", + "dims": [ + 4 + ], + "strides": [ + 1 + ], + "data_type": "int32", + "virtual": false + }, + { + "uid": 6, + "name": "SeqLenKv", + "dims": [ + 4 + ], + "strides": [ + 1 + ], + "data_type": "int32", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "bfloat16", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_bf16_hd128_nomask_group_Small" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_group/Small/Small.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_group/Small/Small.meta.json new file mode 100644 index 000000000000..96e63e71512a --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_group/Small/Small.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:46Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd192_causal_batch/Small/Small.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd192_causal_batch/Small/Small.json new file mode 100644 index 000000000000..6f025a2f4117 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd192_causal_batch/Small/Small.json @@ -0,0 +1,147 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": null, + "seq_len_kv_tensor_uid": null, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": null, + "descale_k_tensor_uid": null, + "descale_v_tensor_uid": null, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": null, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": null, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": true, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": -1, + "right_bound": 0, + "max_seq_len_kv": null, + "diagonal_alignment": "BOTTOM_RIGHT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 2, + 4, + 256, + 192 + ], + "strides": [ + 196608, + 49152, + 192, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 2, + 4, + 256, + 192 + ], + "strides": [ + 196608, + 49152, + 192, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "bfloat16", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_bf16_hd192_causal_batch_Small" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd192_causal_batch/Small/Small.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd192_causal_batch/Small/Small.meta.json new file mode 100644 index 000000000000..5baed47c433b --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd192_causal_batch/Small/Small.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:49Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd192_nomask_batch/Small/Small.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd192_nomask_batch/Small/Small.json new file mode 100644 index 000000000000..bade4e1b5f79 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd192_nomask_batch/Small/Small.json @@ -0,0 +1,147 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": null, + "seq_len_kv_tensor_uid": null, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": null, + "descale_k_tensor_uid": null, + "descale_v_tensor_uid": null, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": null, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": null, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": false, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": null, + "right_bound": null, + "max_seq_len_kv": null, + "diagonal_alignment": "TOP_LEFT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 2, + 4, + 256, + 192 + ], + "strides": [ + 196608, + 49152, + 192, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 2, + 4, + 256, + 192 + ], + "strides": [ + 196608, + 49152, + 192, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "bfloat16", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_bf16_hd192_nomask_batch_Small" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd192_nomask_batch/Small/Small.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd192_nomask_batch/Small/Small.meta.json new file mode 100644 index 000000000000..9aa05042ce6d --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/bf16/hd192_nomask_batch/Small/Small.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:48Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_causal_batch/Small/Small.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_causal_batch/Small/Small.json new file mode 100644 index 000000000000..c92168500b3b --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_causal_batch/Small/Small.json @@ -0,0 +1,147 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": null, + "seq_len_kv_tensor_uid": null, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": null, + "descale_k_tensor_uid": null, + "descale_v_tensor_uid": null, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": null, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": null, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": true, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": -1, + "right_bound": 0, + "max_seq_len_kv": null, + "diagonal_alignment": "BOTTOM_RIGHT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "half", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_fp16_hd128_causal_batch_Small" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_causal_batch/Small/Small.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_causal_batch/Small/Small.meta.json new file mode 100644 index 000000000000..5c5821936479 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_causal_batch/Small/Small.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:50Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_nomask_batch/Small/Small.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_nomask_batch/Small/Small.json new file mode 100644 index 000000000000..7c258030a0c2 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_nomask_batch/Small/Small.json @@ -0,0 +1,147 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": null, + "seq_len_kv_tensor_uid": null, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": null, + "descale_k_tensor_uid": null, + "descale_v_tensor_uid": null, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": null, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": null, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": false, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": null, + "right_bound": null, + "max_seq_len_kv": null, + "diagonal_alignment": "TOP_LEFT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "half", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_fp16_hd128_nomask_batch_Small" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_nomask_batch/Small/Small.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_nomask_batch/Small/Small.meta.json new file mode 100644 index 000000000000..5baed47c433b --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_nomask_batch/Small/Small.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:49Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_nomask_batch_stats/SmallStats/SmallStats.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_nomask_batch_stats/SmallStats/SmallStats.json new file mode 100644 index 000000000000..cb797128beeb --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_nomask_batch_stats/SmallStats/SmallStats.json @@ -0,0 +1,165 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": null, + "seq_len_kv_tensor_uid": null, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": null, + "descale_k_tensor_uid": null, + "descale_v_tensor_uid": null, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": 4, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": true, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": false, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": null, + "right_bound": null, + "max_seq_len_kv": null, + "diagonal_alignment": "TOP_LEFT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 4, + "name": "LSE", + "dims": [ + 2, + 4, + 256, + 1 + ], + "strides": [ + 1024, + 256, + 1, + 1 + ], + "data_type": "float", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "half", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_fp16_hd128_nomask_batch_stats_SmallStats" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_nomask_batch_stats/SmallStats/SmallStats.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_nomask_batch_stats/SmallStats/SmallStats.meta.json new file mode 100644 index 000000000000..5c5821936479 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd128_nomask_batch_stats/SmallStats/SmallStats.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:50Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd192_causal_batch/Small/Small.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd192_causal_batch/Small/Small.json new file mode 100644 index 000000000000..e563109dbd15 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd192_causal_batch/Small/Small.json @@ -0,0 +1,147 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": null, + "seq_len_kv_tensor_uid": null, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": null, + "descale_k_tensor_uid": null, + "descale_v_tensor_uid": null, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": null, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": null, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": true, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": -1, + "right_bound": 0, + "max_seq_len_kv": null, + "diagonal_alignment": "BOTTOM_RIGHT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 2, + 4, + 256, + 192 + ], + "strides": [ + 196608, + 49152, + 192, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 2, + 4, + 256, + 192 + ], + "strides": [ + 196608, + 49152, + 192, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "half", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_fp16_hd192_causal_batch_Small" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd192_causal_batch/Small/Small.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd192_causal_batch/Small/Small.meta.json new file mode 100644 index 000000000000..a52f6ede9f66 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd192_causal_batch/Small/Small.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:51Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd192_nomask_batch/Small/Small.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd192_nomask_batch/Small/Small.json new file mode 100644 index 000000000000..3c78599b4301 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd192_nomask_batch/Small/Small.json @@ -0,0 +1,147 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": null, + "seq_len_kv_tensor_uid": null, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": null, + "descale_k_tensor_uid": null, + "descale_v_tensor_uid": null, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": null, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": null, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": false, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": null, + "right_bound": null, + "max_seq_len_kv": null, + "diagonal_alignment": "TOP_LEFT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 2, + 4, + 256, + 192 + ], + "strides": [ + 196608, + 49152, + 192, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 2, + 4, + 256, + 192 + ], + "strides": [ + 196608, + 49152, + 192, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "half", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "half", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_fp16_hd192_nomask_batch_Small" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd192_nomask_batch/Small/Small.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd192_nomask_batch/Small/Small.meta.json new file mode 100644 index 000000000000..a52f6ede9f66 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp16/hd192_nomask_batch/Small/Small.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:51Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_causal_batch/Small/Small.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_causal_batch/Small/Small.json new file mode 100644 index 000000000000..08b2996236db --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_causal_batch/Small/Small.json @@ -0,0 +1,183 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": null, + "seq_len_kv_tensor_uid": null, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": 7, + "descale_k_tensor_uid": 8, + "descale_v_tensor_uid": 9, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": null, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": null, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": true, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": -1, + "right_bound": 0, + "max_seq_len_kv": null, + "diagonal_alignment": "BOTTOM_RIGHT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "fp8_e4m3", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "fp8_e4m3", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "fp8_e4m3", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 7, + "name": "DescaleQ", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false + }, + { + "uid": 8, + "name": "DescaleK", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false + }, + { + "uid": 9, + "name": "DescaleV", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "bfloat16", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_fp8_hd128_causal_batch_Small" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_causal_batch/Small/Small.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_causal_batch/Small/Small.meta.json new file mode 100644 index 000000000000..ddd440c60f56 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_causal_batch/Small/Small.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:52Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_causal_group/Small/Small.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_causal_group/Small/Small.json new file mode 100644 index 000000000000..39575a171652 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_causal_group/Small/Small.json @@ -0,0 +1,207 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": 5, + "seq_len_kv_tensor_uid": 6, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": 7, + "descale_k_tensor_uid": 8, + "descale_v_tensor_uid": 9, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": null, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": null, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": true, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": -1, + "right_bound": 0, + "max_seq_len_kv": null, + "diagonal_alignment": "BOTTOM_RIGHT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 3, + 4, + 512, + 128 + ], + "strides": [ + 262144, + 65536, + 128, + 1 + ], + "data_type": "fp8_e4m3", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 3, + 4, + 512, + 128 + ], + "strides": [ + 262144, + 65536, + 128, + 1 + ], + "data_type": "fp8_e4m3", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 3, + 4, + 512, + 128 + ], + "strides": [ + 262144, + 65536, + 128, + 1 + ], + "data_type": "fp8_e4m3", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 3, + 4, + 512, + 128 + ], + "strides": [ + 262144, + 65536, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 5, + "name": "SeqLenQ", + "dims": [ + 4 + ], + "strides": [ + 1 + ], + "data_type": "int32", + "virtual": false + }, + { + "uid": 6, + "name": "SeqLenKv", + "dims": [ + 4 + ], + "strides": [ + 1 + ], + "data_type": "int32", + "virtual": false + }, + { + "uid": 7, + "name": "DescaleQ", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false + }, + { + "uid": 8, + "name": "DescaleK", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false + }, + { + "uid": 9, + "name": "DescaleV", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "bfloat16", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_fp8_hd128_causal_group_Small" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_causal_group/Small/Small.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_causal_group/Small/Small.meta.json new file mode 100644 index 000000000000..1f3fea10b9b6 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_causal_group/Small/Small.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:53Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_nomask_batch/Small/Small.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_nomask_batch/Small/Small.json new file mode 100644 index 000000000000..01e31b449766 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_nomask_batch/Small/Small.json @@ -0,0 +1,183 @@ +{ + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": 0, + "k_tensor_uid": 1, + "v_tensor_uid": 2, + "attn_mask_tensor_uid": null, + "scale_tensor_uid": 10, + "seq_len_q_tensor_uid": null, + "seq_len_kv_tensor_uid": null, + "seed_tensor_uid": null, + "offset_tensor_uid": null, + "dropout_mask_tensor_uid": null, + "dropout_scale_tensor_uid": null, + "page_table_k_tensor_uid": null, + "page_table_v_tensor_uid": null, + "block_mask_tensor_uid": null, + "sink_token_tensor_uid": null, + "descale_q_tensor_uid": 7, + "descale_k_tensor_uid": 8, + "descale_v_tensor_uid": 9, + "descale_s_tensor_uid": null, + "scale_s_tensor_uid": null, + "scale_o_tensor_uid": null + }, + "outputs": { + "o_tensor_uid": 3, + "stats_tensor_uid": null, + "max_tensor_uid": null, + "sum_exp_tensor_uid": null, + "rng_dump_tensor_uid": null, + "amax_s_tensor_uid": null, + "amax_o_tensor_uid": null + }, + "attributes": { + "generate_stats": null, + "alibi_mask": false, + "padding_mask": false, + "causal_mask": false, + "causal_mask_bottom_right": false, + "dropout_probability": null, + "attn_scale_value": null, + "left_bound": null, + "right_bound": null, + "max_seq_len_kv": null, + "diagonal_alignment": "TOP_LEFT", + "mma_core_mode": "float", + "implementation": "AUTO" + } + } + ], + "tensors": [ + { + "uid": 0, + "name": "Q", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "fp8_e4m3", + "virtual": false + }, + { + "uid": 1, + "name": "K", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "fp8_e4m3", + "virtual": false + }, + { + "uid": 2, + "name": "V", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "fp8_e4m3", + "virtual": false + }, + { + "uid": 3, + "name": "O", + "dims": [ + 2, + 4, + 256, + 128 + ], + "strides": [ + 131072, + 32768, + 128, + 1 + ], + "data_type": "bfloat16", + "virtual": false + }, + { + "uid": 7, + "name": "DescaleQ", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false + }, + { + "uid": 8, + "name": "DescaleK", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false + }, + { + "uid": 9, + "name": "DescaleV", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false + }, + { + "uid": 10, + "name": "scale", + "dims": [ + 1 + ], + "strides": [ + 1 + ], + "data_type": "float", + "virtual": false, + "is_runtime_pass_by_value": true + } + ], + "io_data_type": "bfloat16", + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": "SdpaFwdRuntimeScale_bhsd_fp8_hd128_nomask_batch_Small" +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_nomask_batch/Small/Small.meta.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_nomask_batch/Small/Small.meta.json new file mode 100644 index 000000000000..ddd440c60f56 --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/bhsd/fp8/hd128_nomask_batch/Small/Small.meta.json @@ -0,0 +1,15 @@ +{ + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": "1.0.0", + "generated_at": "2026-07-31T21:51:52Z", + "reference_source": "synthesis+cpu_reference", + "notes": "Pure-runtime scale bundle: scale (uid=10) has is_runtime_pass_by_value=true with no baked value. The harness supplies the detection value (2.0) via the inputs field; both the CPU reference and the provider read it from the variantPack. A provider that ignores the runtime tensor and falls back to a hardcoded scale produces diverging output.", + "inputs": { + "10": { + "kind": "fixed", + "value": 2.0 + } + } +} diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/regenerate_bundles.sh b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/regenerate_bundles.sh new file mode 100644 index 000000000000..2f469cbd2c4e --- /dev/null +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale/regenerate_bundles.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash +# Copyright (c) Advanced Micro Devices, Inc., or its affiliates. +# SPDX-License-Identifier: MIT +# +# Regenerates all SdpaFwdRuntimeScale test bundles (quick tier). +# +# These bundles carry no tensor blobs (see generate_sdpa_runtime_scale_test_bundle.py): +# the harness synthesizes inputs and reference-verifies outputs at test time, so +# there is nothing here to pin to a DVC remote, unlike ../SdpaFwd/generate_golden_data.sh. +# +# Usage: +# cd /dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwdRuntimeScale +# bash regenerate_bundles.sh + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +GOLDEN_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +GENERATOR="$(cd "$GOLDEN_ROOT/../reference-data-scripts" && pwd)/generate_sdpa_runtime_scale_test_bundle.py" + +if [[ ! -f "$GENERATOR" ]]; then + echo "ERROR: Generator script not found at: $GENERATOR" + exit 1 +fi + +generate_bundle() { + local outdir="$1" + local name="$2" + shift 2 + mkdir -p "$outdir/$name" + python3 "$GENERATOR" --base-filename "$outdir/$name/$name" "$@" +} + +BHSD="$GOLDEN_ROOT/quick/SdpaFwdRuntimeScale/bhsd" + +echo "=== Generating SdpaFwdRuntimeScale quick tier ===" + +# --- bf16, hd128 --- +generate_bundle "$BHSD/bf16/hd128_nomask_batch" "Small" \ + --q-dims 2 4 256 128 --v-dims 2 4 256 128 \ + --name SdpaFwdRuntimeScale_bhsd_bf16_hd128_nomask_batch_Small + +generate_bundle "$BHSD/bf16/hd128_nomask_group" "Small" \ + --variable-seq-lens --q-dims 3 4 512 128 --v-dims 3 4 512 128 \ + --name SdpaFwdRuntimeScale_bhsd_bf16_hd128_nomask_group_Small + +generate_bundle "$BHSD/bf16/hd128_nomask_batch_stats" "SmallStats" \ + --stats --q-dims 2 4 256 128 --v-dims 2 4 256 128 \ + --name SdpaFwdRuntimeScale_bhsd_bf16_hd128_nomask_batch_stats_SmallStats + +generate_bundle "$BHSD/bf16/hd128_causal_batch" "Small" \ + --causal bottom_right --q-dims 2 4 256 128 --v-dims 2 4 256 128 \ + --name SdpaFwdRuntimeScale_bhsd_bf16_hd128_causal_batch_Small + +generate_bundle "$BHSD/bf16/hd128_causal_group" "Small" \ + --causal bottom_right --variable-seq-lens \ + --q-dims 3 4 512 128 --v-dims 3 4 512 128 \ + --name SdpaFwdRuntimeScale_bhsd_bf16_hd128_causal_group_Small + +# --- bf16, hd192 (D_qk=192, D_v=128) --- +generate_bundle "$BHSD/bf16/hd192_nomask_batch" "Small" \ + --q-dims 2 4 256 192 --v-dims 2 4 256 128 \ + --name SdpaFwdRuntimeScale_bhsd_bf16_hd192_nomask_batch_Small + +generate_bundle "$BHSD/bf16/hd192_causal_batch" "Small" \ + --causal bottom_right --q-dims 2 4 256 192 --v-dims 2 4 256 128 \ + --name SdpaFwdRuntimeScale_bhsd_bf16_hd192_causal_batch_Small + +# --- fp16, hd128 --- +generate_bundle "$BHSD/fp16/hd128_nomask_batch" "Small" \ + --dtype fp16 --q-dims 2 4 256 128 --v-dims 2 4 256 128 \ + --name SdpaFwdRuntimeScale_bhsd_fp16_hd128_nomask_batch_Small + +generate_bundle "$BHSD/fp16/hd128_nomask_batch_stats" "SmallStats" \ + --dtype fp16 --stats --q-dims 2 4 256 128 --v-dims 2 4 256 128 \ + --name SdpaFwdRuntimeScale_bhsd_fp16_hd128_nomask_batch_stats_SmallStats + +generate_bundle "$BHSD/fp16/hd128_causal_batch" "Small" \ + --dtype fp16 --causal bottom_right --q-dims 2 4 256 128 --v-dims 2 4 256 128 \ + --name SdpaFwdRuntimeScale_bhsd_fp16_hd128_causal_batch_Small + +# --- fp16, hd192 (D_qk=192, D_v=128) --- +generate_bundle "$BHSD/fp16/hd192_nomask_batch" "Small" \ + --dtype fp16 --q-dims 2 4 256 192 --v-dims 2 4 256 128 \ + --name SdpaFwdRuntimeScale_bhsd_fp16_hd192_nomask_batch_Small + +generate_bundle "$BHSD/fp16/hd192_causal_batch" "Small" \ + --dtype fp16 --causal bottom_right --q-dims 2 4 256 192 --v-dims 2 4 256 128 \ + --name SdpaFwdRuntimeScale_bhsd_fp16_hd192_causal_batch_Small + +# --- fp8, hd128 --- +generate_bundle "$BHSD/fp8/hd128_nomask_batch" "Small" \ + --dtype fp8 --q-dims 2 4 256 128 --v-dims 2 4 256 128 \ + --name SdpaFwdRuntimeScale_bhsd_fp8_hd128_nomask_batch_Small + +generate_bundle "$BHSD/fp8/hd128_causal_batch" "Small" \ + --dtype fp8 --causal bottom_right --q-dims 2 4 256 128 --v-dims 2 4 256 128 \ + --name SdpaFwdRuntimeScale_bhsd_fp8_hd128_causal_batch_Small + +generate_bundle "$BHSD/fp8/hd128_causal_group" "Small" \ + --dtype fp8 --causal bottom_right --variable-seq-lens \ + --q-dims 3 4 512 128 --v-dims 3 4 512 128 \ + --name SdpaFwdRuntimeScale_bhsd_fp8_hd128_causal_group_Small + +echo "" +echo "=== Done ===" +echo "Generated bundles:" +find "$BHSD" -name "*.json" ! -name "*.meta.json" 2>/dev/null | sort diff --git a/dnn-providers/integration-tests/migration-scripts/run_capture_pipeline.sh b/dnn-providers/integration-tests/migration-scripts/run_capture_pipeline.sh index 120d1ff2b8a0..dab53417e767 100755 --- a/dnn-providers/integration-tests/migration-scripts/run_capture_pipeline.sh +++ b/dnn-providers/integration-tests/migration-scripts/run_capture_pipeline.sh @@ -69,9 +69,14 @@ python3 "$SCRIPT_DIR/verify_migration.py" \ echo "" echo "--- Supporting: real binary smoke (bundle loader) ---" -"$BINARY" --allow-bundles --gd "$OUT" --gtest_filter="$BUNDLE_FILTER" || { +SMOKE_LOG="$WORK/smoke.log" +if ! "$BINARY" --allow-bundles --gd "$OUT" --gtest_filter="$BUNDLE_FILTER" 2>&1 | tee "$SMOKE_LOG"; then + if grep -q "Failed to load bundle" "$SMOKE_LOG"; then + echo " FAIL: a bundle failed to load — this is a real regression, not a missing-GPU skip" >&2 + exit 1 + fi echo " WARN: smoke returned non-zero (may need GPU)" >&2 -} +fi # ── Supporting layer: idempotency ─────────────────────────────────────── diff --git a/dnn-providers/integration-tests/reference-data-scripts/generate_sdpa_runtime_scale_test_bundle.py b/dnn-providers/integration-tests/reference-data-scripts/generate_sdpa_runtime_scale_test_bundle.py new file mode 100644 index 000000000000..b842fd290f0b --- /dev/null +++ b/dnn-providers/integration-tests/reference-data-scripts/generate_sdpa_runtime_scale_test_bundle.py @@ -0,0 +1,444 @@ +#!/usr/bin/env python3 +# Copyright © Advanced Micro Devices, Inc., or its affiliates. +# SPDX-License-Identifier: MIT +""" +SDPA Forward Runtime Scale Test Bundle Generator + +Generates graph-only reference bundles for SDPA forward where the attention +scale is provided as a runtime pass-by-value tensor (dims=[1], strides=[1]) +rather than a compile-time baked scalar (attn_scale_value attribute). + +In existing SDPA bundles the scale is baked into the node's `attn_scale_value` +attribute. This script instead wires it as a runtime tensor via `scale_tensor_uid`, +leaving `attn_scale_value` as null. A provider that ignores the runtime scale +and falls back to a compile-time default will produce detectably wrong output. + +These bundles carry no tensor blobs: the harness synthesizes Q/K/V/etc. itself +and verifies provider output against its own CPU reference executor. The only +thing this generator needs to communicate beyond the graph shape is which +runtime tensor should be pinned to a fixed detection value — done via the +`inputs` field in the companion `.meta.json`. There is no golden data to +compute, so this script has no numeric/tensor-framework dependency. + +Tensor UID slots (fixed convention across this bundle family): + 0=Q 1=K 2=V 3=O 4=stats(LSE, if --stats) 5=SeqLenQ 6=SeqLenKv (if + --variable-seq-lens) 7/8/9=DescaleQ/K/V (if --dtype fp8) 10=scale (always + — the scale tensor's UID is never referenced positionally, only via the + node's explicit scale_tensor_uid field, so a single fixed slot above the + highest optional-tensor slot avoids any collision regardless of flags). + +Output: {base_filename}.json + {base_filename}.meta.json + +Usage: + python generate_sdpa_runtime_scale_test_bundle.py \\ + --base-filename bundles/SdpaFwdRuntimeScale/bhsd/bf16/hd128_nomask_batch/Small \\ + --q-dims 2 4 256 128 --v-dims 2 4 256 128 \\ + --name SdpaFwdRuntimeScale_bhsd_bf16_hd128_nomask_batch_Small +""" + +import argparse +import datetime +import json +import os +import sys + +# Bump when generator logic changes in a way that affects output data. +# 1.0.0 — Initial: SDPA forward with runtime scale tensor (dynamic UID: 4 +# normally, displaced to 10 when stats or fp8 also claim slot 4/7-9), +# with --causal (bottom_right), --variable-seq-lens (group/ragged +# batch), --stats (LSE), and --dtype fp8 (+ descale) support. Carries +# no tensor blobs and no PyTorch dependency: this bundle family's +# inputs are synthesized and outputs are reference-verified by the +# harness at test time, so there is no golden data for this script to +# compute. +GENERATOR_VERSION = "1.0.0" + +DTYPE_JSON = { + "bf16": "bfloat16", + "fp16": "half", + "fp8": "fp8_e4m3", +} + +# Tensor UID assignment (stable contract with the JSON consumer / loader). +UID_Q = 0 +UID_K = 1 +UID_V = 2 +UID_O = 3 +UID_STATS = 4 +UID_SEQ_LEN_Q = 5 +UID_SEQ_LEN_KV = 6 +UID_DESCALE_Q = 7 +UID_DESCALE_K = 8 +UID_DESCALE_V = 9 +UID_SCALE = 10 + + +def compute_contiguous_strides(dims): + strides = [] + stride = 1 + for d in reversed(dims): + strides.append(stride) + stride *= d + strides.reverse() + return strides + + +def build_graph_json(q_dims, k_dims, v_dims, o_dims, dtype, causal, group, stats, name): + """Build the SDPA graph JSON with scale wired as a runtime tensor. + + Key difference from the compile-time variant (generate_sdpa_fwd_golden.py): + - scale_tensor_uid points at the runtime scale tensor (no baked fallback) + - attn_scale_value = null (forces the CPU reference to read from variantPack) + A provider that falls back to a compile-time default (e.g. 1/sqrt(headDim)) + instead of reading the runtime tensor produces output that diverges from the + CPU reference. + """ + B = q_dims[0] + is_fp8 = dtype == "fp8" + qkv_json_dtype = DTYPE_JSON[dtype] + # fp8 attention output is bf16; io_data_type mirrors that (matches the + # committed fp8 bundles, even though Q/K/V are individually fp8_e4m3). + o_json_dtype = "bfloat16" if is_fp8 else qkv_json_dtype + io_json_dtype = o_json_dtype + + scale_uid = UID_SCALE + + tensors = [ + { + "uid": UID_Q, + "name": "Q", + "dims": q_dims, + "strides": compute_contiguous_strides(q_dims), + "data_type": qkv_json_dtype, + "virtual": False, + }, + { + "uid": UID_K, + "name": "K", + "dims": k_dims, + "strides": compute_contiguous_strides(k_dims), + "data_type": qkv_json_dtype, + "virtual": False, + }, + { + "uid": UID_V, + "name": "V", + "dims": v_dims, + "strides": compute_contiguous_strides(v_dims), + "data_type": qkv_json_dtype, + "virtual": False, + }, + { + "uid": UID_O, + "name": "O", + "dims": o_dims, + "strides": compute_contiguous_strides(o_dims), + "data_type": o_json_dtype, + "virtual": False, + }, + ] + + stats_tensor_uid = None + if stats: + lse_dims = [B, q_dims[1], q_dims[2], 1] + tensors.append( + { + "uid": UID_STATS, + "name": "LSE", + "dims": lse_dims, + "strides": compute_contiguous_strides(lse_dims), + "data_type": "float", + "virtual": False, + } + ) + stats_tensor_uid = UID_STATS + + seq_len_q_tensor_uid = None + seq_len_kv_tensor_uid = None + if group: + for uid, tname in [(UID_SEQ_LEN_Q, "SeqLenQ"), (UID_SEQ_LEN_KV, "SeqLenKv")]: + tensors.append( + { + "uid": uid, + "name": tname, + "dims": [B + 1], + "strides": [1], + "data_type": "int32", + "virtual": False, + } + ) + seq_len_q_tensor_uid = UID_SEQ_LEN_Q + seq_len_kv_tensor_uid = UID_SEQ_LEN_KV + + descale_q_tensor_uid = descale_k_tensor_uid = descale_v_tensor_uid = None + if is_fp8: + for uid, tname in [ + (UID_DESCALE_Q, "DescaleQ"), + (UID_DESCALE_K, "DescaleK"), + (UID_DESCALE_V, "DescaleV"), + ]: + tensors.append( + { + "uid": uid, + "name": tname, + "dims": [1], + "strides": [1], + "data_type": "float", + "virtual": False, + } + ) + descale_q_tensor_uid = UID_DESCALE_Q + descale_k_tensor_uid = UID_DESCALE_K + descale_v_tensor_uid = UID_DESCALE_V + + tensors.append( + { + "uid": scale_uid, + "name": "scale", + "dims": [1], + "strides": [1], + "data_type": "float", + "virtual": False, + "is_runtime_pass_by_value": True, + } + ) + + causal_mask_bottom_right = causal == "bottom_right" + diagonal_alignment = "BOTTOM_RIGHT" if causal_mask_bottom_right else "TOP_LEFT" + left_bound = -1 if causal_mask_bottom_right else None + right_bound = 0 if causal_mask_bottom_right else None + + graph = { + "nodes": [ + { + "type": "SdpaAttributes", + "compute_data_type": "float", + "name": "", + "inputs": { + "q_tensor_uid": UID_Q, + "k_tensor_uid": UID_K, + "v_tensor_uid": UID_V, + "attn_mask_tensor_uid": None, + "scale_tensor_uid": scale_uid, # runtime tensor + "seq_len_q_tensor_uid": seq_len_q_tensor_uid, + "seq_len_kv_tensor_uid": seq_len_kv_tensor_uid, + "seed_tensor_uid": None, + "offset_tensor_uid": None, + "dropout_mask_tensor_uid": None, + "dropout_scale_tensor_uid": None, + "page_table_k_tensor_uid": None, + "page_table_v_tensor_uid": None, + "block_mask_tensor_uid": None, + "sink_token_tensor_uid": None, + "descale_q_tensor_uid": descale_q_tensor_uid, + "descale_k_tensor_uid": descale_k_tensor_uid, + "descale_v_tensor_uid": descale_v_tensor_uid, + "descale_s_tensor_uid": None, + "scale_s_tensor_uid": None, + "scale_o_tensor_uid": None, + }, + "outputs": { + "o_tensor_uid": UID_O, + "stats_tensor_uid": stats_tensor_uid, + "max_tensor_uid": None, + "sum_exp_tensor_uid": None, + "rng_dump_tensor_uid": None, + "amax_s_tensor_uid": None, + "amax_o_tensor_uid": None, + }, + "attributes": { + "generate_stats": True if stats else None, + "alibi_mask": False, + "padding_mask": False, + "causal_mask": False, + "causal_mask_bottom_right": causal_mask_bottom_right, + "dropout_probability": None, + "attn_scale_value": None, # null — scale is runtime, not baked + "left_bound": left_bound, + "right_bound": right_bound, + "max_seq_len_kv": None, + "diagonal_alignment": diagonal_alignment, + "mma_core_mode": "float", + "implementation": "AUTO", + }, + } + ], + "tensors": tensors, + "io_data_type": io_json_dtype, + "compute_data_type": "float", + "intermediate_data_type": "float", + "name": name, + } + return graph, scale_uid + + +def build_meta_json(scale_uid, scale_value): + return { + "format_version": 1, + "operation": "SdpaFwdRuntimeScale", + "generator": "generate_sdpa_runtime_scale_test_bundle.py", + "generator_version": GENERATOR_VERSION, + "generated_at": datetime.datetime.now(datetime.timezone.utc).strftime( + "%Y-%m-%dT%H:%M:%SZ" + ), + "reference_source": "synthesis+cpu_reference", + "notes": ( + f"Pure-runtime scale bundle: scale (uid={scale_uid}) has " + "is_runtime_pass_by_value=true with no baked value. The harness " + f"supplies the detection value ({scale_value}) via the inputs " + "field; both the CPU reference and the provider read it from the " + "variantPack. A provider that ignores the runtime tensor and " + "falls back to a hardcoded scale produces diverging output." + ), + "inputs": {str(scale_uid): {"kind": "fixed", "value": scale_value}}, + } + + +def generate_bundle( + base_filename, + q_dims, + v_dims, + dtype="bf16", + causal="none", + group=False, + stats=False, + scale_value=2.0, + name="", +): + if dtype not in DTYPE_JSON: + print( + f"ERROR: --dtype must be one of {list(DTYPE_JSON.keys())} (got '{dtype}')", + file=sys.stderr, + ) + sys.exit(1) + if causal not in ("none", "bottom_right"): + print( + f"ERROR: --causal must be one of ('none', 'bottom_right') (got '{causal}')", + file=sys.stderr, + ) + sys.exit(1) + + B, H_q, S_q, D_qk = q_dims + B_v, H_kv, S_kv, D_v = v_dims + k_dims = [B, H_kv, S_kv, D_qk] + o_dims = [B, H_q, S_q, D_v] + + errors = [] + if B_v != B: + errors.append(f"Batch mismatch: Q batch={B}, V batch={B_v}") + if H_q % H_kv != 0: + errors.append(f"H_q ({H_q}) must be divisible by H_kv ({H_kv})") + if errors: + for e in errors: + print(f"ERROR: {e}", file=sys.stderr) + sys.exit(1) + + os.makedirs(os.path.dirname(os.path.abspath(base_filename)), exist_ok=True) + + print(f"Generating SDPA runtime scale bundle: {base_filename}") + print(f" Q: {q_dims}, K: {k_dims}, V: {v_dims}, O: {o_dims}") + print(f" dtype: {dtype}, causal: {causal}, group: {group}, stats: {stats}") + + graph_json, scale_uid = build_graph_json( + q_dims, k_dims, v_dims, o_dims, dtype, causal, group, stats, name + ) + print(f" scale uid={scale_uid}, detection value={scale_value}") + + json_path = f"{base_filename}.json" + with open(json_path, "w") as f: + json.dump(graph_json, f, indent=4) + f.write("\n") + print(f" Graph JSON: {json_path}") + + meta_json = build_meta_json(scale_uid, scale_value) + meta_path = f"{base_filename}.meta.json" + with open(meta_path, "w") as f: + json.dump(meta_json, f, indent=4) + f.write("\n") + print(f" Meta JSON: {meta_path}") + + +def main(): + parser = argparse.ArgumentParser( + description="Generate SDPA forward runtime scale test bundles (graph + meta only)" + ) + parser.add_argument( + "--base-filename", + required=True, + help="Path prefix for output files (no extension)", + ) + parser.add_argument( + "--q-dims", + nargs=4, + type=int, + required=True, + metavar=("B", "H_Q", "S_Q", "D_QK"), + help="Query tensor dims: batch, heads_q, seq_q, head_dim_qk", + ) + parser.add_argument( + "--v-dims", + nargs=4, + type=int, + required=True, + metavar=("B", "H_KV", "S_KV", "D_V"), + help="Value tensor dims: batch, heads_kv, seq_kv, head_dim_v", + ) + parser.add_argument( + "--dtype", + default="bf16", + choices=list(DTYPE_JSON.keys()), + help="Q/K/V tensor dtype (default: bf16). 'fp8' emits fp8_e4m3 " + "Q/K/V with a bf16 output and per-tensor descale_q/k/v runtime tensors.", + ) + parser.add_argument( + "--causal", + default="none", + choices=["none", "bottom_right"], + help="Causal masking mode (default: none).", + ) + parser.add_argument( + "--variable-seq-lens", + action="store_true", + help="Declare runtime seq_len_q/seq_len_kv tensors (uid 5/6) for a " + "ragged/padded batch, in addition to Q/K/V/O.", + ) + parser.add_argument( + "--stats", + action="store_true", + help="Declare a runtime stats (LSE) output tensor (uid=4).", + ) + parser.add_argument( + "--scale-value", + type=float, + default=2.0, + help=( + "Detection value for the runtime scale tensor, recorded in " + "meta.json's 'inputs' field for the harness to inject. Default=2.0 " + "is far from the typical compile-time default of 1/sqrt(D_qk) to " + "enable detection of incorrect handling." + ), + ) + parser.add_argument( + "--name", + required=True, + help="Graph-level 'name' field, e.g. " + "SdpaFwdRuntimeScale_bhsd_bf16_hd128_causal_batch_Small", + ) + args = parser.parse_args() + + generate_bundle( + base_filename=args.base_filename, + q_dims=args.q_dims, + v_dims=args.v_dims, + dtype=args.dtype, + causal=args.causal, + group=args.variable_seq_lens, + stats=args.stats, + scale_value=args.scale_value, + name=args.name, + ) + print("\nDone.") + + +if __name__ == "__main__": + main() diff --git a/dnn-providers/integration-tests/reference-data-scripts/requirements.txt b/dnn-providers/integration-tests/reference-data-scripts/requirements.txt new file mode 100644 index 000000000000..bca1994e52a1 --- /dev/null +++ b/dnn-providers/integration-tests/reference-data-scripts/requirements.txt @@ -0,0 +1,7 @@ +# Reference data generation scripts require PyTorch. +# +# Install a ROCm-enabled wheel matching your system ROCm version, e.g.: +# ROCm 7.x: pip install --index-url https://download.pytorch.org/whl/rocm7.0 torch +# or a CPU-only wheel for local development: +# pip install torch +torch diff --git a/dnn-providers/integration-tests/src/harness/bundle/BundleRegistration.hpp b/dnn-providers/integration-tests/src/harness/bundle/BundleRegistration.hpp index ab73d06a881d..40531e1792a1 100644 --- a/dnn-providers/integration-tests/src/harness/bundle/BundleRegistration.hpp +++ b/dnn-providers/integration-tests/src/harness/bundle/BundleRegistration.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -35,6 +36,112 @@ struct LoadedBundle std::shared_ptr bundle; }; +// A GTest test body that immediately fails with a stored diagnostic message. +// Registered in place of a bundle that failed to load, so the failure surfaces +// as a red test result — attributed to that bundle's suite/test name — instead +// of only an ERROR log line that nothing in CI asserts on. +// +// TestBody() is public (rather than the usual protected/private override) so +// tests can invoke it directly to verify the failure message it records; +// GTest's own dispatch through Test::Run() works the same regardless of +// access, since that call happens from within the base class. +class FailedBundleLoadTest : public ::testing::Test +{ +public: + explicit FailedBundleLoadTest(std::string message) + : _message(std::move(message)) + { + } + + void TestBody() override + { + ADD_FAILURE() << _message; + } + +private: + std::string _message; +}; + +// Registers a synthetic failing test for a bundle that failed to load. Keeps +// registration of the other, unrelated bundles unaffected: this only replaces +// what would otherwise be a silently-dropped test with a failing one under the +// same suite/test name. +inline void registerFailedBundleLoad(const std::string& suiteName, + const std::string& testName, + const std::string& message) +{ + ::testing::RegisterTest( + suiteName.c_str(), + testName.c_str(), + nullptr, + nullptr, + __FILE__, + __LINE__, + [message]() -> ::testing::Test* { return new FailedBundleLoadTest(message); }); +} + +// A bundle that failed to load, carrying enough information to register a +// FailedBundleLoadTest in its place: the suite/test name it would have used +// had it loaded, plus a diagnostic message describing why it didn't. +struct FailedLoad +{ + std::string suiteName; + std::string testName; + std::string message; +}; + +// A bundle that failed to load for an ordinary reason (malformed JSON, missing +// metadata, a bad sweep case, ...). No test is registered for it — only the +// diagnostic message to log. Kept distinct from FailedLoad so only the +// RuntimePassByValueInvariantError contradiction (see IntegrationTestBundle.hpp) +// turns the suite red; every other load failure keeps the original +// log-and-skip behavior. +struct SkippedLoad +{ + std::string message; +}; + +// The result of attempting to load one discovered bundle: it loaded +// successfully, it hit the PBV invariant and should hard-fail, or it failed to +// load for some other reason and should be skipped quietly. +using LoadOutcome = std::variant; + +// Attempts to load one discovered bundle and classifies the outcome. Split out +// from registerBundleTests() so the decision (did this bundle load, and if +// not, why) is a pure function that can be unit tested without touching +// ::testing::RegisterTest, which is only valid to call before RUN_ALL_TESTS() +// runs and so can't be exercised from within a running test body. +inline LoadOutcome classifyBundle(const DiscoveredBundle& disc) +{ + const auto diagnosticPath = disc.diagnosticPath(); + LoadResult loadResult; + try + { + loadResult = loadIntegrationTestBundle(disc); + } + catch(const RuntimePassByValueInvariantError& e) + { + return FailedLoad{disc.suiteName, + disc.testName, + "Failed to load bundle " + diagnosticPath.string() + ": " + e.what()}; + } + catch(const std::exception& e) + { + return SkippedLoad{"Skipping bundle " + diagnosticPath.string() + ": " + e.what()}; + } + + if(const auto* error = std::get_if(&loadResult)) + { + return SkippedLoad{"Skipping bundle " + diagnosticPath.string() + ": " + toString(*error)}; + } + + return LoadedBundle{diagnosticPath, + disc.suiteName, + disc.testName, + std::make_shared( + std::move(std::get(loadResult)))}; +} + // Registers one GTest test per preloaded bundle, run by the Engine executor. // This is the runtime, macro-free equivalent of TEST_F + INSTANTIATE_TEST_SUITE_P: // the suite/test names come from the filesystem scan, so they cannot be baked in @@ -116,40 +223,35 @@ inline void registerBundleTests() return; } - // Load all bundles eagerly, once, at registration time. A bundle that cannot - // be loaded (malformed JSON, invalid graph, or missing/invalid metadata) is - // logged and skipped — no test is registered for it. A bundle whose .bin - // blobs are absent loads with tensors == nullopt; its test registers and the - // harness SKIPs it at run time. A wrong-size blob throws here and is treated - // the same as any other load failure (logged and skipped). + // Load all bundles eagerly, once, at registration time. A bundle that + // fails to load because of the runtime-pass-by-value invariant (see + // RuntimePassByValueInvariantError in IntegrationTestBundle.hpp) gets a + // synthetic failing test registered in its place — see + // detail::registerFailedBundleLoad() — instead of just an ERROR log, so + // that specific contradiction turns the suite red rather than quietly + // shrinking it. Every other load failure (malformed JSON, invalid graph, + // missing/invalid metadata, a bad sweep case, a wrong-size blob) keeps the + // original behavior: logged and skipped, no test registered. A bundle + // whose .bin blobs are absent loads with tensors == nullopt; its test + // registers normally and the harness SKIPs it at run time. std::vector bundles; bundles.reserve(discovered.size()); for(const auto& disc : discovered) { - const auto diagnosticPath = disc.diagnosticPath(); - LoadResult loadResult; - try + auto outcome = detail::classifyBundle(disc); + if(auto* failed = std::get_if(&outcome)) { - loadResult = loadIntegrationTestBundle(disc); - } - catch(const std::exception& e) - { - HIPDNN_PLUGIN_LOG_ERROR("Skipping bundle " << diagnosticPath << ": " << e.what()); + HIPDNN_PLUGIN_LOG_ERROR(failed->message); + detail::registerFailedBundleLoad(failed->suiteName, failed->testName, failed->message); continue; } - - if(const auto* error = std::get_if(&loadResult)) + if(auto* skipped = std::get_if(&outcome)) { - HIPDNN_PLUGIN_LOG_ERROR("Skipping bundle " << diagnosticPath << ": " - << toString(*error)); + HIPDNN_PLUGIN_LOG_ERROR(skipped->message); continue; } - bundles.push_back({diagnosticPath, - disc.suiteName, - disc.testName, - std::make_shared( - std::move(std::get(loadResult)))}); + bundles.push_back(std::move(std::get(outcome))); } if(bundles.empty()) diff --git a/dnn-providers/integration-tests/src/harness/bundle/IntegrationTestBundle.hpp b/dnn-providers/integration-tests/src/harness/bundle/IntegrationTestBundle.hpp index 4c2ae7aa1eff..ca9a2f3e96f9 100644 --- a/dnn-providers/integration-tests/src/harness/bundle/IntegrationTestBundle.hpp +++ b/dnn-providers/integration-tests/src/harness/bundle/IntegrationTestBundle.hpp @@ -217,9 +217,53 @@ inline std::optional parseJsonFile(const std::filesystem::path& return std::make_optional(std::move(json)); } +// Thrown only by validateRuntimePassByValueTensors(), distinct from the generic +// schema-conversion failures buildGraphBuffer() otherwise collapses to +// LoadError::INVALID_GRAPH_SCHEMA. Kept as its own type so callers can single +// this one contradiction out for a hard failure instead of a quiet skip — see +// BundleRegistration.hpp's classifyBundle(). +class RuntimePassByValueInvariantError : public std::runtime_error +{ +public: + using std::runtime_error::runtime_error; +}; + +// Invariant: a tensor with is_runtime_pass_by_value=true must not also carry a baked +// value_type or value — if it does, both the CPU reference and the provider silently +// short-circuit to the baked value and the runtime path is never exercised. Checked here +// rather than in applyTensorPatches so it covers every path that reaches a graph buffer, +// not just the template-sweep path that patches tensors. +inline void validateRuntimePassByValueTensors(const nlohmann::json& graphJson) +{ + if(!graphJson.contains("tensors") || !graphJson.at("tensors").is_array()) + { + return; + } + + for(const auto& tensor : graphJson.at("tensors")) + { + if(tensor.value("is_runtime_pass_by_value", false) + && (tensor.contains("value_type") || tensor.contains("value"))) + { + const auto uid = tensor.value("uid", int64_t{-1}); + throw RuntimePassByValueInvariantError( + "tensor uid " + std::to_string(uid) + + " has is_runtime_pass_by_value=true but still carries value_type or value;" + " remove them from the tensor JSON, or from the sweep case's tensor_patches" + " 'remove' list or template"); + } + } +} + +// Validates the PBV invariant outside the try block below so its distinct +// RuntimePassByValueInvariantError propagates to the caller uncaught, instead +// of being collapsed into the generic false/INVALID_GRAPH_SCHEMA result used +// for ordinary schema-conversion failures. inline bool buildGraphBuffer(const nlohmann::json& graphJson, flatbuffers::DetachedBuffer& graphBuffer) { + validateRuntimePassByValueTensors(graphJson); + flatbuffers::FlatBufferBuilder builder; try { @@ -558,6 +602,70 @@ inline nlohmann::json expandTemplateGraph(const nlohmann::json& templateJson, return expanded; } +// Applies structural tensor patches declared in a sweep case's "tensor_patches" array. +// Each patch targets a tensor by uid and supports "set" (upsert fields) and "remove" (erase +// fields). Called after expandTemplateGraph so placeholders are already resolved, and before +// buildGraphBuffer so the flatbuffer has not yet been sealed. +inline void applyTensorPatches(nlohmann::json& expandedGraph, const nlohmann::json& caseJson) +{ + if(!caseJson.contains("tensor_patches") || !caseJson.at("tensor_patches").is_array()) + { + return; + } + + if(!expandedGraph.contains("tensors") || !expandedGraph.at("tensors").is_array()) + { + return; + } + + for(const auto& patch : caseJson.at("tensor_patches")) + { + if(!patch.is_object() || !patch.contains("uid") || !patch.at("uid").is_number_integer()) + { + throw std::runtime_error("tensor_patch entry is missing an integer uid"); + } + + const auto targetUid = patch.at("uid").get(); + bool found = false; + + for(auto& tensor : expandedGraph.at("tensors")) + { + if(!tensor.contains("uid") || tensor.at("uid").get() != targetUid) + { + continue; + } + + if(patch.contains("set") && patch.at("set").is_object()) + { + for(const auto& [key, val] : patch.at("set").items()) + { + tensor[key] = val; + } + } + + if(patch.contains("remove") && patch.at("remove").is_array()) + { + for(const auto& key : patch.at("remove")) + { + if(key.is_string()) + { + tensor.erase(key.get()); + } + } + } + + found = true; + break; + } + + if(!found) + { + throw std::runtime_error("tensor_patch uid " + std::to_string(targetUid) + + " not found in expanded graph"); + } + } +} + inline const nlohmann::json* findSweepCase(const nlohmann::json& sweepJson, const std::string& caseId) { @@ -616,8 +724,12 @@ inline std::optional // * inputs and outputs present -> bundle verified against golden data // // Inputs and outputs are loaded independently. Output uids come from the graph; -// every other declared tensor is treated as input. The function is total: it -// never lets an exception escape. +// every other declared tensor is treated as input. Every failure above is +// reported through the return value, except one: a +// RuntimePassByValueInvariantError from buildGraphBuffer() propagates +// uncaught, since callers (see BundleRegistration.hpp's classifyBundle()) +// deliberately treat that one contradiction as a hard failure rather than a +// quiet skip. inline LoadResult loadIntegrationTestBundle(const std::filesystem::path& jsonPath) { const auto graphJson = detail::parseJsonFile(jsonPath); @@ -680,6 +792,9 @@ inline LoadResult loadIntegrationTestBundle(const std::filesystem::path& jsonPat // case id, expand `${case...}` placeholders, load inline metadata, and resolve an // optional golden directory. Sweep authoring errors are reported as // INVALID_SWEEP_CASE; an expanded graph that still fails schema conversion is +// INVALID_GRAPH_SCHEMA. As with the direct-bundle overload, a +// RuntimePassByValueInvariantError from buildGraphBuffer() is the one +// exception that propagates uncaught rather than being folded into // INVALID_GRAPH_SCHEMA. inline LoadResult loadIntegrationTestBundle(const DiscoveredBundle& discovered) { @@ -707,6 +822,7 @@ inline LoadResult loadIntegrationTestBundle(const DiscoveredBundle& discovered) { expandedGraph = detail::expandTemplateGraph(*templateJson, *caseJson, discovered); goldenDirectory = detail::resolveSweepGoldenDirectory(discovered.jsonPath, *caseJson); + detail::applyTensorPatches(expandedGraph, *caseJson); } catch(const std::exception&) { diff --git a/dnn-providers/integration-tests/tests/TestBundleDiscovery.cpp b/dnn-providers/integration-tests/tests/TestBundleDiscovery.cpp index b6e5ab3afd59..9241f386fe52 100644 --- a/dnn-providers/integration-tests/tests/TestBundleDiscovery.cpp +++ b/dnn-providers/integration-tests/tests/TestBundleDiscovery.cpp @@ -1,6 +1,7 @@ // Copyright © Advanced Micro Devices, Inc., or its affiliates. // SPDX-License-Identifier: MIT +#include #include #include @@ -16,6 +17,7 @@ #include #include "harness/bundle/BundleDiscovery.hpp" +#include "harness/bundle/BundleRegistration.hpp" #include "harness/bundle/IntegrationTestBundle.hpp" using namespace hipdnn_integration_tests::bundle; @@ -608,6 +610,55 @@ TEST_F(TestBundleDiscoveryFixture, LoadTemplateSweepCaseMissingTensorValueIsErro EXPECT_EQ(std::get(result), LoadError::INVALID_SWEEP_CASE); } +// A tensor_patches "set" that flips is_runtime_pass_by_value to true while the +// tensor still carries a baked value_type/value is rejected: buildGraphBuffer's +// validateRuntimePassByValueTensors check runs on the expanded+patched graph, so +// the contradiction can't slip through the template-sweep path. It throws +// RuntimePassByValueInvariantError rather than returning INVALID_GRAPH_SCHEMA, +// so this one contradiction can be routed to a hard failure (see +// classifyBundle() in BundleRegistration.hpp) instead of the quiet skip every +// other load failure gets. +TEST_F(TestBundleDiscoveryFixture, LoadTemplateSweepCaseWithBakedValueAndRuntimePassByValueIsError) +{ + const auto sweepDir = _tempDir / "quick" / "BatchnormFwdInference" / "Inference"; + createTemplateSweep(sweepDir, + {{"baked_runtime_scale_fp32_nchw", + "float", + {2, 3, 4, 5}, + {60, 20, 5, 1}, + {1, 3, 1, 1}, + {3, 1, 1, 1}}}); + + auto sweepJson = nlohmann::json::parse(std::ifstream(sweepDir / "sweep.json")); + sweepJson["cases"][0]["tensor_patches"] = nlohmann::json::array( + {{{"uid", 3}, + {"set", + {{"is_runtime_pass_by_value", true}, {"value_type", "Float32Value"}, {"value", 2.0}}}}}); + std::ofstream(sweepDir / "sweep.json") << sweepJson.dump(2); + + const auto discovered = discoverBundles(_tempDir); + ASSERT_EQ(discovered.size(), 1u); + + EXPECT_THROW(loadIntegrationTestBundle(discovered.front()), + detail::RuntimePassByValueInvariantError); +} + +// The same invariant must hold for a direct (non-sweep) bundle's graph.json, +// which never goes through applyTensorPatches. Regression test for the gap +// where validateRuntimePassByValueTensors lived only in applyTensorPatches and +// this path loaded a contradictory tensor without complaint. +TEST_F(TestBundleDiscoveryFixture, LoadDirectBundleWithBakedValueAndRuntimePassByValueIsError) +{ + auto dir = _tempDir / "op" / "bakedscale"; + std::filesystem::create_directories(dir); + std::ofstream(dir / "bakedscale.json") + << R"({"tensors": [{"uid": 0, "is_runtime_pass_by_value": true, )" + R"("value_type": "Float32Value", "value": 2.0}]})"; + + EXPECT_THROW(loadIntegrationTestBundle(dir / "bakedscale.json"), + detail::RuntimePassByValueInvariantError); +} + TEST_F(TestBundleDiscoveryFixture, LoadBundleWrongSizeBinIsTensorLoadError) { auto dir = _tempDir / "op" / "badbin"; @@ -757,4 +808,137 @@ TEST_F(TestBundleDiscoveryFixture, UnusedSweepValueWarnsButLoadSucceeds) ASSERT_TRUE(std::holds_alternative(result)); } +// classifyBundle() is the testable decision step behind registerBundleTests(): +// it makes the same load-and-classify call that loop makes per discovered +// bundle, without touching ::testing::RegisterTest (which can only run before +// RUN_ALL_TESTS(), not from inside a running test body). These tests cover the +// routing itself — a good bundle becomes a LoadedBundle, a bad one becomes a +// FailedLoad — since nothing previously exercised that routing directly. +TEST_F(TestBundleDiscoveryFixture, ClassifyBundleReturnsLoadedBundleForGoodBundle) +{ + auto dir = _tempDir / "op" / "goodbundle"; + createLoadableBundle(dir, "goodbundle"); + + const auto discovered = discoverBundles(_tempDir); + ASSERT_EQ(discovered.size(), 1u); + + auto outcome = detail::classifyBundle(discovered.front()); + ASSERT_TRUE(std::holds_alternative(outcome)); + auto& loaded = std::get(outcome); + EXPECT_EQ(loaded.suiteName, discovered.front().suiteName); + EXPECT_EQ(loaded.testName, discovered.front().testName); + ASSERT_NE(loaded.bundle, nullptr); +} + +// Reuses the baked-value-plus-runtime-pass-by-value corruption from +// LoadTemplateSweepCaseWithBakedValueAndRuntimePassByValueIsError: that test +// confirms loadIntegrationTestBundle() throws RuntimePassByValueInvariantError +// for this case; this one confirms classifyBundle() catches that specific +// exception and turns it into a FailedLoad carrying the diagnostic path and +// reason, which is what lets registerBundleTests() surface it as a failing +// test instead of a log line. +TEST_F(TestBundleDiscoveryFixture, ClassifyBundleReturnsFailedLoadForRuntimePassByValueInvariant) +{ + const auto sweepDir = _tempDir / "quick" / "BatchnormFwdInference" / "Inference"; + createTemplateSweep(sweepDir, + {{"baked_runtime_scale_fp32_nchw", + "float", + {2, 3, 4, 5}, + {60, 20, 5, 1}, + {1, 3, 1, 1}, + {3, 1, 1, 1}}}); + + auto sweepJson = nlohmann::json::parse(std::ifstream(sweepDir / "sweep.json")); + sweepJson["cases"][0]["tensor_patches"] = nlohmann::json::array( + {{{"uid", 3}, + {"set", + {{"is_runtime_pass_by_value", true}, {"value_type", "Float32Value"}, {"value", 2.0}}}}}); + std::ofstream(sweepDir / "sweep.json") << sweepJson.dump(2); + + const auto discovered = discoverBundles(_tempDir); + ASSERT_EQ(discovered.size(), 1u); + + auto outcome = detail::classifyBundle(discovered.front()); + ASSERT_TRUE(std::holds_alternative(outcome)); + auto& failed = std::get(outcome); + EXPECT_EQ(failed.suiteName, discovered.front().suiteName); + EXPECT_EQ(failed.testName, discovered.front().testName); + EXPECT_NE(failed.message.find(discovered.front().diagnosticPath().string()), std::string::npos); + EXPECT_NE(failed.message.find("is_runtime_pass_by_value=true"), std::string::npos); +} + +// Only the RuntimePassByValueInvariantError contradiction gets a FailedLoad. +// An ordinary invalid-sweep-case failure (here: a case referencing a golden +// path that was never created) must keep the original behavior — logged and +// classified as SkippedLoad, no failing test registered — so this fix doesn't +// widen every pre-existing load failure into a hard suite failure. +TEST_F(TestBundleDiscoveryFixture, ClassifyBundleReturnsSkippedLoadForOrdinaryInvalidSweepCase) +{ + createTemplateSweep(_tempDir / "quick" / "BatchnormFwdInference" / "Inference", + {{"missing_path_fp32_nchw", + "float", + {2, 3, 4, 5}, + {60, 20, 5, 1}, + {1, 3, 1, 1}, + {3, 1, 1, 1}, + true, + false}}); + + const auto discovered = discoverBundles(_tempDir); + ASSERT_EQ(discovered.size(), 1u); + + auto outcome = detail::classifyBundle(discovered.front()); + ASSERT_TRUE(std::holds_alternative(outcome)); + auto& skipped = std::get(outcome); + EXPECT_NE(skipped.message.find(discovered.front().diagnosticPath().string()), + std::string::npos); + EXPECT_NE(skipped.message.find(toString(LoadError::INVALID_SWEEP_CASE)), std::string::npos); +} + +// Direct regression test for the original review repro: corrupting one sweep +// case must not affect classification of an unrelated, valid bundle +// discovered alongside it. +TEST_F(TestBundleDiscoveryFixture, ClassifyBundleIsolatesFailureAmongMultipleDiscoveredBundles) +{ + auto goodDir = _tempDir / "op" / "goodbundle"; + createLoadableBundle(goodDir, "goodbundle"); + + const auto sweepDir = _tempDir / "quick" / "BatchnormFwdInference" / "Inference"; + createTemplateSweep(sweepDir, + {{"baked_runtime_scale_fp32_nchw", + "float", + {2, 3, 4, 5}, + {60, 20, 5, 1}, + {1, 3, 1, 1}, + {3, 1, 1, 1}}}); + auto sweepJson = nlohmann::json::parse(std::ifstream(sweepDir / "sweep.json")); + sweepJson["cases"][0]["tensor_patches"] = nlohmann::json::array( + {{{"uid", 3}, + {"set", + {{"is_runtime_pass_by_value", true}, {"value_type", "Float32Value"}, {"value", 2.0}}}}}); + std::ofstream(sweepDir / "sweep.json") << sweepJson.dump(2); + + const auto discovered = discoverBundles(_tempDir); + ASSERT_EQ(discovered.size(), 2u); + + const auto* goodBundle = findByTest(discovered, "goodbundle"); + const auto* badBundle = findByTest(discovered, "baked_runtime_scale_fp32_nchw"); + ASSERT_NE(goodBundle, nullptr); + ASSERT_NE(badBundle, nullptr); + + EXPECT_TRUE(std::holds_alternative(detail::classifyBundle(*goodBundle))); + EXPECT_TRUE(std::holds_alternative(detail::classifyBundle(*badBundle))); +} + +// Closes the loop between "classifyBundle() decided this bundle failed" and +// "the failing test GTest actually runs really fails": constructs the +// synthetic test body directly and confirms it records exactly the stored +// message as a non-fatal failure, the same way GTest would run it once +// registerFailedBundleLoad() has registered it. +TEST_F(TestBundleDiscoveryFixture, FailedBundleLoadRecordsFailureWithMessage) +{ + detail::FailedBundleLoadTest test("boom"); + EXPECT_NONFATAL_FAILURE(test.TestBody(), "boom"); +} + // NOLINTEND(readability-identifier-naming)