Skip to content

[libclc] Improving vector code generated from scalar code #140008

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
May 16, 2025

Conversation

wenju-he
Copy link
Contributor

The previous method splits vector data into two halves. shuffle_vector concatenates the two results into a vector data of original size. This PR eliminates the use of shuffle_vector.

The previous method splits vector data into two halves. shuffle_vector
concatenates the two results into a vector data of original size.
This PR eliminates the use of shuffle_vector.
@wenju-he
Copy link
Contributor Author

@frasercrmck please help to review, thanks.

Copy link
Contributor

@frasercrmck frasercrmck left a comment

Choose a reason for hiding this comment

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

LGTM. I don't think there's any reason to recursively split like this when we only provide the scalar case.

IIRC downstream we have some "have-2" variants of these macros where this splitting might be helpful, as explicitly providing a vector2 form indicates it might be more optimal to use that as the base case. But that's not for here!

I'd also like to rename those macros at some point as I think they obfuscate the kind of vectorization (basically, scalarization) going on.

#define s4 2.66422703033638609560e-02 /* 0x3F9B481C, 0x7E939961 */
#define s5 1.84028451407337715652e-03 /* 0x3F5E26B6, 0x7368F239 */
#define s6 3.19475326584100867617e-05 /* 0x3F00BFEC, 0xDD17E945 */
#define s0_d -7.72156649015328655494e-02 /* 0xBFB3C467, 0xE37DB0C8 */
Copy link
Contributor

Choose a reason for hiding this comment

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

hah.

@wenju-he
Copy link
Contributor Author

I'd also like to rename those macros at some point as I think they obfuscate the kind of vectorization (basically, scalarization) going on.

LGTM

thanks @frasercrmck for the review. Please help to merge, thanks.

@frasercrmck frasercrmck merged commit 299a278 into llvm:main May 16, 2025
10 checks passed
@wenju-he wenju-he deleted the libclc-VECTORIZE-macro branch May 16, 2025 09:23
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.

2 participants