Skip to content

Less CPU VLAs - #2133

Open
jeremylt wants to merge 2 commits into
mainfrom
jeremy/less-vla
Open

jeremylt wants to merge 2 commits into
mainfrom
jeremy/less-vla

Conversation

@jeremylt

@jeremylt jeremylt commented Dec 2, 2026

Copy link
Copy Markdown
Member

Purpose:

I don't imagine this would have a performance impact, but we (I, really) should check.

Closes: #N/A

LLM/GenAI Disclosure:

None

By submitting this PR, the author certifies to its contents as described by the Developer's Certificate of Origin.
Please follow the Contributing Guidelines for all PRs.

@zatkins-dev zatkins-dev 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.

Assuming perf doesn't change much, I think I'm on board. I still think that using the block size from the Ceed context and automatically blocking num_elem > block_size would also be totally acceptable (that would remove the only cases in which this blows out the stack). But this is probably more safe for high-order 3D (which I guess could also blow up mem usage).

Comment thread backends/ref/ceed-ref-basis.c Resolved
Comment thread interface/ceed-tensor.c Resolved

@zatkins-dev zatkins-dev 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.

Note: /cpu/self/gen/* has the same issue, which I've just cheated for high order by letting the stack reallocate (-fsplit-stack). Should we add some stack protection flags to CI? See e.g. https://developers.redhat.com/articles/2022/06/02/use-compiler-flags-stack-protection-gcc-and-clang

@jeremylt

jeremylt commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

About re-blocking: Since the blocking requires the elements to be interleaved for CPU backends, its non-trivial for the basis to shuffle and then shuffle back the memory to extract blocks of 8 or less if more than 8 elements are passed. That's why I went with a cutoff of 8

About cpu/gen: I think adding this there will require a bit more thought, especially with the possibility of turning of OpenMP support coming as a student PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants