Skip to content

FEAT: Python/Sollya driver that used for generates LUT/Constants#5

Open
seiko2plus wants to merge 1 commit into
numpy:mainfrom
seiko2plus:impl-sincos-sollya
Open

FEAT: Python/Sollya driver that used for generates LUT/Constants#5
seiko2plus wants to merge 1 commit into
numpy:mainfrom
seiko2plus:impl-sincos-sollya

Conversation

@seiko2plus

Copy link
Copy Markdown
Member

Argument reduction & tables:

  • Payne–Hanek tables via chunked 4/π per exponent range (reduction.h.sol)
  • π splits for FMA/non-FMA and float/double (constants.h.sol)
  • Compact 4-term (value + derivatives) LUTs (approx.h.sol)
  • Precomputed sin/cos(k·π/16) for quadrant handling (kpi16-inl.h.sol)

Sollya-driven codegen pipeline:

  • Tooling lives in tools/sollya with shared helpers
  • CLI: spin sollya [-f] (via .spin/cmds.py) to (re)generate headers
  • Project wiring: pyproject.toml matters for spin

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a Python/Sollya driver system for automatically generating lookup tables and mathematical constants used in trigonometric computations. The system enables precise generation of argument reduction tables, π splits for different architectures, compact lookup tables for trigonometric approximations, and precomputed sin/cos values.

Key changes include:

  • Implementation of a comprehensive Sollya utility library with floating-point type descriptors and code generation helpers
  • Python-based CLI tool for processing Sollya scripts with parallel execution and colored output
  • Integration with the project's build system through pyproject.toml and spin commands

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tools/sollya/core.sol Core Sollya utility library with type descriptors, bit manipulation, and code generation procedures
tools/sollya/main.py Python CLI driver for processing Sollya scripts with parallel execution and error handling
tools/sollya/init.py Package initialization exposing the main function
pyproject.toml Project configuration with spin command integration
npsr/trig/data/reduction.h.sol Sollya script generating Payne-Hanek reduction tables for trigonometric functions
npsr/trig/data/kpi16-inl.h.sol Script generating sin/cos lookup tables for k·π/16 values with packed low-precision parts
npsr/trig/data/data.h.sol Master header inclusion script for trigonometric data tables
npsr/trig/data/constants.h.sol Script generating π-related constants for Cody-Waite reduction in various precisions
npsr/trig/data/approx.h.sol Script generating 4-element lookup tables for fast trigonometric approximation
.spin/cmds.py Spin command integration for the sollya code generation tool
Comments suppressed due to low confidence (1)

tools/sollya/core.sol:1

  • Corrected spelling of 'Tuble' to 'Table'.
// Sollya utility functions for generating C++ header files with mathematical constants and lookup tables

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread tools/sollya/core.sol Outdated
Comment thread tools/sollya/core.sol Outdated
Comment thread npsr/trig/data/reduction.h.sol Outdated
Comment thread npsr/trig/data/reduction.h.sol Outdated
Comment thread npsr/trig/data/reduction.h.sol Outdated
@seiko2plus seiko2plus force-pushed the impl-sincos-sollya branch from 677b8ab to 17b3f33 Compare June 28, 2026 12:03
Argument reduction & tables:
- Payne–Hanek tables via chunked 4/π per exponent range (`reduction.h.sol`)
- π splits for FMA/non-FMA and float/double (`constants.h.sol`)
- Compact 4-term (value + derivatives) LUTs  (`approx.h.sol`)
- Precomputed sin/cos(k·π/16) for quadrant handling (`kpi16-inl.h.sol`)

Sollya-driven codegen pipeline:
- Tooling lives in `tools/sollya` with shared helpers
- CLI: `spin sollya [-f]` (via `.spin/cmds.py`) to (re)generate headers
- Project wiring: `pyproject.toml` matters for spin
@seiko2plus seiko2plus force-pushed the impl-sincos-sollya branch from 17b3f33 to e9da4dc Compare June 28, 2026 12:09
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