Skip to content

Changes to OpenMP scripts to extract arguments from iom_put#3373

Merged
sergisiso merged 38 commits intomasterfrom
iom_put_to_temp_
Apr 28, 2026
Merged

Changes to OpenMP scripts to extract arguments from iom_put#3373
sergisiso merged 38 commits intomasterfrom
iom_put_to_temp_

Conversation

@LonelyCat124
Copy link
Copy Markdown
Collaborator

No description provided.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.96%. Comparing base (2fcbc7a) to head (20ba60a).
⚠️ Report is 39 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3373   +/-   ##
=======================================
  Coverage   99.96%   99.96%           
=======================================
  Files         389      389           
  Lines       54548    54598   +50     
=======================================
+ Hits        54529    54579   +50     
  Misses         19       19           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LonelyCat124
Copy link
Copy Markdown
Collaborator Author

Transformation failing on nemo5, and maybe not for structure of array:

psyclone --enable-cache -l output -s /archive/psyclone-tests/action-runner-software/actions-runner/_work/PSyclone-mirror/PSyclone-mirror/examples/nemo/scripts/omp_cpu_trans.py -I /archive/psyclone-tests/latest-run/UKMO-NEMOv5/tests/BENCH_OMP_THREADING_GCC/BLD/tmp -o icewri.psycloned.f90 /archive/psyclone-tests/latest-run/UKMO-NEMOv5/tests/BENCH_OMP_THREADING_GCC/BLD/ppsrc/nemo/icewri.f90
Adding OpenMP threading to subroutine: ice_wri
Traceback (most recent call last):
  File "/archive/psyclone-tests/action-runner-software/actions-runner/_work/PSyclone-mirror/PSyclone-mirror/.runner_venv/bin/psyclonefc", line 45, in <module>
    compiler_wrapper(sys.argv[1:])
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/archive/psyclone-tests/action-runner-software/actions-runner/_work/PSyclone-mirror/PSyclone-mirror/.runner_venv/lib/python3.14/site-packages/psyclone/psyclonefc_cli.py", line 140, in compiler_wrapper
    main(psyclone_args)
    ~~~~^^^^^^^^^^^^^^^
  File "/archive/psyclone-tests/action-runner-software/actions-runner/_work/PSyclone-mirror/PSyclone-mirror/.runner_venv/lib/python3.14/site-packages/psyclone/generator.py", line 743, in main
    code_transformation_mode(
    ~~~~~~~~~~~~~~~~~~~~~~~~^
        input_file=args.filename,
        ^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
        line_length=args.limit,
        ^^^^^^^^^^^^^^^^^^^^^^^
        free_form=free_form)
        ^^^^^^^^^^^^^^^^^^^^
  File "/archive/psyclone-tests/action-runner-software/actions-runner/_work/PSyclone-mirror/PSyclone-mirror/.runner_venv/lib/python3.14/site-packages/psyclone/generator.py", line 964, in code_transformation_mode
    trans_recipe(psyir)
    ~~~~~~~~~~~~^^^^^^^
  File "/archive/psyclone-tests/action-runner-software/actions-runner/_work/PSyclone-mirror/PSyclone-mirror/examples/nemo/scripts/omp_cpu_trans.py", line 113, in trans
    iom_put_argument_to_temporary(subroutine.walk(Call))
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/archive/psyclone-tests/action-runner-software/actions-runner/_work/PSyclone-mirror/PSyclone-mirror/examples/nemo/scripts/utils.py", line 541, in iom_put_argument_to_temporary
    DataNodeToTempTrans().apply(arg)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/archive/psyclone-tests/action-runner-software/actions-runner/_work/PSyclone-mirror/PSyclone-mirror/.runner_venv/lib/python3.14/site-packages/psyclone/psyir/transformations/datanode_to_temp_trans.py", line 274, in apply
    node.scope.symbol_table.add(sym_copy)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/archive/psyclone-tests/action-runner-software/actions-runner/_work/PSyclone-mirror/PSyclone-mirror/.runner_venv/lib/python3.14/site-packages/psyclone/psyir/symbols/symbol_table.py", line 600, in add
    raise KeyError(f"Symbol table already contains a symbol with "
                   f"name '{new_symbol.name}'.")
KeyError: "Symbol table already contains a symbol with name 'Nie0'."

@LonelyCat124 LonelyCat124 marked this pull request as ready for review March 17, 2026 12:14
@LonelyCat124
Copy link
Copy Markdown
Collaborator Author

ITs all pass now, the remaining question is whether there's any performance degredation - I don't think there should be but its possible this is being done "too widely". One for either @sergisiso or @arporter to review.

Copy link
Copy Markdown
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 The changes look good, but I would like that the transformation provide more feedback in order to understand why it hasn't given a performance improvement. Also, see if it can be more generic.

Comment thread examples/nemo/scripts/utils.py Outdated
@sergisiso
Copy link
Copy Markdown
Collaborator

The DataNode2Temp has a:

calls = node.walk(Call)
for call in calls:
    if not call.is_pure:
       raise

This may be a problem as walk returns self, and iom_put is not pure. I suppose this was meant for the calls in the arguments and we just forgot to skip self?

@LonelyCat124
Copy link
Copy Markdown
Collaborator Author

The DataNode2Temp has a:

calls = node.walk(Call)
for call in calls:
    if not call.is_pure:
       raise

This may be a problem as walk returns self, and iom_put is not pure. I suppose this was meant for the calls in the arguments and we just forgot to skip self?

@sergisiso I don't think so. We're calling the transformation on the argument, not the call so the iom_put is the parent.

@LonelyCat124
Copy link
Copy Markdown
Collaborator Author

@sergisiso This is ready for another look, I am going to set ITs going again since output code changes will likely happen.

Copy link
Copy Markdown
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 am happy with the current implementation and bringing the remaining rough edges to separate issues/TODOs. There is just final clean up to do before merging it.

Comment thread examples/nemo/scripts/omp_gpu_trans.py Outdated
Comment thread examples/nemo/scripts/utils.py
Comment thread examples/nemo/scripts/utils.py Outdated
Comment thread src/psyclone/psyir/transformations/datanode_to_temp_trans.py Outdated
Comment thread src/psyclone/psyir/nodes/intrinsic_call.py Outdated
Comment thread src/psyclone/psyir/nodes/intrinsic_call.py
Comment thread src/psyclone/psyir/nodes/intrinsic_call.py Outdated
@LonelyCat124
Copy link
Copy Markdown
Collaborator Author

@sergisiso I've set integration running again, assuming no issues arise this is ready for another look. If the tests fail on treesitter related issues then I think we should wait until #3408 is merged.

Copy link
Copy Markdown
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 All comments have been addressed and this is ready for merging, but I will wait until the PR that fixes the treesitter issue is merged to proceed.

@sergisiso sergisiso merged commit 59b71f5 into master Apr 28, 2026
14 of 15 checks passed
@sergisiso sergisiso deleted the iom_put_to_temp_ branch April 28, 2026 16:59
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