Repository navigation
Retain compact arrays across numerical SQL programs - #303
Draft
cromwellian wants to merge 5 commits into
Draft
cromwellian wants to merge 5 commits into
cromwellian wants to merge 5 commits into
Conversation
Support prepared SQL gradients, arithmetic chunk-grid counts and direct Arrow registration. Preserve Context metadata through extension installation, expose target partitions and guard physical reuse against value-dependent filters. Co-Authored-By: GPT-6 <noreply@openai.com>
Materialize shared reachable CTEs once, reuse stage programs with fresh physical state, and retain ddx differentiation of original views. Add optional session-local float64 CPU and float32 MLX kernel execution with SQL validation and fallback, using the separately maintained EinFold feature build. Co-Authored-By: GPT-6 <noreply@openai.com>
Build the upstream-compatible feature commit from the contribution fork. Co-Authored-By: GPT-6 <noreply@openai.com>
Lower supported DataFusion and ddx stages through EinFold compact programs, importing live inputs on each ordinary query and expanding coordinates only at Arrow snapshot boundaries. Bound computed intermediates, preserve row/NULL masks and retain conservative SQL fallback. Co-Authored-By: GPT-6 <noreply@openai.com>
Keep the compact executor build reproducible without copying native or array-program sources into this repository. Co-Authored-By: GPT-6 <noreply@openai.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 2, 2026
This was referenced Nov 4, 2026
Member
|
🌀 Claude: Thank you. Compact arrays across stages are the biggest win in the stack: 164 → 2.4 s per warm update on the 123.6M-parameter model, with 40.0 → 17.9 GiB of memory, all checked against JAX. The care taken over masks, bag semantics and declining before anything a caller can see changes shows. Concerns
I'd hold this until #307 and einfold#157's design question settle. |
alxmrs
added a commit
that referenced
this pull request
Nov 15, 2026
🛠️ Codex Repeated training calls can prepare a SQL grad/VJP/JVP statement once with `Context.prepare` and write new Dataset values into existing input buffers. Fine-chunk registration counts partitions arithmetically and registers Arrow batches directly; extension handles retain Dataset metadata and invalidation state. `Context(threads=...)` exposes target parallel partitions. This independently useful change starts the NanoGPT optimization stack; shared/compact execution, resident training and the evidence report follow separately. Apple M5 Ultra measurements: one-cell-chunk registration 31.372→0.405 ms (77.44× for that specific case), update-and-sum 2.769→1.027 ms (2.70×), repeated-CTE preparation 1.709→1.307 ms (1.31×). Tiny-model warm time improved 1.11×, but its five-step total regressed due to setup; this does not claim universally faster startup. Validation: 47 focused AD/preparation tests passed, covering current inputs, changing join-key ranges, old-result snapshots, coordinate rejection and shared Context invalidation. The complete downstream stack passed 714 non-integration tests. Changed Python files pass Ruff. Review order: this PR → #302 (shared kernels) → #303 (compact arrays) → #305 (resident training). #304 contains the separate consolidated report and evidence. Closes #294 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Prepared queries now support gradient, vector-Jacobian product, and Jacobian-vector product operations, including repeated execution after registered table data is updated or re-registered. * Added an option to configure the number of query threads. * Added support for creating contexts with extensions. * **Bug Fixes** * Improved prepared-query results when join-key values change and when datasets are registered in smaller chunks. * Improved in-memory partitioning for datasets. * **Documentation** * Clarified that prepared queries retain programs for repeated execution. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Ray <cromwellian@Rays-Mac-Studio.local> Co-authored-by: GPT-6 <noreply@openai.com> Co-authored-by: Alex Merose <al@merose.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠️ Codex
Add
DenseExecutorto retain compact numerical arrays across shared DataFusion/ddx SQL stages through EinFold's optional array-program module. Axis domains, row-presence and NULL masks remain explicit; joins become gathers/contractions and UNION reductions accumulate gradients. Ordinary calls import current inputs afresh and produce independent Arrow snapshots. Bounded intermediates and strict refusal preserve original SQL fallback before caller-visible mutation.Depends on shared-kernel execution #302 and EinFold compact programs. Incremental review: cromwellian/xarray-sql@codex/shared-kernel-execution...codex/compact-sql-execution . The upstream fork PR's default diff includes predecessors until they merge.
Measured five-step 123.6M/context-16 training improved shared CPU 164.034→4.037 s (40.6×) and shared GPU 163.646→2.434 s (67.2×) per warm loss/update pair. GPU sampled RSS fell 40.0→17.91 GiB on that case. These use batch 1, tanh GELU, SGD and a padded 50,257-class vocabulary; they are separate from the real-character AdamW recipe. All losses/weight updates were checked against JAX outside the API timer. The complete performance/evidence report records first-use and full-context results and failed trials separately.
Full-stack validation: 714 non-integration tests passed on rebuilt ddx/EinFold wheels. Ordinary state still crosses the Arrow boundary; owned GPU state and whole-step compilation follow in the resident-training PR. No model/framework backward pass replaces ddx.