2 """Positive-threshold review surface validation for performance evidence. 4 Evaluates the bounded representative structured review set against the sequential 5 baseline and records per-case positive-threshold verdicts without turning the 6 result into a universal acceleration claim. 9 python benchmarks/density_matrix/performance_evidence/positive_threshold_validation.py 12 from __future__
import annotations
15 from pathlib
import Path
17 REPO_ROOT = Path(__file__).resolve().parents[3]
18 if str(REPO_ROOT)
not in sys.path:
19 sys.path.insert(0, str(REPO_ROOT))
21 from benchmarks.density_matrix.performance_evidence.common
import (
22 performance_evidence_output_dir,
24 from benchmarks.density_matrix.performance_evidence.records
import (
25 build_performance_evidence_benchmark_records,
27 from benchmarks.density_matrix.performance_evidence.validation_support
import (
28 assemble_record_schema_case_bundle,
30 from benchmarks.density_matrix.validation_scaffold
import (
31 require_bundle_fields,
35 SUITE_NAME =
"performance_evidence_positive_threshold" 36 ARTIFACT_FILENAME =
"positive_threshold_bundle.json" 38 ARTIFACT_CORE_FIELDS = (
41 "record_schema_version",
53 if case[
"representative_review_case"]
58 review_surface_pass = all(
59 case[
"sequential_median_runtime_ms"]
is not None 60 and case[
"fused_median_runtime_ms"]
is not None 61 and case[
"sequential_median_peak_rss_kb"]
is not None 62 and case[
"fused_median_peak_rss_kb"]
is not None 65 status =
"pass" if review_surface_pass
and len(cases) > 0
else "fail" 67 "total_cases": len(cases),
68 "actual_fused_review_cases": sum(case[
"actual_fused_execution"]
for case
in cases),
69 "positive_threshold_pass_cases": sum(case[
"positive_threshold_pass"]
for case
in cases),
70 "diagnosis_candidate_cases": sum(
71 (
not case[
"positive_threshold_pass"])
and case[
"counted_supported_benchmark_case"]
74 "review_groups": sorted(
75 {case[
"review_group_id"]
for case
in cases
if case[
"review_group_id"]
is not None}
83 def main(argv: list[str] |
None =
None) -> int:
86 build_cases=build_positive_threshold_cases,
87 build_artifact_bundle=build_positive_threshold_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 positive-threshold bundle into.",
92 quiet_report=
lambda b: print(
93 "positive_threshold_pass_cases={positive_threshold_pass_cases}, diagnosis_candidate_cases={diagnosis_candidate_cases}".format(
100 if __name__ ==
"__main__":
101 raise SystemExit(
main())
def build_positive_threshold_cases()
def build_performance_evidence_benchmark_records()
def build_positive_threshold_bundle
def performance_evidence_output_dir
def assemble_record_schema_case_bundle
def require_bundle_fields