FEAT: Python/Sollya driver that used for generates LUT/Constants#5
Conversation
There was a problem hiding this comment.
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.
677b8ab to
17b3f33
Compare
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
0a4e02b to
55cdd9c
Compare
Match SVML rounding DAG in the reduction LUT and use exact-product constants for the non-FMA f64 path.
55cdd9c to
7f95e81
Compare
7f95e81 to
f9df5ab
Compare
|
The approx LUTs of large arguments weren't accurate. They have been fixed, and locally bit-exact tested against Intel |
Argument reduction & tables:
reduction.h.sol)constants.h.sol)approx.h.sol)kpi16-inl.h.sol)Sollya-driven codegen pipeline:
tools/sollyawith shared helpersspin sollya [-f](via.spin/cmds.py) to (re)generate headerspyproject.tomlmatters for spin