-
Notifications
You must be signed in to change notification settings - Fork 79
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
sycl::mix testing is problematic #835
Comments
WG discussed this, and are working on the resolution. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sycl::mix
testing is both overly strict, and insufficiently wide.sycl::mix
is specified ashttps://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#_common_functions
This is tested in the CTS by making sure that we are within 1 ULP of
x + (y - x) * a
for randomized inputs between 0.1 and 0.9.The first problem here is that the SYCL specification uses a blend of mathematical expressions and C++ expressions without specifying which is which, almost certainly this is meant to be taken as a mostly-mathematical expression (see e.g.
degrees
, where the vector version is specified as returning(180 / π) * radians[i]
, which clearly cannot be a C++ expression), the C++ expressionx + (y - x) * a
is not (in general) within 1 ULP of the mathematical result rounded suitably to the appropriate C++ floating point type, and the C++ expressionx + (y - x) * a
is not (in general) a good implementation.mix
was added to C++20 asstd::lerp
(except without the restriction on0 <= a <= 1
) and this was carefully considered at that time. In P0811R3: Well-behaved interpolation for numbers and pointers, S. Davis Herring writes:It goes on to list properties that are desired for
std::lerp
, including these. By testing thatmix
is within 1 ULP of a reference implementation that is known to not generally be useful, the CTS requires an implementation ofmix
that is not generally useful.Additionally, in OpenCL, single-precision
mix
is specified as "absolute error tolerance of 1e-3" (full profile) or "Implementation-defined" (embedded profile). A stricter check formix
than what OpenCL specifies implies that asycl::mix
implementation that defers to OpenCLmix
cannot, in general, pass the SYCL CTS, which seems undesirable.The second problem here is that by only testing values between 0.1 and 0.9, the worst problems with this reference implementation never even come up during CTS tests and go unnoticed, both in the CTS itself and in implementations that take guidance from the CTS.
The text was updated successfully, but these errors were encountered: