-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL][E2E] Split vector scalar operator ordering test
This commit splits the vec_binary_scalar_order test to improve coverage and reduce the compile-time overhead. Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
- Loading branch information
1 parent
3d9664a
commit f4fba4e
Showing
5 changed files
with
172 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
sycl/test-e2e/Basic/vector/vec_binary_scalar_order_arith.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// REQUIRES: preview-breaking-changes-supported | ||
// RUN: %{build} -fpreview-breaking-changes -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
// This test currently fails on AMD HIP due to an unresolved memcmp function. | ||
// XFAIL: hip_amd | ||
|
||
// Checks scalar/vec arithmetic operator ordering. | ||
|
||
#include "vec_binary_scalar_order.hpp" | ||
|
||
#define CHECK_SIZES_AND_COMMON_OPS(Q, C, T) \ | ||
CHECK_SIZES(Q, Failures, T, false, +) \ | ||
CHECK_SIZES(Q, Failures, T, false, -) \ | ||
CHECK_SIZES(Q, Failures, T, false, /) \ | ||
CHECK_SIZES(Q, Failures, T, false, *) | ||
#define CHECK_SIZES_AND_INT_ONLY_OPS(Q, C, T) \ | ||
CHECK_SIZES(Q, Failures, T, false, %) | ||
|
||
int main() { | ||
sycl::queue Q; | ||
int Failures = 0; | ||
|
||
// Check operators on types with requirements if they are supported. | ||
if (Q.get_device().has(sycl::aspect::fp16)) { | ||
CHECK_SIZES_AND_COMMON_OPS(Q, Failures, sycl::half); | ||
} | ||
if (Q.get_device().has(sycl::aspect::fp64)) { | ||
CHECK_SIZES_AND_COMMON_OPS(Q, Failures, double); | ||
} | ||
|
||
// Check all operators without requirements. | ||
CHECK_SIZES_AND_COMMON_OPS(Q, Failures, float); | ||
CHECK_SIZES_AND_COMMON_OPS(Q, Failures, int8_t); | ||
CHECK_SIZES_AND_COMMON_OPS(Q, Failures, int16_t); | ||
CHECK_SIZES_AND_COMMON_OPS(Q, Failures, int32_t); | ||
CHECK_SIZES_AND_COMMON_OPS(Q, Failures, int64_t); | ||
CHECK_SIZES_AND_COMMON_OPS(Q, Failures, uint8_t); | ||
CHECK_SIZES_AND_COMMON_OPS(Q, Failures, uint16_t); | ||
CHECK_SIZES_AND_COMMON_OPS(Q, Failures, uint32_t); | ||
CHECK_SIZES_AND_COMMON_OPS(Q, Failures, uint64_t); | ||
|
||
// Check integer only operators. | ||
CHECK_SIZES_AND_INT_ONLY_OPS(Q, Failures, int8_t); | ||
CHECK_SIZES_AND_INT_ONLY_OPS(Q, Failures, int16_t); | ||
CHECK_SIZES_AND_INT_ONLY_OPS(Q, Failures, int32_t); | ||
CHECK_SIZES_AND_INT_ONLY_OPS(Q, Failures, int64_t); | ||
CHECK_SIZES_AND_INT_ONLY_OPS(Q, Failures, uint8_t); | ||
CHECK_SIZES_AND_INT_ONLY_OPS(Q, Failures, uint16_t); | ||
CHECK_SIZES_AND_INT_ONLY_OPS(Q, Failures, uint32_t); | ||
CHECK_SIZES_AND_INT_ONLY_OPS(Q, Failures, uint64_t); | ||
return Failures; | ||
} |
33 changes: 33 additions & 0 deletions
33
sycl/test-e2e/Basic/vector/vec_binary_scalar_order_bitwise.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// REQUIRES: preview-breaking-changes-supported | ||
// RUN: %{build} -fpreview-breaking-changes -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
// This test currently fails on AMD HIP due to an unresolved memcmp function. | ||
// XFAIL: hip_amd | ||
|
||
// Checks scalar/vec bitwise operator ordering. | ||
|
||
#include "vec_binary_scalar_order.hpp" | ||
|
||
#define CHECK_SIZES_AND_OPS(Q, C, T) \ | ||
CHECK_SIZES(Q, Failures, T, false, >>) \ | ||
CHECK_SIZES(Q, Failures, T, false, <<) \ | ||
CHECK_SIZES(Q, Failures, T, false, &) \ | ||
CHECK_SIZES(Q, Failures, T, false, |) \ | ||
CHECK_SIZES(Q, Failures, T, false, ^) | ||
|
||
int main() { | ||
sycl::queue Q; | ||
int Failures = 0; | ||
|
||
// Check operators. | ||
CHECK_SIZES_AND_OPS(Q, Failures, int8_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, int16_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, int32_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, int64_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, uint8_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, uint16_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, uint32_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, uint64_t); | ||
return Failures; | ||
} |
39 changes: 39 additions & 0 deletions
39
sycl/test-e2e/Basic/vector/vec_binary_scalar_order_logical.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// REQUIRES: preview-breaking-changes-supported | ||
// RUN: %{build} -fpreview-breaking-changes -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
// This test currently fails on AMD HIP due to an unresolved memcmp function. | ||
// XFAIL: hip_amd | ||
|
||
// Checks scalar/vec logical operator ordering. | ||
|
||
#include "vec_binary_scalar_order.hpp" | ||
|
||
#define CHECK_SIZES_AND_OPS(Q, C, T) \ | ||
CHECK_SIZES(Q, Failures, T, true, &&) \ | ||
CHECK_SIZES(Q, Failures, T, true, ||) | ||
|
||
int main() { | ||
sycl::queue Q; | ||
int Failures = 0; | ||
|
||
// Check operators on types with requirements if they are supported. | ||
if (Q.get_device().has(sycl::aspect::fp16)) { | ||
CHECK_SIZES_AND_OPS(Q, Failures, sycl::half); | ||
} | ||
if (Q.get_device().has(sycl::aspect::fp64)) { | ||
CHECK_SIZES_AND_OPS(Q, Failures, double); | ||
} | ||
|
||
// Check all operators without requirements. | ||
CHECK_SIZES_AND_OPS(Q, Failures, float); | ||
CHECK_SIZES_AND_OPS(Q, Failures, int8_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, int16_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, int32_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, int64_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, uint8_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, uint16_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, uint32_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, uint64_t); | ||
return Failures; | ||
} |
44 changes: 44 additions & 0 deletions
44
sycl/test-e2e/Basic/vector/vec_binary_scalar_order_relational.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// REQUIRES: preview-breaking-changes-supported | ||
// RUN: %{build} -fpreview-breaking-changes -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
// This test currently fails on AMD HIP due to an unresolved memcmp function. | ||
// XFAIL: hip_amd | ||
|
||
// Checks scalar/vec relational operator ordering. | ||
|
||
#include "vec_binary_scalar_order.hpp" | ||
|
||
// NOTE: For the sake of compile-time we pick only a few operators per category. | ||
#define CHECK_SIZES_AND_OPS(Q, C, T) \ | ||
CHECK_SIZES(Q, Failures, T, true, ==) \ | ||
CHECK_SIZES(Q, Failures, T, true, !=) \ | ||
CHECK_SIZES(Q, Failures, T, true, <) \ | ||
CHECK_SIZES(Q, Failures, T, true, >) \ | ||
CHECK_SIZES(Q, Failures, T, true, <=) \ | ||
CHECK_SIZES(Q, Failures, T, true, >=) | ||
|
||
int main() { | ||
sycl::queue Q; | ||
int Failures = 0; | ||
|
||
// Check operators on types with requirements if they are supported. | ||
if (Q.get_device().has(sycl::aspect::fp16)) { | ||
CHECK_SIZES_AND_OPS(Q, Failures, sycl::half); | ||
} | ||
if (Q.get_device().has(sycl::aspect::fp64)) { | ||
CHECK_SIZES_AND_OPS(Q, Failures, double); | ||
} | ||
|
||
// Check all operators without requirements. | ||
CHECK_SIZES_AND_OPS(Q, Failures, float); | ||
CHECK_SIZES_AND_OPS(Q, Failures, int8_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, int16_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, int32_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, int64_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, uint8_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, uint16_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, uint32_t); | ||
CHECK_SIZES_AND_OPS(Q, Failures, uint64_t); | ||
return Failures; | ||
} |