Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
539ff5d
add unified contraction algebra interface with tropical and bf16 appl…
DeanTMaxim Jul 17, 2026
a1f8c1b
bf16: genuine-bf16 einsum kernel
DeanTMaxim Jul 18, 2026
b3d3d34
fix: reduce cognitive complexity in _pair_einsum and fix implicit str…
DeanTMaxim Jul 18, 2026
5de41f8
refactor: merge 6 tropical test files into single test_tropical.py
DeanTMaxim Jul 18, 2026
b218efd
refactor: remove algebra parameter from set_contractor
DeanTMaxim Jul 18, 2026
3ad432c
refactor: replace prefer_einsum attr with get_contractor_kwargs() method
DeanTMaxim Jul 19, 2026
df2776b
refactor: flatten contraction_algebra subpackage into single file
DeanTMaxim Jul 19, 2026
3c78e81
fix: strict mypy Dict[str, Any] annotation + black formatting
DeanTMaxim Jul 19, 2026
2b16100
refactor: move contraction_algebra import to top of cons.py
DeanTMaxim Jul 19, 2026
986588b
fix: address PR review minor issues (code quality + docs)
DeanTMaxim Jul 19, 2026
c8e8aea
refactor: default _contraction_algebra to None instead of StandardAlg…
DeanTMaxim Jul 19, 2026
d69d7f7
refactor: default _contraction_algebra to None, clean up guard checks
DeanTMaxim Jul 19, 2026
dcb9490
refactor: simplify _algebraic_base_contraction — ns = alg is not None
DeanTMaxim Jul 19, 2026
a345215
test: update assertions for _contraction_algebra default None
DeanTMaxim Jul 19, 2026
0184776
fix: inline alg is not None for mypy type narrowing
DeanTMaxim Jul 19, 2026
bc7671c
introduce pairtensor wrapper and apply contraction algebra review fee…
DeanTMaxim Jul 20, 2026
dee039b
feat(bf16): backend-native bf16 dtype + native einsum on GPU backends…
DeanTMaxim Jul 20, 2026
db3a4d5
test(bf16): GPU smoke tests across jax/pytorch/tensorflow/cupy (env-g…
DeanTMaxim Jul 20, 2026
529edfd
feat(bench): GPU bf16 benchmark harness (end-to-end + micro, subproce…
DeanTMaxim Jul 20, 2026
4badd16
feat(bench): CSV -> markdown aggregator for bf16 GPU results
DeanTMaxim Jul 20, 2026
1502568
feat(bench): SLURM + env setup scripts for A100 bf16 benchmark (E2 un…
DeanTMaxim Jul 20, 2026
5244d28
fix(bench): unbiased bf16 peak-mem window + disable jax/tf prealloc; …
DeanTMaxim Jul 20, 2026
424a6e7
style: black formatting on L3 benchmark/test files
DeanTMaxim Jul 20, 2026
3444932
fix(bench): run pytorch trials on GPU (was CPU) + host-convert results
DeanTMaxim Jul 21, 2026
d2e8cb2
feat(l3): pytorch GPU bf16 verification + benchmark on RTX 5070 Ti (s…
DeanTMaxim Jul 21, 2026
dd6a36b
feat(l3): jax GPU bf16 verification + benchmark on RTX 5070 Ti (sm_120)
DeanTMaxim Jul 21, 2026
b36d18e
fix(bf16): _pair_to_complex tensorflow-compatible complex recombination
DeanTMaxim Jul 21, 2026
84aff85
feat(l3): tensorflow GPU bf16 verification + benchmark on RTX 5070 Ti…
DeanTMaxim Jul 21, 2026
7dc31d7
fix(bf16): cupy compatibility (_bf16_dtype, single-operand einsum, te…
DeanTMaxim Jul 21, 2026
3e96ec7
feat(l3): cupy GPU bf16 verification + benchmark on RTX 5070 Ti (sm_120)
DeanTMaxim Jul 21, 2026
5bcd270
feat(l3): aggregate bf16 GPU benchmark results across all four backends
DeanTMaxim Jul 21, 2026
9ca1941
chore(probe): record phase0 nsys/ncu setup status (fallback to lens 1+2)
DeanTMaxim Jul 21, 2026
217cbea
feat(probe): add phase0 shared scaffolding (_phase0_common)
DeanTMaxim Jul 21, 2026
19624ca
feat(probe): Probe 2 frontier mapping (smoke verified)
DeanTMaxim Jul 21, 2026
5b67a3f
fix(probe): classify warmup OOM correctly in Probe 2 frontier
DeanTMaxim Jul 21, 2026
4f9b313
feat(probe): Probe 3 XLA fusion-window localization (smoke verified)
DeanTMaxim Jul 21, 2026
8cb7396
fix(probe): Probe 3 lens1 stablehlo counts + classify/calibration guards
DeanTMaxim Jul 21, 2026
dc6165f
feat(probe): Probe 1 deferred cuBLASLt gap analysis + SM120 bf16 ceil…
DeanTMaxim Jul 21, 2026
fbdb2b7
fix(probe): suppress gap-probe warnings + add fp32 warmup in Probe 1 …
DeanTMaxim Jul 21, 2026
675b291
feat(probe): Phase 0 go/no-go aggregator + provisional verdict
DeanTMaxim Jul 21, 2026
ffc42c7
fix(probe): Probe 3 expectation API + Probe 1 ratio column direction
DeanTMaxim Jul 21, 2026
350c381
feat(probe): Phase 0 targeted measurements + informed GO-for-large-n …
DeanTMaxim Jul 21, 2026
cc8b6c6
docs(probe): mark phase0 verdict SUPERSEDED (INCONCLUSIVE per 2026-07…
DeanTMaxim Jul 22, 2026
61357a6
fix(probe): orchestrator respects worker-reported outcome (review §4.1)
DeanTMaxim Jul 22, 2026
c164532
fix(probe): dtype + pair-HLO probes actually test their claims (revie…
DeanTMaxim Jul 22, 2026
27c69bb
feat(probe): parameterized circuit defeats XLA constant folding (revi…
DeanTMaxim Jul 22, 2026
fef788b
feat(probe): C1 compile/runtime memory split + optimized HLO + buffer…
DeanTMaxim Jul 22, 2026
3d1ce45
fix(probe): C1 runtime-peak uses memory_analysis temp_size_in_bytes (…
DeanTMaxim Jul 22, 2026
7ac00f3
feat(probe): C1 four-condition judgment + 3x repeat + fusion A/B (rev…
DeanTMaxim Jul 22, 2026
9a2e112
fix(probe): C1 condition-2 wired to independent optimized-HLO evidenc…
DeanTMaxim Jul 22, 2026
32e86c3
feat(probe): export real contraction shapes from cotengra tree (revie…
DeanTMaxim Jul 22, 2026
b9afd48
feat(probe): C2 tile-mappability classification (review §6.2)
DeanTMaxim Jul 22, 2026
518613e
feat(probe): four-state structured gonogo aggregator + artifacts/mani…
DeanTMaxim Jul 22, 2026
4e2adb3
feat(probe): cublasLt C++ extension build skeleton + smoke (Plan B Ta…
DeanTMaxim Jul 22, 2026
066224c
feat(probe): planar complex BF16 cublasLt matmul + correctness (Plan …
DeanTMaxim Jul 22, 2026
87b6a3f
fix(probe): BF16-output path + relative-error gate for planar cublasL…
DeanTMaxim Jul 22, 2026
08aabaf
feat(probe): cublasLt planar §7 capability+perf matrix on real shapes…
DeanTMaxim Jul 22, 2026
381cc21
fix(probe): fair kernel-only planar timing for C3_planar §7.5 gate (P…
DeanTMaxim Jul 22, 2026
a12578e
feat(probe): CUTLASS SM120 compile-level probe (Plan B Task 4)
DeanTMaxim Jul 22, 2026
4dcbde6
feat(probe): wire C3_planar (cublasLt capability) into four-state gon…
DeanTMaxim Jul 22, 2026
3f4a331
refactor(probe): reorganize Phase 0 probes into results/_phase0/ pack…
DeanTMaxim Jul 22, 2026
0c52cba
refactor(probe): C1 buffer-assignment audit + planned/runtime temp sp…
DeanTMaxim Jul 22, 2026
1f1d848
feat(probe): C1 anchor -> HLO SSA producer/consumer edge map
DeanTMaxim Jul 22, 2026
ddeee3e
feat(probe): region/tile-fusion prototype (minimal viable) -- 512MiB …
DeanTMaxim Jul 22, 2026
1d6af94
feat(probe): full region/tile-fusion prototype (rereview §5.3) -- TIL…
DeanTMaxim Jul 22, 2026
17506e1
feat(probe): canonical C2 gate from HLO use-def edge + prototype -> C…
DeanTMaxim Jul 22, 2026
41ad77a
fix(probe): trace C1 anchor through layout fusion to real GEMM consum…
DeanTMaxim Jul 22, 2026
f56372d
fix(probe): C1 tuple data/workspace split + CSV dedup + dynamic repea…
DeanTMaxim Jul 22, 2026
c1e2560
feat(probe): XLA buffer-assignment dump probe (correction Task A2) --…
DeanTMaxim Jul 22, 2026
51957bc
feat(probe): enrich C1 audit with real XLA allocation/liveness/aliasi…
DeanTMaxim Jul 22, 2026
d744233
feat(probe): aliasing-aware C2 peak analysis -> C2 region-fusion NOT_…
DeanTMaxim Jul 22, 2026
21d2f47
fix(probe): fail-closed canonical C2 gate -> C2 FAIL/NOT_FEASIBLE (co…
DeanTMaxim Jul 22, 2026
ba83506
chore(probe): C2 checkpoint closeout + package black hygiene (correct…
DeanTMaxim Jul 22, 2026
4a8280c
chore(probe): Phase 0 run_context reproducibility provenance (final-r…
DeanTMaxim Jul 22, 2026
a69b378
fix(probe): C1 audit v2 provenance + idempotency (final-remediation T…
DeanTMaxim Jul 22, 2026
2dff0bd
feat(probe): emit exact C1-to-C2 transform map v2 (final-remediation …
DeanTMaxim Jul 22, 2026
518dbcf
feat(probe): analyze single and joint executable peak frontier (final…
DeanTMaxim Jul 22, 2026
35c62e4
feat(probe): prototype real producer-transform-consumer region (final…
DeanTMaxim Jul 22, 2026
8287f55
fix(probe): implement fail-closed canonical C2 v2 gate (final-remedia…
DeanTMaxim Jul 22, 2026
d2b52e9
feat(probe): complete C3 planar full matrix (final-remediation Task 6)
DeanTMaxim Jul 22, 2026
745a45a
feat(probe): add grouped planar-complex capability probe (final-remed…
DeanTMaxim Jul 22, 2026
dd609b4
feat(probe): Task 8 build harness + path discovery for CUTLASS 4M (fi…
DeanTMaxim Jul 22, 2026
8f88576
feat(probe): Task 8 2.x Sm80 single-4M CUTLASS kernel + correctness (…
DeanTMaxim Jul 22, 2026
886a850
feat(probe): Task 8 single-4M resource + fair kernel-only latency (fi…
DeanTMaxim Jul 22, 2026
e08e853
feat(probe): Task 4 3.x Sm100 4M peak attempt + sm80 fallback (final-…
DeanTMaxim Jul 22, 2026
a1d6d0c
feat(probe): Task 4b native Sm120 BF16 4M attempt (FEASIBLE_WITH_SM80…
DeanTMaxim Jul 22, 2026
d8ca618
feat(probe): Task 5 CUTLASS 2.x GemmGrouped 4M handoff (final-remedia…
DeanTMaxim Jul 22, 2026
7cccde7
feat(probe): Task 8 cutlass-sm120-4m-v1 verdict aggregator + artifact…
DeanTMaxim Jul 22, 2026
c618612
feat(probe): Task 8 CUTLASS SM120 4M artifacts + remove PlanB-T4 smok…
DeanTMaxim Jul 22, 2026
14c2c6f
fix(probe): Task 8 final-remediation Important findings I1+I2+I3
DeanTMaxim Jul 22, 2026
84a11b5
feat(probe): add numerical validation metrics pure function
DeanTMaxim Jul 23, 2026
3b934bf
feat(probe): add 3-level adversarial dynamic-range input generator
DeanTMaxim Jul 23, 2026
2ed00f2
feat(probe): add per route x dtype numerical policy gate
DeanTMaxim Jul 23, 2026
d6f296d
feat(probe): add fail-closed numerical aggregator truth table
DeanTMaxim Jul 23, 2026
637fbdf
feat(probe): add numerical validation CSV/JSON writers + matrix const…
DeanTMaxim Jul 23, 2026
ff48e3e
feat(probe): add planar route numerical collector (GPU)
DeanTMaxim Jul 23, 2026
3598da7
fix(probe): Task 6 review — dtype validation, C16BF policy consistenc…
DeanTMaxim Jul 23, 2026
34b2c6c
feat(probe): add grouped (batched) route numerical collector (GPU)
DeanTMaxim Jul 23, 2026
e78435e
feat(probe): add region_fused small-contract numerical collector (GPU)
DeanTMaxim Jul 23, 2026
822f706
feat(probe): add cutlass_4m_single numerical collector (reuse Task 8 …
DeanTMaxim Jul 23, 2026
99eb479
feat(probe): add Phase 0 numerical validation matrix (Task 9)
DeanTMaxim Jul 23, 2026
8fc86c3
fix(probe): Task 10 review — cutlass not_run no longer sinks overall …
DeanTMaxim Jul 23, 2026
b647449
feat(probe): add tri-state normalizer + route/criteria constants for …
DeanTMaxim Jul 23, 2026
8669a2b
feat(probe): add fail-closed two-layer artifact readers (full-matrix/…
DeanTMaxim Jul 23, 2026
dd2d95f
fix(probe): harden numerical_per_route + full-matrix reader fail-clos…
DeanTMaxim Jul 23, 2026
117e94d
feat(probe): add capability_layer + numerical_layer per-route tri-sta…
DeanTMaxim Jul 23, 2026
9b13819
feat(probe): add route_verdict (truth-table rule 8, per-route fail-cl…
DeanTMaxim Jul 23, 2026
0819b64
feat(probe): add evaluate_completion + authorize_phase1 (truth-table …
DeanTMaxim Jul 23, 2026
8f52070
feat(probe): add aggregate_two_layer composer + reasons/blocking + MD…
DeanTMaxim Jul 23, 2026
8c46b4b
feat(probe): wire main() to two-layer aggregator (honest INCONCLUSIVE…
DeanTMaxim Jul 23, 2026
d08ef00
style(probe): black-format gonogo.py + gonogo_test.py (py310)
DeanTMaxim Jul 23, 2026
6620070
feat(probe): regenerate Phase 0 gonogo-v2 + minimal manifest (honest …
DeanTMaxim Jul 23, 2026
081d476
refactor(probe): Task 10 final-review quick wins — drop dead _parse_c…
DeanTMaxim Jul 23, 2026
b86a5b4
feat(probe): add manifest hash helpers + schema constants (Task 11)
DeanTMaxim Jul 23, 2026
7167814
feat(probe): add fail-closed presence check to manifest (Task 11)
DeanTMaxim Jul 23, 2026
40df7b6
feat(probe): add C2/NUMERICAL checkpoint-hash cross-validation to man…
DeanTMaxim Jul 23, 2026
4308ef2
feat(probe): add cases + inputs/outputs collection to manifest (Task 11)
DeanTMaxim Jul 23, 2026
b5cfb93
feat(probe): add build_manifest composer + main() with integration te…
DeanTMaxim Jul 23, 2026
894e86e
refactor(probe): hand manifest.json ownership from gonogo to manifest…
DeanTMaxim Jul 23, 2026
109211a
feat(probe): regenerate Phase 0 manifest-v1 (full reproducibility, fa…
DeanTMaxim Jul 23, 2026
d8b7714
refactor(probe): Task 11 final-review cleanups — coerce non-dict JSON…
DeanTMaxim Jul 23, 2026
fdf0a58
fix(probe): Task 12 LF-canonical reproducibility + region_proto test-…
DeanTMaxim Jul 23, 2026
e339fe8
Task 0 (SDD): fail-closed RED baseline + verdict_schema vocabulary
DeanTMaxim Jul 23, 2026
faf7bf5
fix(test): Task 0 review follow-up — convert 2 wrong-PASS tests to fa…
DeanTMaxim Jul 23, 2026
7523806
fix(gate): Task 1 wire canonical verdict_schema into gonogo._normalize
DeanTMaxim Jul 23, 2026
0c1f5cd
fix(region): Task 2a honest evidence classification — no false PASS w…
DeanTMaxim Jul 23, 2026
7e6a3a5
chore(phase0): Task 2a dirty-tree hygiene — commit consistent artifacts
DeanTMaxim Jul 23, 2026
4400c48
fix(phase0): Task 4 split CUTLASS verdict into native-SM120 + SM80-fa…
DeanTMaxim Jul 23, 2026
b4fa821
fix(gate): Task 5 strict C3 planar full-matrix 128-cell validator
DeanTMaxim Jul 23, 2026
725174e
fix(gate): Task 5 enforce C3 algorithm-column legality
DeanTMaxim Jul 23, 2026
428daf7
fix(numerical): Task 3a fail-closed required-cell schema + real relat…
DeanTMaxim Jul 23, 2026
aca2f41
fix(numerical): Task 3a CSV NOT_RUN self-describing source column
DeanTMaxim Jul 23, 2026
e9033a6
fix(manifest): Task 6 fail-closed full binding + recompute derived state
DeanTMaxim Jul 23, 2026
a465b5a
fix(manifest): F1 cascade C2 checkpoint downgrade to whole C2 family
DeanTMaxim Jul 23, 2026
b975c8f
fix(gonogo): Task 7 reuse shared truth table + canonical criteria keys
DeanTMaxim Jul 23, 2026
2058996
fix(verdict_schema): Task 7 review canonical-key + truth-table logic …
DeanTMaxim Jul 23, 2026
2129a85
fix(phase0): Task 8 privacy sanitizer + Black gate + LF pin
DeanTMaxim Jul 23, 2026
6963a17
fix(phase0): Task 8 review - sanitizer placeholder double-wrap + regr…
DeanTMaxim Jul 23, 2026
83263a0
test(phase0): lock non-GPU rereview regressions
DeanTMaxim Jul 24, 2026
713f475
refactor(phase0): unify canonical criteria and C2 layers
DeanTMaxim Jul 24, 2026
f7c71b3
fix(phase0): reject model-only region peak evidence
DeanTMaxim Jul 24, 2026
7acc7d4
fix(phase0): construct real cancellation inputs and bind shapes
DeanTMaxim Jul 24, 2026
7a08d65
fix(phase0): record cancellation metrics in numerical output
DeanTMaxim Jul 24, 2026
927888a
fix(phase0): rederive canonical capability readers
DeanTMaxim Jul 24, 2026
48fcb75
fix(phase0): close capability-reader false-PASS paths
DeanTMaxim Jul 24, 2026
fdfeceb
fix(phase0): bind every numerical source artifact by hash
DeanTMaxim Jul 24, 2026
7b79099
fix(phase0): enforce full-matrix algorithm and workspace limits
DeanTMaxim Jul 24, 2026
e7074a6
fix(phase0): remove machine-specific tracked configuration
DeanTMaxim Jul 24, 2026
cefbc05
fix(phase0): report only actual blocking artifacts
DeanTMaxim Jul 24, 2026
f59f5fd
chore(phase0): regenerate non-GPU verdict artifacts and closeout
DeanTMaxim Jul 24, 2026
3d1ce33
feat(phase0): gate contracts (empty-safe, OR-of-AND fail) as single s…
DeanTMaxim Jul 24, 2026
7286bdd
fix(phase0): unified cancellation_v2 token + 7-tuple cell key (emitte…
DeanTMaxim Jul 24, 2026
f5ac8d3
fix(phase0): grouped v2 reader+producer (exact schema, probe allowlis…
DeanTMaxim Jul 24, 2026
e5afade
fix(phase0): shared region normalizer + GateContract (accuracy/resour…
DeanTMaxim Jul 24, 2026
a103f90
fix(phase0): explicit numerical global-invalid flags (duplicate/drift…
DeanTMaxim Jul 24, 2026
f5ea1af
fix(phase0): tighten case-binding hash length check to 64 chars (hono…
DeanTMaxim Jul 24, 2026
a01382f
fix(phase0): CUTLASS native/fallback via GateContract in gonogo; real…
DeanTMaxim Jul 24, 2026
2a1a3a8
fix(phase0): run-context-v2 wired into manifest; measurement role pre…
DeanTMaxim Jul 24, 2026
37697f5
feat(phase0): facts-only closeout + workspace-root-relative doc refer…
DeanTMaxim Jul 24, 2026
d12f664
feat(phase0): self-validating derived status (Git tree X) + review_su…
DeanTMaxim Jul 24, 2026
8c1995a
chore(phase0): evidence-integrity v3 artifacts + closeout (subject X)
DeanTMaxim Jul 24, 2026
7238b80
chore(phase0): review subject handoff (subject=X, non-self-referencing)
DeanTMaxim Jul 24, 2026
492553d
fix(phase0): update planar route verdict assertion to UNKNOWN (v2 gro…
DeanTMaxim Jul 24, 2026
4791632
fix(phase0): rebuild review_subject with correct hashes from Git tree…
DeanTMaxim Jul 24, 2026
3f4a04c
fix(phase0): run_context dirty_worktree excludes untracked scratch (t…
DeanTMaxim Jul 25, 2026
8d211c5
chore(phase0): clean rerun artifacts (run_context first -> dirty=Fals…
DeanTMaxim Jul 25, 2026
e1c1d0e
chore(phase0): review subject handoff (subject=X'=8d211c53, non-self-…
DeanTMaxim Jul 25, 2026
7a54d07
chore(phase0): remove stale review_subject.json from X (B-5 non-self-…
DeanTMaxim Jul 25, 2026
ef4cf4b
chore(phase0): review subject handoff (subject=X''=7a54d07f, non-self…
DeanTMaxim Jul 25, 2026
570d956
fix(phase0): grouped PASS requires recognized probe_source; cutlass_f…
DeanTMaxim Jul 25, 2026
ff6b05e
fix(phase0): apply_policy rejects NaN/negative metrics (F2); derived_…
DeanTMaxim Jul 25, 2026
891c0f4
fix(phase0): cutlass readers require compiles is True (no compile_sta…
DeanTMaxim Jul 25, 2026
76c7d77
fix(phase0): region case_binding verifiable via c2_judgment.binding_o…
DeanTMaxim Jul 25, 2026
176cb23
fix(phase0): validate_review_subject verifies manifest input chain in…
DeanTMaxim Jul 25, 2026
fc35d75
chore(phase0): F7 pre-rerun - manifest input filter (drop c1_xla_dump…
DeanTMaxim Jul 25, 2026
9c27636
chore(phase0): F7 clean re-commit - C1 evidence + regenerated artifac…
DeanTMaxim Jul 25, 2026
bdef8bf
chore(phase0): review subject handoff (subject=X''', non-self-referen…
DeanTMaxim Jul 25, 2026
e849b52
fix(phase0): F8 - bind test_report to rs hash; verify manifest input …
DeanTMaxim Jul 25, 2026
bc6294a
chore(phase0): F8 clean rerun artifacts + remove stale review_subject…
DeanTMaxim Jul 25, 2026
07350b0
chore(phase0): review subject handoff (subject=X''''=bc6294a7, non-se…
DeanTMaxim Jul 25, 2026
41b892b
feat(phase0): full-anchor direct recompute + materialized oracle corr…
DeanTMaxim Jul 25, 2026
02e5322
fix(phase0): G1 harden NaN handling in full-anchor correctness + P/T-…
DeanTMaxim Jul 25, 2026
e0f5bcf
feat(phase0): full-anchor MEASURED resources/peak/latency + verdict (…
DeanTMaxim Jul 25, 2026
4d5847c
fix(phase0): G2 stage region_prototype CSVs regenerated by run() (rev…
DeanTMaxim Jul 25, 2026
b7d944e
fix(phase0): G2 c2.py reads new runtime-allocator-peak fields; recomp…
DeanTMaxim Jul 25, 2026
dd1576c
feat(phase0): producer-tiled streaming full-anchor kernel + tile search
DeanTMaxim Jul 25, 2026
2f8cac9
feat(phase0): G3 tile-search bench data (producer-tiled configs; best…
DeanTMaxim Jul 25, 2026
4912b5a
feat(phase0): persistent full-anchor kernel + tile search
DeanTMaxim Jul 25, 2026
976c789
feat(phase0): full-anchor numerical re-measure (region_fused + cutlas…
DeanTMaxim Jul 25, 2026
e38238f
chore(phase0): GPU phase clean rerun + rereview_closeout (generator_c…
DeanTMaxim Jul 25, 2026
2d02ed5
fix(phase0): P1 fail-open fixes - region gate reads runtime evidence;…
DeanTMaxim Jul 26, 2026
b97b63c
docs(phase0): region_fused dual-gate accuracy policy v2 (reviewer B P…
DeanTMaxim Jul 26, 2026
cb3a3e6
docs(phase0): region_fused dual-gate accuracy policy v3 (B POLICY_NOT…
DeanTMaxim Jul 26, 2026
b131c6a
feat(phase0): dual-gate accuracy policy v3 implementation - compute_m…
DeanTMaxim Jul 26, 2026
bdea015
fix(phase0): update gonogo_test fixtures + region_prototype.json for …
DeanTMaxim Jul 26, 2026
2a89f59
fix(phase0): regenerate producer chain for v3 dual-gate fields + upda…
DeanTMaxim Jul 26, 2026
4b6b5c1
docs(phase0): region_fused dual-gate accuracy policy v4 (B POLICY_NOT…
DeanTMaxim Jul 26, 2026
39fb54d
fix(phase0): P1#4 wire collect_region_fused to dual-gate + P1#5 c2 ne…
DeanTMaxim Jul 26, 2026
58220a5
chore(phase0): regenerate producer chain for v4 summary schema (indep…
DeanTMaxim Jul 26, 2026
30a0048
fix(phase0): freeze region-fused accuracy policy v5
DeanTMaxim Jul 26, 2026
09e69b9
feat(phase0): policy_freeze_manifest.json for REGION_FUSED_FULL_ANCHO…
DeanTMaxim Jul 26, 2026
03b8b45
results(phase0): record region-fused v5 18-cell GPU accuracy failure
DeanTMaxim Jul 26, 2026
e455a91
docs(phase0): add research report and reviewer briefing
DeanTMaxim Jul 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
* text=auto

# Phase 0 reproducibility artifacts: force canonical LF everywhere under
# results/phase0 so the raw-byte sha256 hashes recorded in manifest.json inputs,
# the numerical_validation case_binding, and the c2_checkpoint_manifest
# artifact_hashes stay stable across EVERY checkout (Task 12). Without this, a
# fresh Windows checkout smudges text to CRLF and the re-hash mismatches ->
# NUMERICAL/C2 demoted to UNKNOWN. gitattributes has NO {a,b} brace expansion ->
# one line per extension. (** matches zero-or-more dirs -> top-level + subdirs.)
results/phase0/**/*.csv eol=lf
results/phase0/**/*.json eol=lf
results/phase0/**/*.hlo eol=lf
results/phase0/**/*.txt eol=lf
results/phase0/**/*.md eol=lf
# Phase 0 producer scripts: pin LF so OneDrive sync on Windows never smudges
# the working copy to CRLF (which would cause content-less M phantoms after a
# suite run). The csv/json/hlo/txt/md patterns above cover the artifacts; this
# covers the .py generators that Black and the test suite read/write.
results/_phase0/*.py eol=lf

# F7: raw XLA/compiler dump evidence is exempt from blank-at-eof style
# check (trailing newline is part of the captured output, not a style error).
results/phase0/c1_optimized_hlo/**/*.hlo whitespace=-blank-at-eof
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

### Added

- add unified ContractionAlgebra interface (`set_contraction_algebra(...)` + boundary
encode/decode) with tropical (max-plus) and complex<bfloat16> pair-algebra
reference applications.

- Add efficient `expectation_pss` method for `U1Circuit`.

- Support MVP mode for timeevol methods.
Expand Down
210 changes: 210 additions & 0 deletions applications/bcomplex32_algebra.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
"""complex<bfloat16> pair-algebra — a reference APPLICATION of ContractionAlgebra.

Pair repr: complex tensor split into PairTensor(re, im) of bf16. Contraction = 4 real
bf16 matmuls (4M). Activated via ``cons.set_contraction_algebra(ComplexPairAlgebra())`` or
the ``bcomplex32()`` CM. PairTensor keeps the pair axis off tn.Node (dodges the axis==edge wall).
"""

from typing import Any, Dict, Iterator, List, Tuple
import contextlib

import numpy as np

import tensorcircuit.cons as cons
from tensorcircuit.contraction_algebra import (
ContractionAlgebra,
PairTensor,
Representation,
)

Tensor = Any
Backend = Any


def _bf16_dtype(be: Backend) -> Any:
"""Backend-native bf16 dtype. numpy needs ml_dtypes; GPU backends use native bf16
(their cast rejects ml_dtypes.bfloat16 — see pytorch_backend.cast)."""
name = getattr(be, "name", None)
if name == "numpy":
import ml_dtypes

return ml_dtypes.bfloat16
if name == "jax":
import jax.numpy as jnp

return jnp.bfloat16
if name == "pytorch":
import torch

return torch.bfloat16
if name == "tensorflow":
import tensorflow as tf

return tf.bfloat16
if name == "cupy":
# cupy has no ``cupy.bfloat16``; it accepts ml_dtypes.bfloat16 as a native
# dtype (astype + cuBLAS bf16 GEMM both work). Same resolution as numpy.
import ml_dtypes

return ml_dtypes.bfloat16
raise NotImplementedError(f"bf16 dtype unknown for backend {name!r}")


def _complex_to_pair(be: Backend, t: Tensor) -> PairTensor:
"""complex tensor -> PairTensor(re, im) of bf16."""
bf = _bf16_dtype(be)
re = be.cast(be.real(t), bf)
im = be.cast(be.imag(t), bf)
return PairTensor(re, im)


def _pair_to_complex(be: Backend, pair: PairTensor) -> Tensor:
"""PairTensor of bf16 -> complex tensor (recombine; no copy risk via cast)."""
re, im = pair.unpack()
re = be.cast(re, cons.rdtypestr)
im = be.cast(im, cons.rdtypestr)
# be.i() returns 1j as a backend tensor. tensorflow's eager mode cannot build a
# complex tensor from a Python ``1j`` applied to a float tensor (TypeError:
# "Cannot convert 1j to EagerTensor of dtype float"), unlike numpy/jax/torch/cupy.
# Found during L3 GPU testing on TF.
return be.cast(re, cons.dtypestr) + be.i(cons.dtypestr) * be.cast(im, cons.dtypestr)


def _pair_tensordot(be: Backend, a: Tensor, b: Tensor, axes: Any) -> Tensor:
"""Complex tensordot = 4 real bf16 tensordots (4M). Uses be.tensordot (never patched)."""
ar, ai = PairTensor.unpack_pair(a)
br, bi = PairTensor.unpack_pair(b)
cr = be.tensordot(ar, br, axes) - be.tensordot(ai, bi, axes)
ci = be.tensordot(ar, bi, axes) + be.tensordot(ai, br, axes)
return PairTensor.pack_result(be, cr, ci, not isinstance(a, PairTensor))


# Strategy note: on numpy, bf16 single-operand einsum manually decomposes into
# diagonal → sum → transpose (staying in bf16 end-to-end) because numpy's
# ``np.einsum`` rejects bfloat16 dtypes. GPU backends (jax/torch/tf/cupy) accept
# bf16 natively and take ``be.einsum`` directly — see ``_einsum_single_operand_half``.
# This is different from the tropical algebra's ``_tropical_einsum`` single-operand
# path, which delegates to ``be.einsum`` for repeated-index resolution — the tropical
# backend (float64) has no such dtype restriction. Both produce equivalent results
# under their respective semirings, but the implementation strategy is dictated by
# dtype constraints rather than algebraic differences.
def _einsum_single_operand_half_numpy(
be: Backend, x: Tensor, lhs: str, out_subs: str
) -> Tensor:
"""numpy-only fallback: decompose 1-operand einsum into diagonal + sum + transpose
because numpy's einsum rejects bf16. Stays bf16 end-to-end."""
x_subs = list(lhs)
while True:
dup = next((c for c in set(x_subs) if x_subs.count(c) > 1), None)
if dup is None:
break
pos = [i for i, c in enumerate(x_subs) if c == dup]
x = np.diagonal(x, axis1=pos[0], axis2=pos[-1])
x_subs = [c for i, c in enumerate(x_subs) if i != pos[-1]] + [dup]
out_set = set(out_subs)
sum_indices = [c for c in x_subs if c not in out_set]
if sum_indices:
x = be.sum(x, axis=tuple(x_subs.index(c) for c in sum_indices))
x_subs = [c for c in x_subs if c in out_set]
if x_subs != list(out_subs):
perm = tuple(x_subs.index(c) for c in out_subs)
x = be.transpose(x, perm)
return x


def _einsum_single_operand_half(
be: Backend, x: Tensor, lhs: str, out_subs: str
) -> Tensor:
"""Apply a 1-operand einsum to one bf16 half. GPU backends (jax/torch/tf/cupy)
take native ``be.einsum`` (XLA/cuBLAS-fused, accepts bf16). numpy rejects bf16,
so it falls back to the manual decomposition. ``np.diagonal`` never runs on GPU."""
name = getattr(be, "name", None)
if name == "numpy":
return _einsum_single_operand_half_numpy(be, x, lhs, out_subs)
if name == "cupy":
# tensornetwork's cupy backend has not implemented einsum (NotImplementedError),
# but cupy.einsum itself exists and runs bf16 on cuBLAS. Call it directly.
import cupy

return cupy.einsum(f"{lhs}->{out_subs}", x)
return be.einsum(f"{lhs}->{out_subs}", x)


def _pair_einsum(be: Backend, eq: str, *operands: Tensor) -> PairTensor:
"""Complex einsum = 4 real bf16 einsums (4M for 2 operands, 2 for 1)."""
if len(operands) == 1:
a = operands[0]
if "->" not in eq:
return a
lhs, out_subs = eq.split("->")
ar, ai = PairTensor.unpack_pair(a)
return PairTensor(
_einsum_single_operand_half(be, ar, lhs, out_subs),
_einsum_single_operand_half(be, ai, lhs, out_subs),
)

a, b = operands
ar, ai = PairTensor.unpack_pair(a)
br, bi = PairTensor.unpack_pair(b)

if "->" not in eq:
raise ValueError(
f"implicit-mode einsum {eq!r} not supported for bf16; use explicit '->'"
)
lhs, out_subs = eq.split("->")
a_subs, b_subs = lhs.split(",")

a_set: set[str] = set(a_subs)
b_set: set[str] = set(b_subs)
contracted = [c for c in a_subs if c in b_set]

a_free = [c for c in a_subs if c not in b_set]
b_free = [c for c in b_subs if c not in a_set]
out_order = list(out_subs)

def _contract(x: Tensor, y: Tensor) -> Tensor:
if contracted:
a_axes = [a_subs.index(c) for c in contracted]
b_axes = [b_subs.index(c) for c in contracted]
result = be.tensordot(x, y, axes=(a_axes, b_axes))
else:
result = be.tensordot(x, y, axes=0)
free_order = a_free + b_free
if free_order != out_order:
perm = [free_order.index(c) for c in out_order]
result = be.transpose(result, perm)
return result

cr = _contract(ar, br) - _contract(ai, bi)
ci = _contract(ar, bi) + _contract(ai, br)
return PairTensor.pack_result(be, cr, ci, not isinstance(a, PairTensor))


class PairBf16Representation(Representation):
name = "pair_bf16"

def encode(self, be: Backend, tensors: List[Tensor]) -> List[Tensor]:
return [_complex_to_pair(be, t) for t in tensors]

def decode(self, be: Backend, tensor: Tensor) -> Tuple[Tensor, Dict[str, Tensor]]:
return _pair_to_complex(be, tensor), {}


class ComplexPairAlgebra(ContractionAlgebra):
name = "bcomplex32_pair"
representation = PairBf16Representation()

def get_contractor_kwargs(self) -> Dict[str, Any]:
return {"prefer_einsum": True}

def tensordot(self, be: Backend, a: Tensor, b: Tensor, axes: Any) -> Tensor:
return _pair_tensordot(be, a, b, axes)

def einsum(self, be: Backend, eq: str, *operands: Tensor) -> Tensor:
return _pair_einsum(be, eq, *operands)


@contextlib.contextmanager
def bcomplex32() -> Iterator[None]:
with cons.runtime_contraction_algebra(ComplexPairAlgebra()):
yield
71 changes: 71 additions & 0 deletions applications/benchmarks/aggregate_results.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"""Aggregate bench_bf16_gpu CSV rows into a markdown report.

For each (backend, circuit, n): report bf16 vs complex64 peak-mem ratio, speedup,
and bf16 accuracy. For micro rows: report wall-time per backend.
"""

import argparse
import csv
from collections import defaultdict


def _gib(b: float) -> str:
return f"{b / (1024 ** 3):.2f} GiB" if b else "-"


def aggregate(csv_path: str) -> str:

Check failure on line 16 in applications/benchmarks/aggregate_results.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=tensorcircuit_tensorcircuit-ng&issues=AZ-fw8dh1eeMvlV2rpbK&open=AZ-fw8dh1eeMvlV2rpbK&pullRequest=129
e2e = defaultdict(dict) # (backend, circuit, n) -> {dtype: row}
micro = []
with open(csv_path, newline="") as f:
for r in csv.DictReader(f):
if r.get("mode") == "micro":
micro.append(r)
else:
e2e[(r["backend"], r["circuit"], int(r["n"]))][r["dtype"]] = r

lines = ["# bf16 GPU benchmark results", ""]
lines += ["## End-to-end (bf16 vs complex64)", ""]
lines += [
"| backend | circuit | n | c64 mem | bf16 mem | mem ratio | c64 s | bf16 s | speedup | bf16 max-abs-err |"
]
lines += ["|---|---|---|---|---|---|---|---|---|---|"]
for (backend, circuit, n), d in sorted(e2e.items()):
c64, bf = d.get("complex64"), d.get("bf16")
if not (c64 and bf):
continue
c64_mem = int(c64["peak_smi_bytes"] or 0)
bf_mem = int(bf["peak_smi_bytes"] or 0)
ratio = f"{c64_mem / bf_mem:.2f}x" if bf_mem else "-"
c64_s = float(c64["wall_s"])
bf_s = float(bf["wall_s"])
speedup = f"{c64_s / bf_s:.2f}x" if bf_s else "-"
err = bf.get("max_abs_err") or "-"
lines.append(
f"| {backend} | {circuit} | {n} | {_gib(c64_mem)} | {_gib(bf_mem)} | {ratio} "
f"| {c64_s:.2f} | {bf_s:.2f} | {speedup} | {err} |"
)

if micro:
lines += ["", "## Micro (4M bf16 GEMM, single matmul)", ""]
lines += ["| backend | m | wall s |", "|---|---|---|"]
for r in sorted(micro, key=lambda x: (x["backend"], int(x["n"]))):
lines.append(f"| {r['backend']} | {r['n']} | {float(r['wall_s']):.3f} |")

return "\n".join(lines) + "\n"


def main() -> None:
p = argparse.ArgumentParser()
p.add_argument("csv")
p.add_argument("-o", "--out", default=None)
args = p.parse_args()
md = aggregate(args.csv)
if args.out:
with open(args.out, "w") as f:
f.write(md)
else:
print(md)


if __name__ == "__main__":
main()
Loading