Skip to content

Refactor codegen and JIT frontend modules

This issue lays out an ongoing plan to refactor the layout and API exposure of the code generation and JIT frontend.

Codegen Frontend: pystencils.codegen Module

All code generation-related user-facing APIs shall be consolidated into a new pystencils.codegen module. This includes target, config, kernelcreation, kernelfunction, and symbol properties.

JIT Module

All JIT-related functionality shall be consolidated in the new pystencils.jit module. This module shall in the future be home to a newly implemented, object-oriented JIT compiler for CPU targets.

Code Generator Configuration

The code generator configuration system shall be refactored along the same lines as in pystencils-sfg!2 (merged). The various options and option groups shall be cleaned up. All options shall be implemented using the Option descriptor, including proper validation. Incremental configuration shall become the standard, since it is more concise, more flexible, and requires fewer imports:

cfg = ps.make_config()
cfg.target = ps.Target.X86_AVX512
cfg.cpu.openmp.enable = True
cfg.cpu.vectorize = "auto"

This was previously not reliably possible since all validation took place in __post_init__, and options set incrementally at a later point were never validated.