Skip to content

[libclc] Use CLC conversion builtins in CLC functions #127628

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 1 commit into from
Feb 18, 2025

Conversation

frasercrmck
Copy link
Contributor

This commit is a broad update across libclc to use the CLC conversion builtins in CLC functions, even those with a '__clc' prefix in the generic folder. This better prepares them for an official move to the CLC library in time.

The CLC conversion builtins have an additional benefit in that they support scalars, unlike the __builtin_convertvector builtin which we were using previously. This allows us to simplify some shared definitions.

There is one change to the IR, in the scalar upsample(char, uchar) builtin. It now sign-extends the first argument to i16, where before it zero-extended it. This appears to be correct, and matches the vector behaviour.

This commit is a broad update across libclc to use the CLC conversion
builtins in CLC functions, even those with a '__clc' prefix in the
generic folder. This better prepares them for an official move to the
CLC library in time.

The CLC conversion builtins have an additional benefit in that they
support scalars, unlike the __builtin_convertvector builtin which we
were using previously. This allows us to simplify some shared
definitions.

There is one change to the IR, in the scalar upsample(char, uchar)
builtin. It now sign-extends the first argument to i16, where before it
zero-extended it. This appears to be correct, and matches the vector
behaviour.
@frasercrmck frasercrmck added the libclc libclc OpenCL library label Feb 18, 2025
@frasercrmck frasercrmck requested a review from arsenm February 18, 2025 13:14
@frasercrmck frasercrmck merged commit df12bad into llvm:main Feb 18, 2025
10 checks passed
@frasercrmck frasercrmck deleted the libclc-clc-conversions-update branch February 18, 2025 14:52
wldfngrs pushed a commit to wldfngrs/llvm-project that referenced this pull request Feb 19, 2025
This commit is a broad update across libclc to use the CLC conversion
builtins in CLC functions, even those with a '__clc' prefix in the
generic folder. This better prepares them for an official move to the
CLC library in time.

The CLC conversion builtins have an additional benefit in that they
support scalars, unlike the __builtin_convertvector builtin which we
were using previously. This allows us to simplify some shared
definitions.

There is one change to the IR, in the scalar upsample(char, uchar)
builtin. It now sign-extends the first argument to i16, where before it
zero-extended it. This appears to be correct, and matches the vector
behaviour.
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