Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL][Matrix] test the two features: fill a matrix and element wise operations #645

Merged
merged 7 commits into from
Jan 7, 2022

Conversation

dkhaldi
Copy link

@dkhaldi dkhaldi commented Dec 20, 2021

Two new matrix features are being added to the DPC++ compiler namely: fill a matrix and element wise operations. This PR adds tests for these two features.

Signed-off-by: Dounia Khaldi [email protected]

@vladimirlaz
Copy link

*vector_relational test failure is unrelated and can be ignored.

vladimirlaz
vladimirlaz previously approved these changes Dec 21, 2021

big_matrix<int32_t, MATRIX_M, MATRIX_N> MC((int32_t *)&C);
big_matrix<int32_t, MATRIX_M, MATRIX_N> MD((int32_t *)&D);
big_matrix<int8_t, MATRIX_M, MATRIX_K> MA((int8_t *)&A);

Choose a reason for hiding this comment

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

I think we should have a test with other types too, with sycl::half for example.

}
auto wi_slice_c = sub_c.get_wi_data();
for (int i = 0; i < wi_slice_c.length(); i++) {
wi_slice_c[i] *= 2;

Choose a reason for hiding this comment

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

Other operations (+=, /=, <<=, %=, .. see the full list here) and syntax (wi_slice_c[i] = wi_slice_c[i] * 2) should be covered.

@dkhaldi dkhaldi requested a review from a team as a code owner January 6, 2022 02:16
@dkhaldi dkhaldi requested a review from cperkinsintel January 6, 2022 20:55
@cperkinsintel
Copy link

@dkhaldi is there a matching PR on intel/llvm that implements these new matrix features?

@@ -11,6 +11,8 @@
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out

// XFAIL: *

Choose a reason for hiding this comment

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

If this is just always going to fail, is there any plan to fix or support it? If so, it would be good to mention it in a comment, otherwise someone may just remove this test.

Copy link
Author

@dkhaldi dkhaldi Jan 7, 2022

Choose a reason for hiding this comment

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

I added xfail because the test will fail until two internal patches that are currently under review get merged.
Once all the patches are in, I will remove xfail.
I just double checked with @yuxianch, the test should be marked as xfail.

But I will add a comment as you suggested

@dkhaldi
Copy link
Author

dkhaldi commented Jan 7, 2022

@dkhaldi is there a matching PR on intel/llvm that implements these new matrix features?

These two features have been implemented. See intel/llvm#4979 for the slicing and intel/llvm#4994 for fill.
However, there are two more patches coming to add the missing operators and one bug fix to be composed by @yubingex007-a11y .

@dkhaldi
Copy link
Author

dkhaldi commented Jan 7, 2022

@cperkinsintel is SYCL :: KernelAndProgram/multiple-kernel-linking.cpp a known fail test?

Copy link

@yubingex007-a11y yubingex007-a11y left a comment

Choose a reason for hiding this comment

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

LGTM

@dkhaldi
Copy link
Author

dkhaldi commented Jan 7, 2022

@intel/llvm-reviewers-runtime ping to merge as this needs to be cherrypicked to the internal repo as well

Copy link

@cperkinsintel cperkinsintel 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 links to the PRs that introduce the new features. This LGTM.

@pvchupin pvchupin merged commit 6e868ff into intel:intel Jan 7, 2022
if (wi_slice_a[i]) {
if (wi_slice_a[i] > 2.0 || wi_slice_a[i] >= 2.0 ||
wi_slice_a[i] < 2.0 || wi_slice_a[i] <= 2.0) {
T val = (wi_slice_a[i] != 2.0) ? wi_slice_a[i] : 2.0;
Copy link

@yubingex007-a11y yubingex007-a11y Jan 11, 2022

Choose a reason for hiding this comment

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

I think we should change the testcase according to the rules of "?: " and use static_cast for ternary operator in our code.

If the types of the second and third operands are not identical, then complex type conversion rules, as specified in the C++ Standard, are invoked. These conversions may lead to unexpected behavior including construction and destruction of temporary objects. For this reason, we strongly advise you to either (1) avoid using user-defined types as operands with the conditional operator or (2) if you do use user-defined types, then explicitly cast each operand to a common type.

if (wi_slice_a[i]) {
if (wi_slice_a[i] > 2.0 || wi_slice_a[i] >= 2.0 ||
wi_slice_a[i] < 2.0 || wi_slice_a[i] <= 2.0) {
T val = (wi_slice_a[i] != 2.0) ? wi_slice_a[i] : 2.0;

Choose a reason for hiding this comment

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

Suggested change
T val = (wi_slice_a[i] != 2.0) ? wi_slice_a[i] : 2.0;
T val = (wi_slice_a[i] != 2.0) ? wi_slice_a[i] : static_cast<half>(2.0);

Copy link
Author

@dkhaldi dkhaldi Jan 11, 2022

Choose a reason for hiding this comment

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

@yubingex007-a11y thank you for fixing the two bugs related to fill and slicing when type deduction confusion happens, I made this change in a separate PR #727.

myler pushed a commit to myler/llvm-test-suite that referenced this pull request Apr 12, 2022
…operations (intel#645)

Two new matrix features are being added to the DPC++ compiler namely: fill a matrix and element wise operations. This PR adds tests for these two features.

Signed-off-by: Dounia Khaldi [email protected]
aelovikov-intel pushed a commit to aelovikov-intel/llvm that referenced this pull request Mar 27, 2023
…operations (intel/llvm-test-suite#645)

Two new matrix features are being added to the DPC++ compiler namely: fill a matrix and element wise operations. This PR adds tests for these two features.

Signed-off-by: Dounia Khaldi [email protected]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants