Skip to content

Transform FD broadcast objs to use MArrays - #1763

Closed
charleskawczynski wants to merge 2 commits into
mainfrom
ck/shmem_fd
Closed

Transform FD broadcast objs to use MArrays#1763
charleskawczynski wants to merge 2 commits into
mainfrom
ck/shmem_fd

Conversation

@charleskawczynski

Copy link
Copy Markdown
Contributor

Similar to #1735, this PR transforms our broadcast expressions by replacing array-backed DataLayouts to MArray-backed DataLayouts in each column of the stencil kernels.

The main benefit here is that this will result in at most 1 heap memory read for whatever fields we transform. One downside is that those reads become unconditional. I'll update #1746 with more details on these trade-offs, and what design choices we can make to ensure that we only see performance gains without regressions.

Closes #1746.

@charleskawczynski

Copy link
Copy Markdown
Contributor Author

To recap on why this stalled: transforming the broadcasted object into an MArray-backed data structure forces reads of all field variables in the broadcasted object. That means that, even if a variable is not used in the broadcast expression, it still incurs a read, which will tank performance.

If there was some way that we could determine which fields are read, and only transform those variables, then this would be feasible, but I'm not sure if that's possible.

@charleskawczynski

Copy link
Copy Markdown
Contributor Author

Superseded by #2184.

@charleskawczynski

Copy link
Copy Markdown
Contributor Author

Actually, I think this is may be very useful when it's likely that we'll use all variables in the input field (basically when all expressions are fused).

We don't want to replace the existing behavior, but we could define a new operator that uses this behavior. At some point I'd like to revive this.

@charleskawczynski

Copy link
Copy Markdown
Contributor Author

This is basically superseded by columnwise!, as columnwise! can apply local memory to both the state and the local geometry.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use shared/local memory in FD stencils kernels

1 participant