Commit 019cd25
Make the unified DataLayouts API fast and correct on CPUs and GPUs [perf]
Verifies and refines the DataLayouts rewrite across CPUs, GPUs, docs, tests,
and downstream packages.
- Point indexing: getindex/setindex!/view constant-fold the Cartesian-to-linear
conversion and use a constant-stride linear index into the parent of a
property-view SubArray, bypassing Base's per-access column-major arithmetic
and its linear-to-Cartesian reindex (div/rem, SignedMultiplicativeInverse).
This bounds the deeply-inlined finite-difference stencil body that
compile-killed the ClimaAtmos EDMF Larcform1 GPU job (OOM): implicit_tendency!
compile ~110s -> ~32s, with column FD-op runtime gains and bit-identical
values. The offset folds on device via unrolled_reduce (no InvalidIRError).
- Property views / IndexStyle: build slice and property SubArrays from Colons
(Base.Slice) so VIJHF views are fast-linear (IndexLinear) while VIJFH views
stay IndexCartesian; IndexStyle defers to the parent, so pointwise broadcasts
never linear-index an IndexCartesian SubArray.
- GPU support: DataScopes map onto the CUDA execution hierarchy, loops and
reductions launch through auto_launch! with occupancy-based configurations,
and Utilities.stable_view keeps slice/property views inference-stable (kernel
arguments and closures follow isbits rules). Each view is adapted to a compact
device view (Int32 offsets instead of a SubArray) so large EDMF broadcasts fit
the sm_60 4 KiB kernel-parameter limit, and DataScopes combine by pairwise
recursion so inference does not widen scopes to Any.
- CPU runtime matches main: unmasked point loops vectorize under @simd with an
inlined point function, nested loops avoid closure allocations, and GPU point
loops iterate each thread's strided CartesianIndices subset through an
indexable isbits wrapper, keeping kernel launch latency at main's level.
- Compile time: @maybe_propagate_inbounds requests inlining of stencil
expression nodes only when check-bounds is off, taking the FCT advection
examples from 40-58 minutes to about a minute in CI.
- Reductions and masks: order-insensitive pairwise safe_mapreduce (no
linear-indexing assumption), masks are keyword arguments, equality ignores
padding, and field2array / the distributed HDF5 writer handle all layout
shapes. Fix the GPU MPI DSS exchange buffer index that overlapped items when
Nv > 1 and Nf > 1, and apply the QuasiMonotoneLimiter through one scalar view
per component (avoiding an uncompilable reshape of a device SubArray).
- Compatibility, docs, tests: deprecation aliases (DataLayouts/deprecated.jl,
Fields.ColumnField) and the universal CartesianIndex{5} convention keep
downstream packages working; zero-size fields stay hidden from propertynames;
docs and NEWS are expanded and Aqua ambiguities resolved; tests restore
check_basetype, benchmark_fill, and the VIJFH-F64 stencil set, and add
DataLayouts mask/reduction jobs, device-aware dss tests, and latency baselines
at their original tolerance.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 31c1013 commit 019cd25
113 files changed
Lines changed: 3064 additions & 1523 deletions
File tree
- .buildkite
- perf
- .github/workflows
- docs/src
- APIs
- examples
- column
- hybrid
- sphere
- ext
- cuda
- lib
- ClimaCoreMakie/src
- ClimaCorePlots/src
- src
- DataLayouts
- Fields
- Geometry
- Grids
- InputOutput
- Limiters
- MatrixFields
- Operators
- Remapping
- Spaces
- Topologies
- Utilities
- test
- CommonSpaces
- DataLayouts
- Fields
- Limiters
- MatrixFields
- Operators
- finitedifference
- hybrid
- spectralelement
- Spaces
- TestUtilities
- Utilities
- gpu
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
117 | 127 | | |
118 | 128 | | |
119 | 129 | | |
| |||
1568 | 1578 | | |
1569 | 1579 | | |
1570 | 1580 | | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
1571 | 1597 | | |
1572 | 1598 | | |
1573 | 1599 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
7 | 18 | | |
8 | 19 | | |
9 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | | - | |
| 10 | + | |
9 | 11 | | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
14 | 85 | | |
15 | 86 | | |
16 | 87 | | |
| |||
19 | 90 | | |
20 | 91 | | |
21 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
22 | 103 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
225 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
226 | 228 | | |
227 | 229 | | |
228 | 230 | | |
| |||
0 commit comments