Skip to content

[ML] Opt.: Load the consecutive clusters of a lazy buffer in one event loop - #23793

Merged
siliataider merged 1 commit into
root-project:masterfrom
siliataider:rdataloader-opt
Oct 22, 2026
Merged

siliataider merged 1 commit into
root-project:masterfrom
siliataider:rdataloader-opt

Conversation

@siliataider

@siliataider siliataider commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

This Pull request:

Changes or fixes:

In lazy mode, the RDataLoader fills its staging buffer with as many clusters as fit in batch_size * batches_in_memory entries, and loaded each of them with its own ChangeBeginAndEndEntries and event loop. The clusters of a buffer that follow each other in the same dataframe are now merged into a single entry range before loading, so they are read in one event loop.

This is particularly useful when shuffling is disabled because the clusters of a buffer always follow each other, so each buffer is loaded in a single event loop (instead of however many clusters it contained).

Ex.: 10 clusters of 100 entries (1000 entries total), read with batch_size=100 and batches_in_memory=4, so a buffer holds 400 entries:

buffer 1: [c1][c2][c3][c4]  → before: 4 event loops, after: 1 over [c1.start, c4.end)
buffer 2: [c5][c6][c7][c8]  → before: 4 event loops, after: 1 over [c5.start, c8.end)
buffer 3: [c9][c10]         → before: 2 event loops, after: 1 over [c9.start, c10.end)

An epoch goes from 10 event loops to 3 in this example. The rows are loaded in the same order, so the batches are unchanged.

Note

This might help when we decide to enable implicit multi-threading.

Checklist:

  • tested changes locally

… event loop

The clusters of a buffer that follow each other in the same dataframe are merged into one entry range before loading, so that without shuffling a buffer is loaded in one event loop instead of one loop per cluster.
@siliataider siliataider self-assigned this Oct 22, 2026
@siliataider siliataider added the in:ML Everything under ROOT/ML label Oct 22, 2026

@vepadulano vepadulano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed after offline discussion, thanks!

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Test Results

    24 files      24 suites   3d 22h 2m 27s ⏱️
 3 895 tests  3 869 ✅ 0 💤  26 ❌
83 393 runs  82 981 ✅ 0 💤 412 ❌

For more details on these failures, see this check.

Results for commit fdae629.

♻️ This comment has been updated with latest results.

@siliataider
siliataider merged commit 6883bf3 into root-project:master Oct 22, 2026
38 of 63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in:ML Everything under ROOT/ML

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants