Skip to content

Reconsider parameter passing in outlined function #148

@ouankou

Description

@ouankou

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions