-
Notifications
You must be signed in to change notification settings - Fork 823
[SYCL][E2E] Add test to cover std::complex<float/double> mul/div #21622
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
Changes from all commits
2d50750
9c76946
fe628a9
7a7e62b
4de8fa5
e52bb98
4b63322
544d912
2ad6143
cf391d9
e0f2a15
aa7a97c
9244680
b4b5793
50f8f75
ebc7166
159748c
17362e0
9e38387
dd1e30b
01fa557
08ff3e3
bc9a08e
2102954
a7d4c12
5f7adec
1a15fd8
fc65987
a30bd8d
b5938c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,376 @@ | ||||||||||||||||||||||||||||||||||
| #pragma once | ||||||||||||||||||||||||||||||||||
| #include <array> | ||||||||||||||||||||||||||||||||||
| #include <cmath> | ||||||||||||||||||||||||||||||||||
| #include <complex> | ||||||||||||||||||||||||||||||||||
| #include <sycl/detail/core.hpp> | ||||||||||||||||||||||||||||||||||
| enum { zero, non_zero, inf, NaN, non_zero_nan }; | ||||||||||||||||||||||||||||||||||
| template <typename T> int complex_classify(std::complex<T> x) { | ||||||||||||||||||||||||||||||||||
| if (x == std::complex<T>(0, 0)) | ||||||||||||||||||||||||||||||||||
| return zero; | ||||||||||||||||||||||||||||||||||
| if (std::isinf(x.real()) || std::isinf(x.imag())) | ||||||||||||||||||||||||||||||||||
| return inf; | ||||||||||||||||||||||||||||||||||
| if (std::isnan(x.real()) && std::isnan(x.imag())) | ||||||||||||||||||||||||||||||||||
| return NaN; | ||||||||||||||||||||||||||||||||||
| if (std::isnan(x.real())) { | ||||||||||||||||||||||||||||||||||
| if (x.imag() == 0) | ||||||||||||||||||||||||||||||||||
| return NaN; | ||||||||||||||||||||||||||||||||||
| return non_zero_nan; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| if (std::isnan(x.imag())) { | ||||||||||||||||||||||||||||||||||
| if (x.real() == 0) | ||||||||||||||||||||||||||||||||||
| return NaN; | ||||||||||||||||||||||||||||||||||
| return non_zero_nan; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return non_zero; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| template <typename T> | ||||||||||||||||||||||||||||||||||
| int complex_compare_mul(std::complex<T> x, std::complex<T> y, | ||||||||||||||||||||||||||||||||||
| std::complex<T> z) { | ||||||||||||||||||||||||||||||||||
| switch (complex_classify<T>(x)) { | ||||||||||||||||||||||||||||||||||
| case zero: | ||||||||||||||||||||||||||||||||||
| switch (complex_classify<T>(y)) { | ||||||||||||||||||||||||||||||||||
| case zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != zero) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != zero) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case inf: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case NaN: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero_nan: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero: | ||||||||||||||||||||||||||||||||||
| switch (complex_classify<T>(y)) { | ||||||||||||||||||||||||||||||||||
| case zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != zero) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != non_zero) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| T a = x.real(), b = x.imag(), c = y.real(), d = y.imag(); | ||||||||||||||||||||||||||||||||||
| std::complex<T> t(a * c - b * d, a * d + b * c); | ||||||||||||||||||||||||||||||||||
| // relaxed tolerance to arbitrary (1.e-6) amount. | ||||||||||||||||||||||||||||||||||
| if (std::abs((z - t) / z) > 1.e-6) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case inf: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != inf) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case NaN: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero_nan: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case inf: | ||||||||||||||||||||||||||||||||||
| switch (complex_classify<T>(y)) { | ||||||||||||||||||||||||||||||||||
| case zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != inf) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case inf: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != inf) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case NaN: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero_nan: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != inf) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case NaN: | ||||||||||||||||||||||||||||||||||
| switch (complex_classify<T>(y)) { | ||||||||||||||||||||||||||||||||||
| case zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case inf: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case NaN: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero_nan: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero_nan: | ||||||||||||||||||||||||||||||||||
| switch (complex_classify<T>(y)) { | ||||||||||||||||||||||||||||||||||
| case zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case inf: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != inf) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case NaN: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero_nan: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| return 0; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| template <typename T> | ||||||||||||||||||||||||||||||||||
| int complex_compare_div(std::complex<T> x, std::complex<T> y, | ||||||||||||||||||||||||||||||||||
| std::complex<T> z) { | ||||||||||||||||||||||||||||||||||
| switch (complex_classify<T>(x)) { | ||||||||||||||||||||||||||||||||||
| case zero: | ||||||||||||||||||||||||||||||||||
| switch (complex_classify<T>(y)) { | ||||||||||||||||||||||||||||||||||
| case zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != zero) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case inf: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != zero) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case NaN: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero_nan: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero: | ||||||||||||||||||||||||||||||||||
| switch (complex_classify<T>(y)) { | ||||||||||||||||||||||||||||||||||
| case zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != inf) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != non_zero) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| T a = x.real(), b = x.imag(), c = y.real(), d = y.imag(); | ||||||||||||||||||||||||||||||||||
| std::complex<T> t((a * c + b * d) / (c * c + d * d), | ||||||||||||||||||||||||||||||||||
| (b * c - a * d) / (c * c + d * d)); | ||||||||||||||||||||||||||||||||||
| if (std::abs((z - t) / z) > 1.e-6) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case inf: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != zero) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case NaN: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero_nan: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case inf: | ||||||||||||||||||||||||||||||||||
| switch (complex_classify<T>(y)) { | ||||||||||||||||||||||||||||||||||
| case zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != inf) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != inf) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case inf: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case NaN: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero_nan: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case NaN: | ||||||||||||||||||||||||||||||||||
| switch (complex_classify<T>(y)) { | ||||||||||||||||||||||||||||||||||
| case zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case inf: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case NaN: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero_nan: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero_nan: | ||||||||||||||||||||||||||||||||||
| switch (complex_classify<T>(y)) { | ||||||||||||||||||||||||||||||||||
| case zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != inf) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case inf: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case NaN: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| case non_zero_nan: | ||||||||||||||||||||||||||||||||||
| if (complex_classify<T>(z) != NaN) | ||||||||||||||||||||||||||||||||||
| return 1; | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| return 0; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| template <typename T, size_t InputSize> | ||||||||||||||||||||||||||||||||||
| int device_complex_test_mul(sycl::queue &deviceQueue, | ||||||||||||||||||||||||||||||||||
| std::complex<T> *complex_input) { | ||||||||||||||||||||||||||||||||||
| constexpr size_t OutputSize = InputSize * InputSize; | ||||||||||||||||||||||||||||||||||
| sycl::range<1> numOfMulInput{InputSize}; | ||||||||||||||||||||||||||||||||||
| sycl::range<1> numOfMulOutput{OutputSize}; | ||||||||||||||||||||||||||||||||||
| std::array<std::complex<T>, OutputSize> complex_mul_result; | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| sycl::buffer<std::complex<T>, 1> buffer_complex_mul(complex_input, | ||||||||||||||||||||||||||||||||||
| numOfMulInput); | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+300
to
+307
|
||||||||||||||||||||||||||||||||||
| std::complex<T> *complex_input) { | |
| constexpr size_t OutputSize = InputSize * InputSize; | |
| sycl::range<1> numOfMulInput{InputSize}; | |
| sycl::range<1> numOfMulOutput{OutputSize}; | |
| std::array<std::complex<T>, OutputSize> complex_mul_result; | |
| { | |
| sycl::buffer<std::complex<T>, 1> buffer_complex_mul(complex_input, | |
| numOfMulInput); | |
| const std::complex<T> *complex_input) { | |
| constexpr size_t OutputSize = InputSize * InputSize; | |
| sycl::range<1> numOfMulInput{InputSize}; | |
| sycl::range<1> numOfMulOutput{OutputSize}; | |
| std::array<std::complex<T>, OutputSize> complex_mul_result; | |
| { | |
| sycl::buffer<const std::complex<T>, 1> buffer_complex_mul(complex_input, | |
| numOfMulInput); |
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
device_complex_test_mul is a function template, but the kernel is always named DeviceComplexMulTest. If this helper ever gets instantiated more than once in the same translation unit (e.g., for both float and double, or different InputSize), the identical kernel name type can cause a SYCL kernel name collision/ODR violation. Consider making the kernel name depend on the template parameters (e.g., a templated kernel-name type) or using an unnamed kernel form if supported by the project/toolchain.
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both device_complex_test_mul/device_complex_test_div return 1 on the first mismatch and don’t report which (i,j) input pair failed or what the computed/expected values were. That makes failures hard to diagnose in CI. Consider accumulating a failure count (like the other tests in this directory) and/or printing the failing indices and values before returning.
Copilot
AI
Mar 31, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
device_complex_test_div only reads from complex_input. Consider taking const std::complex<T>* (and using a read-only buffer/accessor) to better express const-correctness.
| std::complex<T> *complex_input) { | |
| constexpr size_t OutputSize = InputSize * InputSize; | |
| sycl::range<1> numOfDivInput{InputSize}; | |
| sycl::range<1> numOfDivOutput{OutputSize}; | |
| std::array<std::complex<T>, OutputSize> complex_div_result; | |
| { | |
| sycl::buffer<std::complex<T>, 1> buffer_complex_div(complex_input, | |
| numOfDivInput); | |
| const std::complex<T> *complex_input) { | |
| constexpr size_t OutputSize = InputSize * InputSize; | |
| sycl::range<1> numOfDivInput{InputSize}; | |
| sycl::range<1> numOfDivOutput{OutputSize}; | |
| std::array<std::complex<T>, OutputSize> complex_div_result; | |
| { | |
| sycl::buffer<const std::complex<T>, 1> buffer_complex_div(complex_input, | |
| numOfDivInput); |
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
device_complex_test_div is a function template, but the kernel is always named DeviceComplexDivTest. If this helper is instantiated more than once in the same translation unit (different T/InputSize), the repeated kernel name type can cause a SYCL kernel name collision/ODR violation. Consider parameterizing the kernel-name type on the template arguments (or using an unnamed kernel form).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
complex_utils.hppusesstd::array,std::isnan, andstd::isinfbut only includes<complex>. Please add the missing standard headers (e.g.,<array>and<cmath>) so this helper is self-contained and doesn’t rely on include order in the including test files.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.