Skip to content

[SYCL] Add support for free function kernel builtins #15938

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

Merged
merged 5 commits into from
Dec 11, 2024

Conversation

premanandrao
Copy link
Contributor

Support for the following three builtins are added: __builtin_sycl_is_single_task_kernel(function-pointer) __builtin_sycl_is_nd_range_kernel(function-pointer, dimension) __builtin_sycl_is_kernel(function-pointer)

__builtin_sycl_is_single_task_kernel returns true if the function pointer represents a function with the IR attribute "sycl-single-task-kernel".

__builtin_sycl_is_nd_range_kernel returns true if the function pointer represents a function with the IR attribute "sycl-single-task-kernel" with a matching dimension.

__builtin_sycl_is_kernel returns true if the function pointer represents a function with either of the two IR attributes.

Support for the following three builtins are added:
__builtin_sycl_is_single_task_kernel(function-pointer)
__builtin_sycl_is_nd_range_kernel(function-pointer, dimension)
__builtin_sycl_is_kernel(function-pointer)

__builtin_sycl_is_single_task_kernel returns true if the function
pointer represents a function with the IR attribute
"sycl-single-task-kernel".

__builtin_sycl_is_nd_range_kernel returns true if the function
pointer represents a function with the IR attribute
"sycl-single-task-kernel" with a matching dimension.

__builtin_sycl_is_kernel returns true if the function pointer
represents a function with either of the two IR attributes.
Copy link
Contributor

@elizabethandrews elizabethandrews left a comment

Choose a reason for hiding this comment

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

Sorry for the delay in review. This one slipped through the cracks

.getZExtValue();
// Return true only if the dimensions match.
if (std::stoul(NVPair.second) == Dim)
return RValue::get(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain what passing the type to the getTrue( ) API does here? Is it possible to just return 0 or 1 if you are converting to ConstantInt anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not that familiar with this - but passing the type makes the function return a true value in the context of the type. There is another interface for getTrue, but it takes the LLVM context as its argument and returns a true value in that context. Passing the type made more sense and that is what other builtins seem to do too.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for explaining

@premanandrao
Copy link
Contributor Author

@intel/llvm-gatekeepers, this PR may be merged. Thanks.

@sarnex sarnex merged commit 960f71a into intel:sycl Dec 11, 2024
13 checks passed
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.

4 participants