Repository navigation
Sometimes inline broadcasts - #2696
Draft
imreddyTeja wants to merge 2 commits into
Draft
imreddyTeja wants to merge 2 commits into
imreddyTeja wants to merge 2 commits into
Conversation
Fused slice-loop statements that need any shared memory were noinlined so that equally sized buffers of different statements share memory. A call that is noinlined copies its arguments onto the stack of every GPU thread,
Statements of fused slice loops whose shared buffers are too large to inline are still compiled separately, and every GPU thread copies their arguments onto its stack before each call. Most of those bytes were copies of the column grid, one per field and operator node, so the grid is now replaced by a PlaceholderGrid in the arguments and passed once, and the callee returns nothing instead of the destination. This shrinks the per-thread copy about 3x (e.g., 7,280 B -> 2,896 B for three statements caching 6-value tuples in 64-face columns), and their fused loops run about 3x faster, though still slower than the same statements unfused.
imreddyTeja
force-pushed
the
tr/shmem-inlining
branch
from
October 21, 2026 17:51
02b0e60 to
9a00beb
Compare
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.
slice-loop statements that need any shared memory were
noinlined so that equally sized buffers of different statements share
memory. A call that is noinlined copies its arguments onto the stack of
every GPU thread. This PR first makes statements that use a small buffer get inlined. It also uses a placeholder grid to make the stack smaller for the cases where it does spill to the stack
script I used to benchmark (not added, unless reviewers think it should be):
claude generated results table:
Timings of
perf/fused_column_fd.jlGPU kernel time per call (µs, CUPTI) on one A100,
HELEM=16,Nq=4, Float64, formain(96a1129) and this branch (9a00beb).advis the three advective divergences of ρ, ρe_tot and ρq_tot that share ᶠρ;u₃is the implicit u₃ tendency, both simplified from ClimaAtmoszs/column-fusion. Nv is the number of vertical elements (Nv + 1 faces). Unfused times are the same on both branches (within 1%), so they are listed once. Fused results match unfused ones exactly at every Nv on both branches.With columns of more than 32 faces, the fused bodies on
mainare 37-74x slower than unfused. On this branch they are faster than unfused, exceptadvat Nv = 32 (1.8x slower) andu₃at Nv = 79 (7% slower).