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

Look for reducer callbacks inside a variable declaration #279

Open
wants to merge 5 commits into
base: dev/18.x
Choose a base branch
from

Conversation

VoxSciurorum
Copy link
Contributor

No description provided.

@VoxSciurorum VoxSciurorum requested a review from neboat October 16, 2024 16:15
@neboat
Copy link
Collaborator

neboat commented Oct 17, 2024

This change helps in many ways, but it also seems to hurt some other behaviors.

With most of the examples I tried before, the mapping between the identity and reduce functions in cilk_reducer is recognized.

However, in several examples, including the following two with a non-primitive view types, the view type itself isn't getting recognized and mapped correctly:

With cilk_reducer:
image

Without cilk_reducer:
image

Second example, with cilk_reducer:
image

Second example, without cilk_reducer:
image

Some type aliases show additional problems. In the second example above, I also noticed that, although clangd finds the use of Bag<T>::identity and Bag<T>::reduce inside cilk_reducer from the definitions of those functions, the other direction does not work. In other words, clangd cannot find the definition of Bag<T>::identity or Bag<T>::reduce from their use inside cilk_reducer:
image

In this example, looking for the definition of the identity function inside cilk_reducer turns up something nonsensical in the same file:
image

Something similar happens in this example:
image

This second issue might be restricted to type aliases. In this example, of a reducer-variable declaration, looking up the definition from inside the cilk_reducer does work:
image

@VoxSciurorum
Copy link
Contributor Author

Identical hyperobject types are merged internally. If you write the same type twice there is only a single HyperobjectType object and it is associated with the first type description.

int cilk_reducer(id, reduce) x; /* VarDecl::getType() returns a newly allocated HyperobjecType */
int cilk_reducer(id, reduce) y; /* VarDecl::getType() returns the same pointer as the previous declaration */

The source tokens associated with the second instance of cilk_reducer are no longer reachable. I will see what can be done.

@VoxSciurorum
Copy link
Contributor Author

I improved support for using. I was not able to fix callback lookup for the second instance of a hyperobject type. The two cilk_reducer(I,R) are internally merged into a single node associated with the source location of the first instance. The TypeLoc infrastructure does not appear sufficient to fix the problem. If the current version of the pull request is better than the status quo, merge it. Otherwise I will come back to it later.

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.

2 participants