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

(closes #2684) Fix the failure case when we have a WHERE construct with no array index notation. #2687

Merged
merged 34 commits into from
Sep 30, 2024

Conversation

LonelyCat124
Copy link
Collaborator

No description provided.

@LonelyCat124 LonelyCat124 self-assigned this Aug 7, 2024
Copy link

codecov bot commented Aug 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.86%. Comparing base (70f9793) to head (9340fd6).
Report is 35 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2687      +/-   ##
==========================================
- Coverage   99.86%   99.86%   -0.01%     
==========================================
  Files         354      354              
  Lines       49082    49046      -36     
==========================================
- Hits        49018    48982      -36     
  Misses         64       64              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LonelyCat124
Copy link
Collaborator Author

@sergisiso ready for a first look, I'm not super sure on the implementation details so its possible there's some things we're not testing for that i've missed.

Copy link
Collaborator

@sergisiso sergisiso left a comment

Choose a reason for hiding this comment

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

Thanks @LonelyCat124 I think it's a step in the right directions. See comments inline but essentially I would like to see some more testing about what happens with "references" where we can not figure out its type ow when we have different kinds of intrinsics.

src/psyclone/psyir/frontend/fparser2.py Outdated Show resolved Hide resolved
src/psyclone/psyir/frontend/fparser2.py Show resolved Hide resolved
src/psyclone/psyir/frontend/fparser2.py Outdated Show resolved Hide resolved
src/psyclone/psyir/frontend/fparser2.py Outdated Show resolved Hide resolved
src/psyclone/psyir/frontend/fparser2.py Show resolved Hide resolved
@LonelyCat124
Copy link
Collaborator Author

LonelyCat124 commented Aug 28, 2024

I think this is ready for another look @sergisiso . The outstanding thing I've not addressed is intrinsics (which were already "forbidden" in fparser2 before this change) - I'm not sure if/when it makes sense for them to exist.

@sergisiso
Copy link
Collaborator

@LonelyCat124 wrt the failing integration test, as we discussed last week, we need to do the following change:

         # For performance in lib_fortran, mark serial routines as GPU-enabled
         if psyir.name == "lib_fortran.f90":
-            if not subroutine.walk(Loop):
-                try:
-                    # We need the 'force' option.
-                    # SIGN_ARRAY_1D has a CodeBlock because of a WHERE without
-                    # array notation. (TODO #717)
-                    OMPDeclareTargetTrans().apply(subroutine,
-                                                  options={"force": True})
-                except TransformationError as err:
-                    print(err)
+            if subroutine.name.lower().startswith("sign_"):
+                OMPDeclareTargetTrans().apply(subroutine)

In omp_gpu_trans.py, acc_loops_trans.py, and acc_kernels_trans.py. I checked that it works and doesn't degrade the performance. The changes are:

  • We don't identify the routine by having no loops anymore, we identify them by name.
  • The force is gone because there is no Codeblock anymore as the WHERE is expanded. Well done.
  • I removed the except because if this fails it will produce code that doesn't compile, so we better fail early

@LonelyCat124
Copy link
Collaborator Author

I've set the integration tests running again now with those changes.

Copy link
Collaborator

@sergisiso sergisiso left a comment

Choose a reason for hiding this comment

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

@LonelyCat124 I made changes in some comments and pointed out some additional issues in #2722. But since this already fixes some of the reported issues and it passes the integration tests, it is a good amount of progress to merge this and defer remaining issues to a future PR. This is ready to merge.

@sergisiso sergisiso changed the title (#Towards 2684) Fix the failure case when we have a WHERE construct with no array index notation. (closes #2684) Fix the failure case when we have a WHERE construct with no array index notation. Sep 30, 2024
@sergisiso sergisiso merged commit 652ad61 into master Sep 30, 2024
13 checks passed
@sergisiso sergisiso deleted the 2684_fix branch September 30, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants