Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
alxmrs
force-pushed
the
m2/fold-statistics
branch
from
October 28, 2026 22:39
278b11c to
1b50e59
Compare
alxmrs
force-pushed
the
m2/memory-goal
branch
from
October 28, 2026 22:39
059f844 to
4d34d2e
Compare
alxmrs
force-pushed
the
m2/fold-statistics
branch
from
October 28, 2026 23:17
1b50e59 to
a6982bc
Compare
alxmrs
force-pushed
the
m2/memory-goal
branch
from
October 28, 2026 23:17
4d34d2e to
394415b
Compare
For models trained in SQL, such as the GPT in xarray-sql's ML demos, memory limits size as much as time does (#79). Principle 9 says how einfold's operators keep to the host's memory: they reserve what they read and what their kernels allocate from the host's pool, and run the host's own plan, which spills, where the pool can't give it. Section 10.2 says how EinFoldExec does this, and what comes next: streaming the positional fold's larger operand in row blocks, which needs each dimension's extent before reading. Section 15's benchmarks report peak memory next to time, and section 14 opens dense chains of folds. The lessons record what running einfold under the GPT taught. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M96xSez6PZwTmfaGh2eJgS
alxmrs
force-pushed
the
m2/memory-goal
branch
from
October 29, 2026 02:31
394415b to
70cdb29
Compare
alxmrs
force-pushed
the
m2/fold-statistics
branch
from
October 29, 2026 02:31
a6982bc to
47036ba
Compare
alxmrs
added a commit
that referenced
this pull request
Oct 29, 2026
🪭 Claude (einfold): This is #91's commit, moved onto `main` so that it can merge ahead of the stack it was part of. #91 is closed in its favor. Answers #79's second ask, and opens its third, as design v18. **The goal.** For models trained in SQL, such as the GPT in the ML demos of xarray-sql, an XQL Systems project for querying xarray datasets with SQL (its `benchmarks/ml/02_nanogpt.py`), memory limits model size as much as time does. Principle 9, "never more memory than the host", says how einfold's operators keep to it. They reserve what they read, and what their kernels allocate, from the host's memory pool, before allocating it. Where the pool can't give it, they run the host's own plan, whose operators can spill to disk. Every benchmark measures peak memory next to time. **What changes in the design.** - **Section 4** adds principle 9. - **Section 10.2** gains a bullet on memory: what `EinFoldExec` does (#89, #90), and what comes next. The positional fold should stream its larger operand in row blocks, so that its peak stays below the host's even without a pool to enforce it. That needs each dimension's extent before reading, and #80's dictionaries answer it: the dictionary's length, when it is the whole axis. Exact statistics or a first pass over the keys also give it. - **Section 15** reports peak memory next to time, which `python/benchmarks/memory.py` (#85) does for the Python extension. - **Section 14** opens #79's third ask, dense chains of folds: handing the dense form from one einfold operator to the next, so the joined intermediates never exist as rows. It lists what is open: the form handed on, how a host operator between two folds reads it, and when a chain is worth keeping dense. - **`lessons.md`** records what running einfold under the GPT taught (#77, #79, #81): - profile through the real bridge; - report statistics, and cache them; - plan a fallback only if it runs; - batch dimensions are common. **Where the stack stands on #79**, at its size (128 channels, context 64, batch 12, one layer), through datafusion-python on an Intel i7-8700: | | DataFusion alone | einfold, before #86 | einfold, with #86–#90 | |---|---:|---:|---:| | the loss | 108 s, 8.9 GB peak | 42 s, 11.8 GB | 13.6 s, 6.9 GB | | the gradients | 36.5 s, 9.8 GB | | 4.2 s, 1.8 GB | The peak is above the loaded tables. So the GPT already keeps to the principle at this size. Streaming in row blocks would make that hold by construction, not only under a pool. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01M96xSez6PZwTmfaGh2eJgS <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Documentation** * Updated the design guidance to cover host-managed memory use, fallback behavior, peak-memory benchmarks, and current limitations around whole-input processing. * Added lessons on measuring end-to-end performance, reporting row-count statistics, delaying fallback planning until execution, and supporting shared batch dimensions. * Clarified that success benchmarks compare speed while keeping memory use within the host’s plan. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
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.
🪭 Claude (einfold)
Answers #79's second ask, and opens its third, as design v18.
The goal. For models trained in SQL, such as the GPT in xarray-sql's ML demos (xarray-sql's
benchmarks/ml/02_nanogpt.py), memory limits model size as much as time does. Principle 9, "never more memory than the host", says how einfold's operators keep to it. They reserve what they read, and what their kernels allocate, from the host's memory pool, before allocating it. Where the pool can't give it, they run the host's own plan, whose operators can spill to disk. Every benchmark measures peak memory next to time.What changes in the design.
EinFoldExecdoes (Run the host's plan where memory runs short, as its spilling operators would #89, Estimate EinFoldExec's rows, so that the plan above it is planned as the host's #90), and what comes next. The positional fold should stream its larger operand in row blocks, so that its peak stays below the host's even without a pool to enforce it. That needs each dimension's extent before reading, and Dictionary-encoded dimensions: the dictionary is the axis, so its keys are the indices #80's dictionaries answer it: the dictionary's length, when it is the whole axis. Exact statistics or a first pass over the keys also give it.python/benchmarks/memory.py(Measure time and peak memory, einfold off and on, from Python #85) does for the Python extension.lessons.mdrecords what running einfold under the GPT taught (A logical plan deeper than 100 protobuf messages fails to decode, so einfold fails queries DataFusion answers (the GPT's loss) #77, Peak memory as a goal: measure it einfold on against off, and keep contractions from holding the joined rows #79, The GPT's loss is 3.3× slower with einfold on (planning 6.5 s against 2.4 s), and a training step 4.7× #81):Where the stack stands on #79, at its size (128 channels, context 64, batch 12, one layer), through datafusion-python on an Intel i7-8700:
The peak is above the loaded tables. So the GPT already keeps to the principle at this size. Streaming in row blocks would make that hold by construction, not only under a pool.
🤖 Generated with Claude Code
https://claude.ai/code/session_01M96xSez6PZwTmfaGh2eJgS