Skip to content

Implement ReactantCore.materialize_traced_array for Field#5409

Merged
glwagner merged 1 commit intoCliMA:mainfrom
Pangoraw:field-materialized-traced-array
Mar 19, 2026
Merged

Implement ReactantCore.materialize_traced_array for Field#5409
glwagner merged 1 commit intoCliMA:mainfrom
Pangoraw:field-materialized-traced-array

Conversation

@Pangoraw
Copy link
Copy Markdown
Collaborator

Should fix the StackOverflow error from NumericalEarth/Breeze.jl#565 (comment).

@giordano giordano added the reactant ∇ all day I dream about MLIR label Mar 18, 2026
Copy link
Copy Markdown
Member

@glwagner glwagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the purpose of materialize_traced_array?

@Pangoraw
Copy link
Copy Markdown
Collaborator Author

materialize_traced_array is used to go from an AbstractArray containing TracedRNumber to a TracedRArray of a particular shape so for example for things like Diagonal or SubArray. But for Field which is similar to a SubArray that def unfortunately has to live in Oceananigans

@glwagner
Copy link
Copy Markdown
Member

got it! so the important part about interior(field) is that it has the expected size/shape

@Pangoraw
Copy link
Copy Markdown
Collaborator Author

Yes since Field is a SubArray in a trench coat we can just call the corresponding method in Reactant: https://github.com/EnzymeAD/Reactant.jl/blob/f77e876bbea9e974173eb922e3185f8a85a021ab/src/TracedUtils.jl#L63-L65

@glwagner glwagner merged commit f84994e into CliMA:main Mar 19, 2026
64 of 66 checks passed
@Pangoraw Pangoraw deleted the field-materialized-traced-array branch March 19, 2026 17:02
briochemc added a commit to briochemc/Oceananigans.jl that referenced this pull request Mar 23, 2026
…ine-ACCESS-OM2

* bp-claude/distributed-FPivot-TripolarGrid:
  Replace reverse() with reversed-range views in fold halo fills
  Reinstate Docs/Benchmarks (CliMA#5419)
  Update fill_halo_regions.jl (CliMA#5415)
  Temporarily drop Benchmark section from Docs + delete `legacy_benchmarks` (CliMA#5412)
  Add restart verification script (CliMA#5379)
  Rework support for reduction operations on Metal GPU to avoid materialization of the interior (CliMA#5329)
  Fix typo with density perturbation in docs (CliMA#5398)
  Implement ReactantCore.materialize_traced_array for Field (CliMA#5409)
  Remove Oceananigans dependency from Project.toml (CliMA#5414)
  (0.106) Log checkpoint file and mtime when restoring simulations (CliMA#5355)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reactant ∇ all day I dream about MLIR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants