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

[SYCL] Add E2E test for -foffload-fp32-prec-div/sqrt #17037

Open
wants to merge 4 commits into
base: sycl
Choose a base branch
from

Conversation

MrSidims
Copy link
Contributor

@MrSidims MrSidims commented Feb 17, 2025

Supporting doc: #17033

Signed-off-by: Sidorov, Dmitry <[email protected]>
@MrSidims MrSidims marked this pull request as ready for review February 17, 2025 15:34
@MrSidims MrSidims requested a review from a team as a code owner February 17, 2025 15:34
@MrSidims
Copy link
Contributor Author

@intel/llvm-reviewers-runtime please take a look

return std::fmin(negative, positive);
}

template <typename T> int ulp_difference(const T &lhs, const T &rhs) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does it return int?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The intention was to remove ulps diff as an integer, but implicit cast was undesired here (and actually was wrong). I've simplified the function.

Signed-off-by: Sidorov, Dmitry <[email protected]>
@MrSidims
Copy link
Contributor Author

CUDA results:
Failed Tests (1):
SYCL :: DeviceLib/built-ins/offload-prec-div-sqrt.cpp

guess I first need this patch to be merged #17044

Comment on lines 15 to 16
int32_t lhsInt = *reinterpret_cast<int32_t *>(&lhs);
int32_t rhsInt = *reinterpret_cast<int32_t *>(&rhs);
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be std::bit_cast to avoid UB.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Applied, but do we enable C++20?

#include <sycl/usm.hpp>

constexpr float value = 560.0f;
constexpr float divider = 280.0f;
Copy link
Contributor

Choose a reason for hiding this comment

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

This test of division is 560/280 ? That has an exact solution ( 2 ) . I know the float number space is sparse, but is 560 / 280 really a test that'll result in a measurable ULP difference? Wouldn't 279 be a better divider?

Signed-off-by: Sidorov, Dmitry <[email protected]>
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