Unify DataLayouts and simplify API#2522
Conversation
8d0a64b to
c5b5c9c
Compare
c5b5c9c to
6137f53
Compare
ba2cc32 to
6c38000
Compare
bf25884 to
b3bc90a
Compare
c3a7fec to
6a6d558
Compare
The CPU hierarchy is fixed, and I doubt it will ever need to get more complicated. I was initially hoping to keep the GPU hierarchy simple as well, but I had to add a bit more complexity to match ClimaCore's current behavior. Aside from some naming simplifications ( When processing slice views in parallel across
This will match the current implementation of
To minimize the amount of code we'll need in the CUDA extension, I've handled all of these cases in a single
If the default Let me know if any of this can be changed to further simplify things for you, @Mikolaj-A-Kowalski. |
Purpose
This PR completes the first task outlined in #2468, unifying most of the structs in the
DataLayoutsmodule and simplifying their API to eliminate code duplication. This is a prerequisite for #2514.Content
AbstractDatatoDataLayout, and make it a subtype ofAbstractArrayDataF,VIJHWithF,VIH1, andIH1JH2MArrays or cuda shmem arrays) bysimilar(::DataLayout, ...)Faxisgetindexandsetindex!match standardAbstractArraybehaviorIndexStyle, instead of separate structs likeNonExtrudedBroadcastedDataScopesingleton, a more versatile generalization of aClimaComms.AbstractDeviceDataLayouts, including broadcasts and reductionsDataScopes, as well as rules for partitioning into smallerDataScopesDataScopedispatch:foreach_pointandreducefill!,copyto!, andfused_copyto!through theforeach_pointprimitivereduceandfused_copyto!fused_copyto!treat all layouts consistently (and actually fuse thecopyto!loops every time it is called)BroadcastStyles to one struct, still calledDataStyleDataStyleto propagate the layout type, ignoringDataFlayouts when combining inconsistent typesshape_paramsAbstractArrays inBaseRefs, and for simple identity function broadcastsTuples in broadcasts are treated asRefsTuples fall back to the default behavior forAbstractArrays instead of erroring