Skip to content

[SYCL] Fix __divdc3 declaration for SYCL device#21745

Open
jinge90 wants to merge 29 commits intointel:syclfrom
jinge90:fix_divdc3_abi_mismatch
Open

[SYCL] Fix __divdc3 declaration for SYCL device#21745
jinge90 wants to merge 29 commits intointel:syclfrom
jinge90:fix_divdc3_abi_mismatch

Conversation

@jinge90
Copy link
Copy Markdown
Contributor

@jinge90 jinge90 commented Apr 13, 2026

No description provided.

Signed-off-by: jinge90 <ge.jin@intel.com>
Signed-off-by: jinge90 <ge.jin@intel.com>
Copy link
Copy Markdown
Contributor

@bader bader left a comment

Choose a reason for hiding this comment

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

Can you write a test to catch this kind of error?

@github-actions
Copy link
Copy Markdown
Contributor

@intel/llvm-gatekeepers please consider merging

Signed-off-by: jinge90 <ge.jin@intel.com>
@jinge90
Copy link
Copy Markdown
Contributor Author

jinge90 commented Apr 15, 2026

Can you write a test to catch this kind of error?

Hi, @bader
I added explicit declarations for __mulsc3, __muldc3, __divsc3, __divdc3 in current test code.
Before the fix, building std::complex e2e test, will lead to:
./complex_utils.hpp:14:20: error: conflicting types for '__divdc3'
14 | double complex __divdc3(double a, double b, double c, double d);
| ^
../llvm/build/install/bin/../include/sycl/stl_wrappers/cmath:219:54: note: previous declaration is here
219 | extern __DPCPP_SYCL_EXTERNAL_LIBC double complex __divdc3(float a,
| ^
1 error generated.

After the fix, no warning or compilation error happens.
Is thik OK to you?
Thanks very much.

@bader
Copy link
Copy Markdown
Contributor

bader commented Apr 15, 2026

Can you write a test to catch this kind of error?

Hi, @bader I added explicit declarations for __mulsc3, __muldc3, __divsc3, __divdc3 in current test code. Before the fix, building std::complex e2e test, will lead to: ./complex_utils.hpp:14:20: error: conflicting types for '__divdc3' 14 | double complex __divdc3(double a, double b, double c, double d); | ^ ../llvm/build/install/bin/../include/sycl/stl_wrappers/cmath:219:54: note: previous declaration is here 219 | extern __DPCPP_SYCL_EXTERNAL_LIBC double complex __divdc3(float a, | ^ 1 error generated.

After the fix, no warning or compilation error happens. Is thik OK to you? Thanks very much.

Adding GLIBC declarations to the test doesn't sound right to me.
Can't we just compile the test with -Werror=narrowing? If I understand correctly, w/o your fix std::complex<double> division uses 32-bit FP data types instead of 64-bit. I hope we can catch this issue withe compiler diagnostics.

Comment thread sycl/test-e2e/DeviceLib/complex_utils.hpp Outdated
jinge90 added 3 commits April 16, 2026 15:44
Signed-off-by: jinge90 <ge.jin@intel.com>
Signed-off-by: jinge90 <ge.jin@intel.com>
Signed-off-by: jinge90 <ge.jin@intel.com>
@jinge90
Copy link
Copy Markdown
Contributor Author

jinge90 commented Apr 16, 2026

Can you write a test to catch this kind of error?

Hi, @bader I added explicit declarations for __mulsc3, __muldc3, __divsc3, __divdc3 in current test code. Before the fix, building std::complex e2e test, will lead to: ./complex_utils.hpp:14:20: error: conflicting types for '__divdc3' 14 | double complex __divdc3(double a, double b, double c, double d); | ^ ../llvm/build/install/bin/../include/sycl/stl_wrappers/cmath:219:54: note: previous declaration is here 219 | extern __DPCPP_SYCL_EXTERNAL_LIBC double complex __divdc3(float a, | ^ 1 error generated.
After the fix, no warning or compilation error happens. Is thik OK to you? Thanks very much.

Adding GLIBC declarations to the test doesn't sound right to me. Can't we just compile the test with -Werror=narrowing? If I understand correctly, w/o your fix std::complex<double> division uses 32-bit FP data types instead of 64-bit. I hope we can catch this issue withe compiler diagnostics.

Hi, @bader
I find -Werror=narrowing can't work but -Werror=implicit-float-conversion does work, add a new test in sycl/test/regression/ ,could you help review it?
Thanks very much.

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.

3 participants