2 """Runtime and fusion path classification validation. 4 Records how the fused-capable runtime classifies supported matrix cases while 5 keeping those classifications directly comparable to the same correctness 6 thresholds used elsewhere in the evidence pipeline. 9 python benchmarks/density_matrix/correctness_evidence/runtime_classification_validation.py 12 from __future__
import annotations
14 from pathlib
import Path
16 from benchmarks.density_matrix.correctness_evidence.common
import (
17 CORRECTNESS_EVIDENCE_RUNTIME_CLASS_BASELINE,
18 correctness_evidence_output_dir,
20 from benchmarks.density_matrix.correctness_evidence.records
import (
21 build_correctness_evidence_positive_records,
23 from benchmarks.density_matrix.correctness_evidence.validation_support
import (
24 assemble_positive_case_bundle,
26 from benchmarks.density_matrix.validation_scaffold
import (
27 require_bundle_fields,
31 SUITE_NAME =
"correctness_evidence_runtime_classification" 32 ARTIFACT_FILENAME =
"runtime_classification_bundle.json" 34 ARTIFACT_CORE_FIELDS = (
37 "record_schema_version",
50 classification_counts = {
51 "actually_fused": sum(
52 case[
"runtime_path_classification"] ==
"actually_fused" for case
in cases
54 "supported_but_unfused": sum(
55 case[
"runtime_path_classification"] ==
"supported_but_unfused" 58 "deferred_or_unsupported_candidate": sum(
59 case[
"runtime_path_classification"] ==
"deferred_or_unsupported_candidate" 62 CORRECTNESS_EVIDENCE_RUNTIME_CLASS_BASELINE: sum(
63 case[
"runtime_path_classification"] == CORRECTNESS_EVIDENCE_RUNTIME_CLASS_BASELINE
69 if sum(classification_counts.values()) == len(cases)
70 and all(case[
"supported_runtime_case"]
for case
in cases)
74 "total_cases": len(cases),
75 **classification_counts,
76 "actual_fused_cases": sum(case[
"actual_fused_execution"]
for case
in cases),
83 def main(argv: list[str] |
None =
None) -> int:
86 build_cases=build_cases,
87 build_artifact_bundle=build_artifact_bundle,
88 artifact_filename=ARTIFACT_FILENAME,
89 default_output_dir=DEFAULT_OUTPUT_DIR,
90 description=__doc__
or "",
91 output_dir_help=
"Directory to write the runtime classification bundle into.",
92 quiet_report=
lambda b: print(
93 "actually_fused={actually_fused}, supported_but_unfused={supported_but_unfused}, deferred_or_unsupported_candidate={deferred_or_unsupported_candidate}".format(
100 if __name__ ==
"__main__":
101 raise SystemExit(
main())
def build_correctness_evidence_positive_records()
def correctness_evidence_output_dir
def assemble_positive_case_bundle
def require_bundle_fields
def build_artifact_bundle