Skip to content

Feat: add per-function @compiled(fastmath=True) opt-in (#332) - #360

Merged
b-re-w merged 1 commit into
developfrom
feat/typedpython-fastmath
Oct 31, 2026
Merged

b-re-w merged 1 commit into
developfrom
feat/typedpython-fastmath

Conversation

@b-re-w

@b-re-w b-re-w commented Oct 31, 2026

Copy link
Copy Markdown
Member

Closes #332

Summary

  • Add per-function @compiled(fastmath=True) opt-in (off by default, owner decision Decision needed: opt-in fastmath for TypedPython #153) in typedpython/frontend.py (_compiled_decorator_options, _targets), typedpython/ir.py (Function.fastmath), and typedpython/cgen.py (TP_FASTMATH_BEGIN / TP_FASTMATH_END around the marked function's implementation only, and prevent inlining a fastmath callee into a non-fastmath caller).
  • Document in docs/SPEC.md (N-8) that @compiled(fastmath=True) is explicitly NOT CPython-identical and that default floating-point flags (-ffp-contract=off -fno-fast-math, /fp:precise) stay exact.
  • Pin default FP flags and per-function fastmath behaviour in test_frontend.py and test_pipeline.py.

Verification

  • pytest src/test/python/test_frontend.py src/test/python/test_pipeline.py src/test/python/test_builtin_compiled.py src/test/python/test_cbuild_msvc.py -q: 130 passed, 3 skipped

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.

1 participant