Skip to content

Roll out complex contract validation#7

Merged
shinaoka merged 6 commits into
mainfrom
codex/add-expm1-origin-main
Apr 18, 2026
Merged

Roll out complex contract validation#7
shinaoka merged 6 commits into
mainfrom
codex/add-expm1-origin-main

Conversation

@shinaoka

Copy link
Copy Markdown
Member

Sync the codex/add-expm1-origin-main branch to fork main.

Mirrors upstream PR tracel-ai#1300. See that PR for full description.

Commits included beyond current fork main

Fork main currently only has the PR #6 merge commit beyond the branch base; this sync is linearly mergeable with no conflicts.

syl20bnr and others added 6 commits April 17, 2026 19:00
These were iteration planning documents written for implementation
sessions and are not intended as user-facing design references.
The PR description covers the contract and rollout summary.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- cubecl-cpp Conj: dispatch on Elem enum instead of stringified form
  and make the fallback unreachable so non-complex types cannot emit
  make_cuDoubleComplex by accident.
- cubecl-cpp format_const: unreachable fallback for Complex values
  with non-complex element types (same rationale).
- cubecl-cpp IsNan/IsInf: drop the complex branches. These ops are
  already rejected by the complex contract validation, and the
  lowering path must be unreachable for complex types to match the
  advertised surface.
- cubecl-cpu Complex constants: switch from unimplemented! to
  unreachable! to make the validation-first invariant explicit.
- cubecl-core validation: document why scope.properties may be unset
  and how test authors should handle it.
- cubecl-opt constant_prop: Abs on Complex constants now returns
  None instead of hitting unreachable!, guarding future const-eval
  passes that might run before validation.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- sqrt on the negative real axis exercises the branch cut handling
  in cubecl_sqrt (y==0 short-circuit).
- tanh with moderately large |re| exercises the cosh(2x)+cos(2y)
  denominator before it overflows, documenting that saturation holds
  within the typical ML/signal-processing range.
- powf(-1, 0.5) flows through the log negative-real branch and the
  exp(i*pi/2) rotation, pinning the expected ~i result.

Each case runs for both cf32 and cf64 through the existing
testgen_complex_math! dispatcher.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@shinaoka
shinaoka merged commit f73a00d into main Apr 18, 2026
@shinaoka
shinaoka deleted the codex/add-expm1-origin-main branch April 18, 2026 11:21
@shinaoka
shinaoka restored the codex/add-expm1-origin-main branch April 18, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants