Skip to content

[libclc] Declare workitem built-ins in clc, move ptx-nvidiacl workitem built-ins into clc #144333

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wenju-he
Copy link
Contributor

Changes in this PR:

  • Declare all workitem functions in clc and opencl folders.
  • Call clc workitem function in corresponding OpenCL workitem function.
  • Move ptx-nvidiacl workitem built-in implementations into clc.
  • clc_get_global_offset, clc_get_enqueued_num_sub_groups, clc_get_enqueued_local_size and clc_get_work_dim are not implemented because it is not possible to provide generic implementation.
  • Include only needed headers in OpenCL workitem functions.
  • Add a FIXME to OpenCL get_global_id.cl.

Note opencl/lib/ptx-nvidiacl/workitem/get_global_id.cl isn't changed because it has different implementation from generic. llvm-diff shows this PR only adds a dozen new symbols to amdgcn--amdhsa.bc and nvptx64--nvidiacl.bc.

…m built-ins into clc

Changes in this PR:
* Declare all workitem functions in clc and opencl folders.
* Call clc workitem function in corresponding OpenCL workitem function.
* Move ptx-nvidiacl workitem built-in implementations into clc.
* clc_get_global_offset, clc_get_enqueued_num_sub_groups,
  clc_get_enqueued_local_size and clc_get_work_dim are not implemented
  because it is not possible to provide generic implementation.
* Include only needed headers in OpenCL workitem functions.
* Add a FIXME to OpenCL get_global_id.cl.

Note opencl/lib/ptx-nvidiacl/workitem/get_global_id.cl isn't changed
because it has different implementation from generic.
llvm-diff shows this PR only adds a dozen new symbols to
amdgcn--amdhsa.bc and nvptx64--nvidiacl.bc.
@wenju-he wenju-he requested a review from frasercrmck June 16, 2025 11:36
@frasercrmck frasercrmck added the libclc libclc OpenCL library label Jun 16, 2025

#include <clc/internal/clc.h>

_CLC_OVERLOAD _CLC_DECL size_t clc_get_enqueued_local_size(uint dim);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this (and the rest) be prefixed with __? Like __clc_get_enqueued_local_size?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this (and the rest) be prefixed with __? Like __clc_get_enqueued_local_size?

done in 3bab4ee, thanks

@wenju-he wenju-he requested a review from frasercrmck June 17, 2025 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libclc libclc OpenCL library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants