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][COMPAT] Add vectorized_ternary and vectorized_with_pred. #15550

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

Conversation

tangjj11
Copy link
Contributor

Add vectorized_ternary and vectorized_with_pred.
Update relu and vectorized_binary.

Signed-off-by: Tang, Jiajun jiajun.tang@intel.com

Add vectorized_ternary and vectorized_with_pred.
Update relu and vectorized_binary.

Signed-off-by: Tang, Jiajun jiajun.tang@intel.com
@tangjj11 tangjj11 requested a review from a team as a code owner September 30, 2024 08:29
@Alcpz Alcpz added the syclcompat Issues related to SYCLcompat label Oct 1, 2024
Copy link
Contributor

@Alcpz Alcpz left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution to the headers and for extending the testing helpers. I've left a few comments.

return {relu(a[0]), relu(a[1])};
sycl::vec<ValueT, NumElements>>
relu(const sycl::vec<ValueT, NumElements> a) {
sycl::vec<T, NumElements> ret;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
sycl::vec<T, NumElements> ret;
sycl::vec<ValueT, NumElements> ret;

const auto v1 = sycl::vec<unsigned, 1>(a).as<VecT>();
const auto v2 = sycl::vec<unsigned, 1>(b).as<VecT>();
const auto v3 = sycl::vec<unsigned, 1>(c).as<VecT>();
auto temp =
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Can we rename temp to v4 for consistency with the vectorized_binary implementation?

test_vectorized_with_pred<syclcompat::maximum, uint32_t>(
0x00010002, 0x00040002, 0x00030000, &pred_hi, &pred_lo);
test_vectorized_with_pred<syclcompat::minimum, uint32_t>(
0x00010002, 0x00040002, 0x00030000, &pred_hi, &pred_lo);
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that the values of the predicates are not tested. Could you please ensure they are right?

test_vectorized_ternary<syclcompat::minimum, syclcompat::minimum, uint32_t>(
0x00010002, 0x00040002, 0x00080004, 0x00030000);
test_vectorized_ternary<syclcompat::minimum, syclcompat::minimum, uint32_t>(
0x00010002, 0x00040002, 0x00080004, 0x00030000, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels strange that all the new tests return the same values with the same operators despite the operations being different. Could you please double check if that is the case?

@@ -101,6 +146,27 @@ int main() {
0xFFF8FFFD);
test_vectorized_unary<syclcompat::abs, uint32_t>(0xFFFBFFFD, 0x00050003);
test_vectorized_sum_abs_diff<uint32_t>(0x00010002, 0x00040002, 0x00000003);
Copy link
Contributor

Choose a reason for hiding this comment

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

While the vectorized_binary with relu is being tested through the vectorized_ternary, It could be good to have at least a case testing that the relu is working as intended with vectorized_binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
syclcompat Issues related to SYCLcompat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants