Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce unnecessary specializations #2040

Closed
wants to merge 1 commit into from
Closed

Conversation

charleskawczynski
Copy link
Member

This PR removes some unnecessary specializations.

One thing I realized is that we were compiling quite a few copyto! methods because of all the slab / column calls, which forwarded to additional copyto! methods that then needed to be compiled. I don't think that this actually buys us anything.

I used https://timholy.github.io/SnoopCompile.jl/dev/tutorials/pgdsgui/ to apply some de-specializations. Here's one result:

copyto!(dest::ClimaCore.DataLayouts.AbstractData, bc::Union{Base.Broadcast.Broadcasted, ClimaCore.DataLayouts.AbstractData}) @ ClimaCore.DataLayouts ~/dev/CliMA/ClimaCore.jl/src/DataLayouts/copyto.jl:5
(397 specializations) # before

copyto!(dest::ClimaCore.DataLayouts.AbstractData, bc::Union{Base.Broadcast.Broadcasted, ClimaCore.DataLayouts.AbstractData}) @ ClimaCore.DataLayouts ~/dev/CliMA/ClimaCore.jl/src/DataLayouts/copyto.jl:5
(... specializations) # now (pending...)

I also applied strip_space to the broadcasted objects in the stencil kernels, since this could reduce specializations on getindex of the broadcasted object.

I also added a singleton type into the datalayouts, which we can use to keep our generic code while avoid overspecializing on specific datalayouts.

@charleskawczynski
Copy link
Member Author

Superseded by #2041, #2042 and #2043

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant