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

Reconsider parameter passing in outlined function #148

Open
ouankou opened this issue Jan 6, 2023 · 0 comments
Open

Reconsider parameter passing in outlined function #148

ouankou opened this issue Jan 6, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@ouankou
Copy link
Contributor

ouankou commented Jan 6, 2023

Currently, to outline a GPU kernel, we pass variables by pointer regardless and then dereference them. Therefore, symbol renaming is always required. However, this is only sometimes necessary. If we pass a private variable that won't be shared between threads, we can pass them by value. Then the outlined kernel doesn't have to rename them.
For shared variables and arrays, we still pass them by the pointer.

To sum up:

  • private: No need to pass anything to the kernel. Declare a local variable using the original name without initialization.
  • fistprivate: Pass the original value to the kernel using a different name. Declare a local variable using the original name, which is initialized with passed value.
  • shared: Pass the original variable by pointer. It needs renaming.
  • lastprivate: The same as shared. We need to store the final value back to the original variable.
  • map: We can use the original name for arrays. But for scalars, it may need to be shared between different kernels. In that case, they need renaming like shared clause.
@ouankou ouankou added the enhancement New feature or request label Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant