Skip to content

Make chunks always a power of 2#226

Merged
christinaflo merged 1 commit into
aqlaboratory:mainfrom
GMNGeoffrey:pow2-chunking
May 20, 2026
Merged

Make chunks always a power of 2#226
christinaflo merged 1 commit into
aqlaboratory:mainfrom
GMNGeoffrey:pow2-chunking

Conversation

@GMNGeoffrey

Copy link
Copy Markdown
Contributor

Summary
For some reason, the largest chunk size in chunk size tuning is incremented by 4. This was added in a9a12890d without explanation. We can hypothesize that it was related to adding 4 to an input dimension in trace_utils.py (trying to get a test case to fit in one chunk?), but that file was long ago deleted. This just looks like a bug and makes us hit unhappy paths all over the place.

Changes

  • Delete the addition of 4 to the largest chunk size

Related Issues

Testing

  • Confirmed that attention kernel calling pattern moves from batches of 129 to 128 (since it is divided by 4 for attention).
  • I didn't find a good way to unit test this that was actually a useful test (e.g. I can assert that chunk_size is now 512 instead of 516, but I don't think that test carries its weight).

Other Notes

Avoid weird addition of 4 to power-of-two chunk sizes. This was added in
aqlaboratory@a9a12890d without
explanation. We can hypothesize that it was related to adding 4 to an
input dimension in trace_utils.py (trying to get a test case to fit in
one chunk?), but that file was long ago deleted. This just looks like a
bug and makes us hit unhappy paths all over the place. Fixes
aqlaboratory#203.
@GMNGeoffrey

Copy link
Copy Markdown
Contributor Author

Hey @christinaflo, I broke this out of #207 since we were exploring more complicated approaches for that and I think this change is good on its own.

@christinaflo christinaflo self-requested a review May 20, 2026 16:37
@christinaflo christinaflo added the safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing. label May 20, 2026

@christinaflo christinaflo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm!

@christinaflo christinaflo merged commit c4c21e2 into aqlaboratory:main May 20, 2026
11 checks passed
@GMNGeoffrey GMNGeoffrey deleted the pow2-chunking branch May 21, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG/QUESTION] Chunk size incremented by 4 off largest power of 2

2 participants