Skip to content

Hotfixes psy2dawn#1157

Open
mroethlin wants to merge 25 commits intoMeteoSwiss-APN:masterfrom
mroethlin:hotfixes_psy2dawn
Open

Hotfixes psy2dawn#1157
mroethlin wants to merge 25 commits intoMeteoSwiss-APN:masterfrom
mroethlin:hotfixes_psy2dawn

Conversation

@mroethlin
Copy link
Copy Markdown
Contributor

@mroethlin mroethlin commented Dec 10, 2021

Technical Description

This PR contains some hot fixes for the Psy2Dawn Project. This should probably be 3 PRs but since this project is EOL I deemed it acceptable to have a summary PR for this

Resolves / Enhances

  • Add sign function to the toolchain
  • Make the checkOffset function in generated code static for easier linking of multiple stencils into one library
  • Fix the code generation for iteration spaces on the cuda backend to use the physical address when checking against the offset instead of the index in the block. Note that this is only tested for the situation where GRIDTOOLS_DAWN_HALO_EXTENT=0
  • Fix an issue where, in the cuda backend, checks would be emitted for all iteration spaces in the stencil, not only the iteration spaces associated with a given stage
  • Fix an issue if a MS is generated that only uses a temp field. In that case, no strides would be generated, effectively only iterating over one column of the temp field.

Example

A simple iteration space

    iteration_space(i_start + 1, i_end-1, j_start + 1, j_end - 1, k_start + 1, k_end - 1) {
      out = 1;
    }

would lead to false positive testing against the iteration space along the j domain in a test case found during the psy2dawn deliverable.

In the cuda backend, a sequence like

    iteration_space(i_start + 1, i_end-1, j_start + 1, j_end - 1, k_start + 1, k_end - 1) {
      out = 1;
    }

    iteration_space(j_start + 1, j_end - 1, k_start + 1, k_end - 1) {
      out = 2;
    }

would be spuriously compiled to the equivalent of

    iteration_space(i_start + 1, i_end-1, j_start + 1, j_end - 1, k_start + 1, k_end - 1) {
      out = 1;
    }

    iteration_space(j_start + 1, j_end - 1, j_start + 1, j_end - 1, k_start + 1, k_end - 1) {
      out = 2;
    }

Testing

  • Three new tests were added to the code generation tests of gtclang
  • A test had to be adapted to the new codegen

Dependencies

This PR is independent.

@mroethlin
Copy link
Copy Markdown
Contributor Author

launch jenkins

1 similar comment
@mroethlin
Copy link
Copy Markdown
Contributor Author

launch jenkins

@mroethlin mroethlin requested a review from muellch December 10, 2021 11:15
@mroethlin mroethlin marked this pull request as draft December 13, 2021 10:06
@mroethlin
Copy link
Copy Markdown
Contributor Author

launch jenkins

@mroethlin mroethlin marked this pull request as ready for review December 13, 2021 11:33
@mroethlin
Copy link
Copy Markdown
Contributor Author

launch jenkins

@mroethlin
Copy link
Copy Markdown
Contributor Author

launch jenkins

@muellch muellch removed their request for review February 24, 2026 12:30
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.

1 participant