You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following #2522, the DataLayout interface will allow communication primitives to be implemented separately from specialized operators. That PR introduces the foreach_point primitive, and uses it to define thefill! and copyto! operators for DataLayouts and LazyDataLayouts (i.e., DataStyle broadcast expressions). #2514 lays out a plan for following this up with the foreach_column primitive, and later with the foreach_slab primitive.
This SDI outlines the other half of the operator simplification work: replacing all vertical stencil operations (specifically, functions called by copyto! for a StencilBroadcasted) with a single "convolution" operator. While this will not be as simple as the pointwise operators, it will still improve the maintainability of ClimaCore by centralizing all vertical operation logic in a single source code location, eliminating the need for code duplication in the CUDA extension. Since linear operator composition and inversion (also known as "deconvolution") are already operator-agnostic, as are column_reduce!/column_accumulate!, this is the final step needed to eliminiate redundant code for vertical operations.
Task Breakdown
Allow BandMatrixRow to be applied as a standard function
Define a method for (::BandMatrixRow)(args...), where the number of arguments is the matrix bandwidth
This function may either use *, or it may use mul_with_projection, whichever is easier
Using mul_with_projection will require explicitly passing the local_geometry to every function
Using * will require wrapping Tensor coefficients of BandMatrixRows in some new LinearForm type that contains the local_geometry
E.g., *(x::LinearForm, y::Tensor) can act equivalently to mul_with_projection(x.tensor, y, x.local_geometry)
Implement column_convolve!(op, args...; bcs...) to apply stencils, matching column_reduce!/column_accumulate!
Support any generic convolution kernel op(arg_points...), with linear kernels represented by BandMatrixRows
To represent the gradient as a BandMatrixRow, probably need a LinearForm type to encode "outer products"
Nonlinear upwinding operators can use generic Functions or closures
Support any generic boundary condition bc_op(arg_points...), though we only need a few common cases
Following Tr/rm bcs #2521, all boundary conditions will be either extrapolating/padding arguments or setting the output value
Constant output values at boundaries can be implemented as bc_op = Returns(const)
Nonconstant output values can be implemented as BandMatrixRows for linear operators
Purpose
Following #2522, the
DataLayoutinterface will allow communication primitives to be implemented separately from specialized operators. That PR introduces theforeach_pointprimitive, and uses it to define thefill!andcopyto!operators forDataLayouts andLazyDataLayouts (i.e.,DataStylebroadcast expressions). #2514 lays out a plan for following this up with theforeach_columnprimitive, and later with theforeach_slabprimitive.This SDI outlines the other half of the operator simplification work: replacing all vertical stencil operations (specifically, functions called by
copyto!for aStencilBroadcasted) with a single "convolution" operator. While this will not be as simple as the pointwise operators, it will still improve the maintainability of ClimaCore by centralizing all vertical operation logic in a single source code location, eliminating the need for code duplication in the CUDA extension. Since linear operator composition and inversion (also known as "deconvolution") are already operator-agnostic, as arecolumn_reduce!/column_accumulate!, this is the final step needed to eliminiate redundant code for vertical operations.Task Breakdown
BandMatrixRowto be applied as a standard function(::BandMatrixRow)(args...), where the number of arguments is the matrix bandwidth*, or it may usemul_with_projection, whichever is easiermul_with_projectionwill require explicitly passing thelocal_geometryto every function*will require wrappingTensorcoefficients ofBandMatrixRows in some newLinearFormtype that contains thelocal_geometry*(x::LinearForm, y::Tensor)can act equivalently tomul_with_projection(x.tensor, y, x.local_geometry)column_convolve!(op, args...; bcs...)to apply stencils, matchingcolumn_reduce!/column_accumulate!op(arg_points...), with linear kernels represented byBandMatrixRowsBandMatrixRow, probably need aLinearFormtype to encode "outer products"Functions or closuresbc_op(arg_points...), though we only need a few common casesbc_op = Returns(const)BandMatrixRows for linear operatorsDataScopefrom Unify DataLayouts and simplify API #2522, not just the CUDA device scopesMArrays instead of CUDA shmem arrayscolumn_convolve!to compose stencils, instead of just applying them to input argumentsBandMatrixRows, composition is straightforwardop1 ∘ op2foreach_columnprimitive when it is availableProducers
This task will initially be assigned to ICCS.
Reviewers
@dennisYatunin, @imreddyTeja