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

feat[cartesian]: K offset write #1452

Merged

Conversation

FlorianDeconinck
Copy link
Contributor

@FlorianDeconinck FlorianDeconinck commented Feb 13, 2024

Description

Looking at enabling offset write in K to help with physics.
Write is allowed on FORWARD and BACKWARD, disallowed for PARALLEL.

TODO:

  • Make tests for conditional
  • Explore auto extend calculation
  • Fix dace:X backends

Link to #131
Discussion happened on GridTools concept

Requirements

  • All fixes and/or new features come with corresponding tests.
  • Important design decisions have been documented in the approriate ADR inside the docs/development/ADRs/ folder.

@@ -1417,9 +1417,14 @@ def visit_Assign(self, node: ast.Assign) -> list:
for t in node.targets[0].elts if isinstance(node.targets[0], ast.Tuple) else node.targets:
name, spatial_offset, data_index = self._parse_assign_target(t)
if spatial_offset:
Copy link
Contributor

Choose a reason for hiding this comment

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

are these the only changes to make it work? that's nice. It means we "only" have to sort out the conceptual problems

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was expecting more too! So far though, it's all it takes. Next I'll put in some integration tests with conditionals and I'll simplify Oliver's dual for-loop example he pulled from SHiELD microphysics to bring something we've encountered in the wild.

@FlorianDeconinck FlorianDeconinck marked this pull request as ready for review February 20, 2024 17:28
@FlorianDeconinck
Copy link
Contributor Author

I've added a test that mimics the usage seen in the wild (column physics)

B = gt_storage.zeros(
backend=backend, aligned_index=(0, 0, 0), shape=(2, 2, 4), dtype=np.float64
)
simple(A, B)
Copy link
Contributor

Choose a reason for hiding this comment

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

I am a bit confused. Why is this not an oob write?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extent calculation is doing the right job by excluding the first element from the loop

@FlorianDeconinck FlorianDeconinck marked this pull request as draft February 22, 2024 14:01
@FlorianDeconinck
Copy link
Contributor Author

Back to Draft PR:

  • dace:X backends are not doing the right things, all other backends ✔️
  • somehow interval gets properly calculated on a (...)? I was expecting failure. I'll dig more and try to convert findings in expected fails.

@FlorianDeconinck
Copy link
Contributor Author

dace:X now working but that lead me to discover a bug with While and dace:X related to how we transform FieldAccess in the DaceIR

@FlorianDeconinck FlorianDeconinck marked this pull request as ready for review March 15, 2024 14:21
@FlorianDeconinck
Copy link
Contributor Author

while loop bug unearthed in dace:X backends logged at: #1496

@FlorianDeconinck
Copy link
Contributor Author

Poke @havogt, @edopao : I think this is ready for a round of review.

As said before it excludes cuda backend from the test (will be PR a deprecation on cuda backend). It also side step dace:X backends for one test due to a new bug discovered and logged.

Copy link
Contributor

@havogt havogt left a comment

Choose a reason for hiding this comment

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

Note to myself: think about k-caching, double-check that off-center write is taken into account for extent

Rename connector for better tracking in SDFG
var_offset_fields -> offset_in_K_fields
@FlorianDeconinck
Copy link
Contributor Author

dace:X backends repaired.

@havogt
Copy link
Contributor

havogt commented May 17, 2024

cscs-ci run

Copy link
Contributor

@havogt havogt left a comment

Choose a reason for hiding this comment

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

thanks! looks good.

@havogt
Copy link
Contributor

havogt commented May 21, 2024

cscs-ci run

@havogt
Copy link
Contributor

havogt commented Jul 3, 2024

Summary of what I did so far:

@FlorianDeconinck
Copy link
Contributor Author

FlorianDeconinck commented Aug 28, 2024

Back at this:

  • dace:gpu generates plain wrong code (adding pointers?!)
  • gt:gpu fails on CUDA 11 but 12 is fine

@FlorianDeconinck
Copy link
Contributor Author

Poke @havogt :

  • Fixed dace
  • Error out for gt:gpu + CUDA < 12

I think I don't want to fix CUDA < 12 for gt:gpu unless I have to

@FlorianDeconinck
Copy link
Contributor Author

Can't reproduce the dace:gpu with CUDA 12

@FlorianDeconinck
Copy link
Contributor Author

@havogt Can you cscs-run again, the ci died on a TIME LIMIT

@havogt
Copy link
Contributor

havogt commented Sep 23, 2024

cscs-ci run

@FlorianDeconinck FlorianDeconinck merged commit e29016d into GridTools:main Sep 23, 2024
31 checks passed
@FlorianDeconinck FlorianDeconinck deleted the cartesian/k_write_offset branch September 23, 2024 12:26
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.

2 participants