Skip to content

Conversation

@hiker
Copy link
Collaborator

@hiker hiker commented Sep 23, 2025

This needs #2049 / #3131 to be merged in. It has a lot of clashes with 2049, so I've merged in 2049 here and resolved them.

@hiker hiker added enhancement Blocked An issue/PR that is blocked by one or more issues/PRs. PSyKE Related to the kernel extraction and driver creation PSyKE labels Sep 23, 2025
@codecov
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.90%. Comparing base (79fa6b6) to head (a3bbe16).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3152   +/-   ##
=======================================
  Coverage   99.90%   99.90%           
=======================================
  Files         376      376           
  Lines       52952    53041   +89     
=======================================
+ Hits        52900    52989   +89     
  Misses         52       52           

☔ 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.

@hiker hiker added ready for review and removed Blocked An issue/PR that is blocked by one or more issues/PRs. labels Oct 6, 2025
@hiker
Copy link
Collaborator Author

hiker commented Oct 7, 2025

Ready for review. I did trigger the CI 'recently' (yesterday or Sunday?). Note that this only replaces loop variable. I will do a follow up PR to also remove the temporary array used when reproducible reductions are enabled.

Copy link
Member

@arporter arporter left a comment

Choose a reason for hiding this comment

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

Thanks @hiker, I think it's looking good. Unfortunately, this is going to clash with #3164 which is removing the ComponentIndices class. I've therefore paused my review. The only real concern I have so far is with naming - I think some changes would help with readability.

'''
def __init__(
self, access_type: AccessType, node: 'Node',
self, access_type: AccessType, node: Union['Node', Symbol],
Copy link
Member

Choose a reason for hiding this comment

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

Just for my understanding, does 'Node' need to be in quotes here because it's only imported if TYPE_CHECKING is true?


@property
def all_read_accesses(self):
def all_read_accesses(self) -> list[str]:
Copy link
Member

Choose a reason for hiding this comment

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

Should be list[AccessInfo]? Also, please rm the the rtype from the docstring.

a different signature.
'''
if self._signature != access_seq.signature:
raise ValueError(f"Updating AccessSequence for '{self.signature}' "
Copy link
Member

Choose a reason for hiding this comment

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

How about "Cannot update the AccessSequence for '{self.signature}' using data for a different access ('{access_seq.signature}')."

signature: Signature,
access_type: AccessType,
node: "Node",
component_indices: Optional[ComponentIndices] = None) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

I've just realised this is going to clash with #3164 (which removes ComponentIndices in favour of dynamic calculation).

postfix: str,
removable_vars: list[tuple[str, Signature]],
) -> list[tuple[Symbol, Symbol]]:
'''This function creates the code that reads in the data file
Copy link
Member

Choose a reason for hiding this comment

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

Please document the new removable_vars argument.

Copy link
Member

Choose a reason for hiding this comment

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

Also, I think vars_to_ignore would be a better name - I was expect the code to actually have to remove things but it doesn't - it just ignores them.

# discarded (e.g. a loop variable might be declared as omp private).
# We do this by counting how many directive nodes are in the list, and
# then subtracting this number from all accesses:
for var_sig, accesses in all_loops.items():
Copy link
Member

Choose a reason for hiding this comment

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

I did wonder whether it might be better to use the new, Reference.escapes_scope() functionality but a) we don't have a Reference for a loop variable (we'd have to find one) and b) this would require extra care if a loop variable was re-used as the variable for another loop. All in all, I think this approach is good.

ctu = CallTreeUtils()
read_write_info = ctu.get_in_out_parameters(
self, include_non_data_accesses=False)
removable_vars = self.get_removable_variables()
Copy link
Member

Choose a reason for hiding this comment

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

Again, I think "vars_to_ignore".

region_name=region_name_tuple,
removable_vars=removable_vars)

for var_info in removable_vars:
Copy link
Member

Choose a reason for hiding this comment

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

Comment please - "remove the variables that we're going to ignore"

'''
suffix = ""
suffix: Union[str, int] = ""
Copy link
Member

Choose a reason for hiding this comment

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

Since you then have to use a cast below, I suggest we leave this type hinting for now.

'''
already_flattened = {} # dict of name: symbol
already_flattened: dict[str, Symbol] = {} # dict of name: symbol
Copy link
Member

Choose a reason for hiding this comment

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

This too is going to clash quite badly with #3164.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement PSyKE Related to the kernel extraction and driver creation PSyKE reviewed with actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants