Epic: JAX-native modules (static fields, no Python control flow on traced values, cached wavenumbers)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- jupyter-notebook, python
- Domain
- backend, performance, tooling
Research direction
The issue points to MixedBCHelmholtzSolver2D in fourier/solvers.py:2386 as a pattern to copy, and mentions gaussx using eqx.field(static=True). Start by examining those modules to understand the static field pattern. Then, identify the 35 equinox.Module subclasses that need refactoring, likely in the spectraldiffx codebase. Look for integer sizes, strings, and enums as pytree leaves. The goal is to make all modules JAX-native, allowing jax.jit and jax.vmap without errors. Check for Python if statements on traced values and replace with eqx.error_if. Finally, implement caching for wavenumber grids and dealias masks at construction.
Written by the indexing model from the issue text.
Description
Scope
Make every grid, operator, filter and solver in the package a well-behaved JAX pytree so that it can be passed as an argument to jax.jit / jax.vmap and used with traced parameters (alpha, nu, dx, boundary values) without TracerBoolConversionError or ConcretizationTypeError.
Today: 35 of the 43 equinox.Module subclasses hold integer sizes and strings (N, Nx, dealias, node_type) as pytree leaves, so jax.jit(f)(module, u) fails on the string leaf or traces N; only eqx.filter_jit works. About ten if statements on possibly-traced scalars break jit with traced parameters. Wavenumber grids and dealias masks are rebuilt on every property access, which is constant-folded under jit but costs 2.6–4.7x in eager mode.
MixedBCHelmholtzSolver2D (fourier/solvers.py:2386) already does this correctly and is the pattern to copy. gaussx uses eqx.field(static=True) throughout and is the house style to match.
Child issues (in suggested order)
- #102 refactor:
eqx.field(static=True)on sizes, strings and enums in every module — high; prerequisite for #112/#114 - #103 fix: Python
ifon possibly-traced values in ~10 places →eqx.error_if— medium; Chebyshev sites after #79 - #104 perf(grid): cache wavenumber grids and dealias masks at construction — medium
- #105 docs: static-argument requirements,
eqx.filter_jittoday, λ=0 gradient discontinuity — low
Related
- #80 (correctness), #81 (spherical), #83 (Fourier consolidation), #84 (gaussx integration), #85 (hygiene).
- Dominant language
- Python
- Stars
- 2
- Forks
- 0
- Avg merge
- 8h 13m
- Merged PRs (30d)
- 8
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jejjohnson/spectraldiffx
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
jejjohnson/spectraldiffx#172 ·
-
epic
Difficulty 1/5 Under an hour Newbie friendliness 62/100
jejjohnson/spectraldiffx#167 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
jejjohnson/spectraldiffx#113 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
jejjohnson/spectraldiffx#105 ·
-
dependencies
Difficulty 4/5 3-5 days Newbie friendliness 45/100
jejjohnson/spectraldiffx#181 ·
All issues in jejjohnson/spectraldiffx
Similar issues
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionErrorPossibly taken @jejjohnson claimed this today. Opentype:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jejjohnson/integrix#144 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
finos/ai-governance-framework#459 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
freelawproject/litigant-portal#1307 ·
Maintainers usually reply within 2 days
-
type/bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
h2oai/h2o-llmstudio#1163 ·
Maintainers usually reply within 1 day