1
- // ==------- operator_bitwise_not.cpp - DPC++ ESIMD on-device test ---------==//
1
+ // ===-- operator_bitwise_not.hpp - Functions for tests on simd assignment
2
+ // operators. --------------------------------------------------------===//
2
3
//
3
4
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
5
// See https://llvm.org/LICENSE.txt for license information.
5
6
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
7
//
7
8
// ===----------------------------------------------------------------------===//
8
- // REQUIRES: gpu, level_zero
9
- // XREQUIRES: gpu
10
- // TODO gpu and level_zero in REQUIRES due to only this platforms supported yet.
11
- // The current "REQUIRES" should be replaced with "gpu" only as mentioned in
12
- // "XREQUIRES".
13
- // UNSUPPORTED: cuda, hip
14
- // RUN: %clangxx -fsycl %s -fsycl-device-code-split=per_kernel -o %t.out
15
- // RUN: %GPU_RUN_PLACEHOLDER %t.out
16
- //
17
- // Test for simd bitwise not operator.
18
- // The test creates source simd instance with reference data and invokes bitwise
19
- // not operator.
20
- // The test verifies that data from simd is not corrupted after calling bitwise
21
- // not operator, that bitwise not operator return type is as expected and
22
- // bitwise not operator result values is correct.
9
+ // /
10
+ // / \file
11
+ // / This file provides functions for tests on simd assignment operators.
12
+ // /
13
+ // ===----------------------------------------------------------------------===//
14
+
15
+ #pragma once
23
16
24
17
#include " ../mutator.hpp"
25
18
#include " ../shared_element.hpp"
26
19
#include " common.hpp"
27
20
// For std::abs
28
21
#include < cmath>
29
22
30
- using namespace sycl ::ext::intel::experimental::esimd;
31
- using namespace esimd_test ::api::functional;
23
+ namespace esimd = sycl::ext::intel::esimd;
24
+
25
+ namespace esimd_test ::api::functional::operators {
32
26
33
- // Descriptor class for the case of calling bitwise not operator.
27
+ // Descriptor class for the case of calling bitwise not operator.
34
28
struct bitwise_not_operator {
35
29
static std::string get_description () { return " bitwise not" ; }
36
30
37
31
template <typename DataT, int NumElems>
38
32
static bool call_operator (const DataT *const ref_data,
39
33
DataT *const source_simd_result,
40
34
DataT *const operator_result) {
41
- auto simd_obj = simd<DataT, NumElems>();
35
+ auto simd_obj = esimd:: simd<DataT, NumElems>();
42
36
simd_obj.copy_from (ref_data);
43
37
auto bitwise_not_result = ~simd_obj;
44
38
simd_obj.copy_to (source_simd_result);
45
39
bitwise_not_result.copy_to (operator_result);
46
- return std::is_same_v<decltype (~simd_obj), simd<DataT, NumElems>>;
40
+ return std::is_same_v<decltype (~simd_obj), esimd:: simd<DataT, NumElems>>;
47
41
}
48
42
};
49
43
@@ -169,21 +163,5 @@ template <typename TestCaseT, typename DataT, typename DimT> class run_test {
169
163
}
170
164
};
171
165
172
- int main (int , char **) {
173
- sycl::queue queue (esimd_test::ESIMDSelector{},
174
- esimd_test::createExceptionHandler ());
175
-
176
- bool passed = true ;
177
-
178
- const auto uint_types = get_tested_types<tested_types::uint>();
179
- const auto sint_types = get_tested_types<tested_types::sint>();
180
- const auto all_dims = get_all_dimensions ();
181
-
182
- passed &= for_all_combinations<run_test, bitwise_not_operator>(
183
- uint_types, all_dims, queue);
184
- passed &= for_all_combinations<run_test, bitwise_not_operator>(
185
- sint_types, all_dims, queue);
186
166
187
- std::cout << (passed ? " === Test passed\n " : " === Test FAILED\n " );
188
- return passed ? 0 : 1 ;
189
- }
167
+ }
0 commit comments