Skip to content
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

Add ldexp math built-in #962

Merged
merged 9 commits into from
May 4, 2023
Merged

Add ldexp math built-in #962

merged 9 commits into from
May 4, 2023

Conversation

nmnobre
Copy link
Member

@nmnobre nmnobre commented Mar 6, 2023

Hi @illuhad,

I think the only hard decision I had to make here has to do with the definition of HIPSYCL_BUILTIN_GENERATOR_BINARY_T_INT.
I did not template the second argument and instead explicitly locked it to int to avoid collision/ambiguity with HIPSYCL_BUILTIN_GENERATOR_BINARY_T_GENINT.
Let me know if you have something better in mind. :)

Cheers,
Nuno

@illuhad
Copy link
Collaborator

illuhad commented Mar 16, 2023

I think the only hard decision I had to make here has to do with the definition of HIPSYCL_BUILTIN_GENERATOR_BINARY_T_INT.
I did not template the second argument and instead explicitly locked it to int to avoid collision/ambiguity with HIPSYCL_BUILTIN_GENERATOR_BINARY_T_GENINT.

Can you elaborate on what your concern is here? You have the two overloads once for genint and once for int as required by the spec. Is it because there might be a collision between the explicit int overload and the genint overload in case it's called with int argument?

@nmnobre
Copy link
Member Author

nmnobre commented Mar 17, 2023

I think the only hard decision I had to make here has to do with the definition of HIPSYCL_BUILTIN_GENERATOR_BINARY_T_INT.
I did not template the second argument and instead explicitly locked it to int to avoid collision/ambiguity with HIPSYCL_BUILTIN_GENERATOR_BINARY_T_GENINT.

Can you elaborate on what your concern is here? You have the two overloads once for genint and once for int as required by the spec. Is it because there might be a collision between the explicit int overload and the genint overload in case it's called with int argument?

Yeah, if we template the second argument then, e.g. on calls where both the floating-point and the integer arguments are scalars, there’d a collision and the compiler would complain of ambiguity. Like this, that risk doesn’t exist because the compiler will always choose the most specialised template.

It wasn’t so much a concern, but rather me pointing out a design choice, so you could double check it. :) You are right this covers the spec, that’s no accident. :) But I’ve noticed that sometimes we’re a bit more lenient and allow generic integral types, not just int.

@illuhad
Copy link
Collaborator

illuhad commented Apr 3, 2023

Do you think it would make sense to also add a test case here?

@nmnobre nmnobre force-pushed the ldexp branch 15 times, most recently from 1e8e7a0 to 8086b08 Compare April 4, 2023 11:05
@nmnobre
Copy link
Member Author

nmnobre commented Apr 4, 2023

Do you think it would make sense to also add a test case here?

Done.

@nmnobre nmnobre requested a review from illuhad April 6, 2023 09:05
@illuhad
Copy link
Collaborator

illuhad commented May 3, 2023

Seems like there is an issue with vector types? https://github.com/OpenSYCL/OpenSYCL/actions/runs/4872132257/jobs/8689939849?pr=962

@nmnobre nmnobre force-pushed the ldexp branch 5 times, most recently from 0e86555 to ff62c56 Compare May 3, 2023 23:36
@nmnobre nmnobre requested a review from illuhad May 4, 2023 08:07
@nmnobre
Copy link
Member Author

nmnobre commented May 4, 2023

Seems like there is an issue with vector types? https://github.com/OpenSYCL/OpenSYCL/actions/runs/4872132257/jobs/8689939849?pr=962

Thanks, yes, this was caused by 20043bd and I adopted the suggested change there of using an explicit cast.
I've also fixed some floating-point imprecisions that were caught by the new GPU CI tests!
Should be good to go. :-)

Copy link
Collaborator

@illuhad illuhad left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! :)

@illuhad illuhad merged commit dfb6788 into AdaptiveCpp:develop May 4, 2023
17 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.

None yet

2 participants