Skip to content

Conversation

@razvanlupusoru
Copy link
Contributor

Add acc.get_lowerbound, acc.get_upperbound, acc.get_stride, and acc.get_extent operations to extract information from acc bounds.

This simplifies the arguments needed for recipes when handling slices and makes bound information consistent with data clauses. Update recipe documentation to clarify argument ordering and add examples demonstrating slice handling with bounds arguments.

Add acc.get_lowerbound, acc.get_upperbound, acc.get_stride, and
acc.get_extent  operations to extract information from acc bounds.

This simplifies the arguments needed for recipes when handling
slices and makes  bound information consistent with data clauses.
Update recipe documentation to clarify argument ordering and add
examples demonstrating slice handling with bounds arguments.
Copy link
Collaborator

@erichkeane erichkeane left a comment

Choose a reason for hiding this comment

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

I think this makes a lot of sense, thanks!

let description = [{
This operation extracts the upperbound value from an `acc.bounds` value.
If the data bounds does not have an upperbound specified, this operation
uses the extent to compute it.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oooh, awesome!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This description is not yet implemented :) I just captured the intent. Sorry if it misled.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, no, I assumed as much. Just awesome that it is the intent, saves a lot of other work.

must yield the privatized copy.
2. The destroy region specifies how to destruct the value when it reaches
its end of life. It takes the privatized value as argument.
its end of life. It takes the original value, the privatized value, and
Copy link
Collaborator

Choose a reason for hiding this comment

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

Curious what the use of the privatized version is here? Which should I be destroying, the 1st one, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The way I just documented this is that the original (read this as "non-private") variable is always passed in as the first argument for consistency. So it is the second one that should be destroyed. Are you OK with this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see the first argument being 'useful' here? But I have no problem with it, I'll just have to 'note' it.

At one point I think the 'verifier' should start doing some level of failures for this signature though, which would help catch any issues I have.

Copy link
Collaborator

Choose a reason for hiding this comment

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

See here: #156716

I've changed the clang lowering to follow this signature.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure the first argument makes sense.

Copy link
Contributor Author

@razvanlupusoru razvanlupusoru Sep 3, 2025

Choose a reason for hiding this comment

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

I added it for consistency so all regions take it as first argument. In all other regions including init, copy, combiner it is taken as first argument.

Although I am not sure it is useful for CIR and FIR, I can imagine cases where it can be. One scenario is when a dialect's type system does not encode sizes and it needs to be recovered from IR so that destroy can properly deallocate. I am definitely grasping at straws here - so hopefully the consistency reason is enough to justify it.

Copy link
Contributor

Choose a reason for hiding this comment

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

No strong opinion on that so I'll leave it to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At one point I think the 'verifier' should start doing some level of failures for this signature though, which would help catch any issues I have.

I agree. I have not added verifier yet because Flang does not yet comply with this.

erichkeane added a commit to erichkeane/llvm-project that referenced this pull request Sep 3, 2025
Patch llvm#156545 is introducing a different syntax for the 'destroy'
section of a recipe, which takes the 'original' value as the first
argument, and the one-to-be-destroyed as the 2nd.  This patch corrects
the lowering to match that signature.
@razvanlupusoru razvanlupusoru merged commit adc0a2c into llvm:main Sep 3, 2025
10 checks passed
erichkeane added a commit that referenced this pull request Sep 3, 2025
Patch #156545 is introducing a different syntax for the 'destroy'
section of a recipe, which takes the 'original' value as the first
argument, and the one-to-be-destroyed as the 2nd. This patch corrects
the lowering to match that signature.
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.

3 participants