diff --git a/README.md b/README.md index 10767b3c7..aaee0b465 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,7 @@ Finally, start the compilation: `cmake --build ./build` After the compilation has finished, test executables for each category will be -placed in the `build/bin` directory. The `test_all` executable contains tests -for all categories. +placed in the `build/bin` directory. ### CMake Configuration Options @@ -98,7 +97,7 @@ Additionally, the following SYCL implementation-specific options can be used: Each of the executables produced in the `build/bin` directory acts as a standalone test runner that can be used to launch tests for a particular test -category (or all tests in the case of `build/bin/test_all`). +category. The ``--device`` argument is used to specify which device to run the tests on. Selection is based on substring matching of the device name. ECMAScript regular diff --git a/ci/generate_exclude_filter.py b/ci/generate_exclude_filter.py index 307456926..dfd7e8b36 100755 --- a/ci/generate_exclude_filter.py +++ b/ci/generate_exclude_filter.py @@ -88,7 +88,7 @@ def query_cmake_targets(build_dir: str): cmake_targets = [] for rt in raw_targets: m = target_pattern.match(rt) - if m and m.group(1) != 'test_all': + if m: cmake_targets.append(m.group(1)) return cmake_targets diff --git a/ci/hipsycl.filter b/ci/hipsycl.filter index ae3a70d41..d4f9719d0 100644 --- a/ci/hipsycl.filter +++ b/ci/hipsycl.filter @@ -18,9 +18,13 @@ item kernel kernel_args kernel_bundle -marray +marray_basic +marray_bitwise +marray_pre_post +marray_relational +marray_arithmetic_assignment +marray_arithmetic_binary math_builtin_api -marray multi_ptr nd_item nd_range diff --git a/docs/README.adoc b/docs/README.adoc index 4831790cb..568246a11 100644 --- a/docs/README.adoc +++ b/docs/README.adoc @@ -230,7 +230,7 @@ This adds a test case with the description `"a simple test case"` and the _tag_ Both can later be used to narrow down the set of test cases that will be executed during runtime. When configuring CMake, the new test category will automatically be detected and a target with the name `test_simple` is added. -You can run the test case by either executing `./bin/test_simple` directly, or alternatively as part of `./bin/test_all`. +You can run the test case by executing `./bin/test_simple`. IMPORTANT: For historic reasons, the CTS currently contains many test cases that are written in a different style. Please see <> for more information. diff --git a/run_conformance_tests.py b/run_conformance_tests.py index c694d4ac3..1c9a4e3d8 100755 --- a/run_conformance_tests.py +++ b/run_conformance_tests.py @@ -88,8 +88,13 @@ def handle_args(argv): help='Skip build step and perform only testing for already compiled tests.', required=False, action='store_true') + parser.add_argument('--commit-hash', + help='Original SYCL-CTS commit hash used for the run', + type=str, + required=False) args = parser.parse_args(argv) + commit_hash = args.commit_hash if args.commit_hash else 'Not specified' full_conformance = 'OFF' if args.fast else 'ON' test_deprecated_features = 'OFF' if args.disable_deprecated_features else 'ON' full_feature_set = 'OFF' if args.reduced_feature_set else 'ON' @@ -103,7 +108,7 @@ def handle_args(argv): full_conformance, test_deprecated_features, args.exclude_categories, args.implementation_name, args.additional_cmake_args, args.device, args.additional_ctest_args, args.build_only, args.run_only, - full_feature_set) + commit_hash, full_feature_set) def split_additional_args(additional_args): @@ -247,7 +252,7 @@ def get_xml_test_results(): def update_xml_attribs(info_json, implementation_name, test_xml_root, full_conformance, cmake_call, build_system_name, build_system_call, ctest_call, test_deprecated_features, - full_feature_set): + commit_hash, full_feature_set): """ Adds attributes to the root of the xml trees json required by the conformance report. @@ -274,6 +279,7 @@ def update_xml_attribs(info_json, implementation_name, test_xml_root, test_xml_root.attrib["DeviceFP64"] = info_json['device-fp64'] # Set Build Information attribs + test_xml_root.attrib["CommitHash"] = commit_hash test_xml_root.attrib["FullConformanceMode"] = full_conformance test_xml_root.attrib["CMakeInput"] = ' '.join(cmake_call) test_xml_root.attrib["BuildSystemGenerator"] = build_system_name @@ -291,7 +297,7 @@ def main(argv=sys.argv[1:]): (cmake_exe, build_system_name, build_system_call, full_conformance, test_deprecated_features, exclude_categories, implementation_name, additional_cmake_args, device, additional_ctest_args, - build_only, run_only, full_feature_set) = handle_args(argv) + build_only, run_only, commit_hash, full_feature_set) = handle_args(argv) # Generate a cmake call in a form accepted by subprocess.call() cmake_call = generate_cmake_call(cmake_exe, build_system_name, @@ -326,6 +332,7 @@ def main(argv=sys.argv[1:]): cmake_call, build_system_name, build_system_call, ctest_call, test_deprecated_features, + commit_hash, full_feature_set) # Get the xml report stylesheet and add it to the results. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fec7863e2..31a33eb98 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -45,6 +45,26 @@ function(get_std_type OUT_LIST) set(${OUT_LIST} ${${OUT_LIST}} ${STD_TYPE_LIST} PARENT_SCOPE) endfunction() +function(get_marray_elem_type OUT_LIST) + set(TYPE_LIST "") + get_std_type(TYPE_LIST) + + list(APPEND TYPE_LIST "custom_int") + + if(SYCL_CTS_ENABLE_FULL_CONFORMANCE) + list(APPEND TYPE_LIST + "std::uint8_t" + "std::int16_t" + "std::uint16_t" + "std::uint32_t" + "std::int64_t" + "std::uint64_t" + ) + endif() + + set(${OUT_LIST} ${${OUT_LIST}} ${TYPE_LIST} PARENT_SCOPE) +endfunction() + function(get_no_vec_alias_type OUT_LIST) set(NO_VEC_ALIAS_LIST "") list(APPEND NO_VEC_ALIAS_LIST sycl::byte) @@ -248,8 +268,6 @@ function(add_cts_test_helper) set_property(TARGET ${test_exe_name}_objects PROPERTY FOLDER "Tests/${test_exe_name}") - target_sources(test_all PRIVATE $) - add_dependencies(test_conformance ${test_exe_name}) endfunction() @@ -294,7 +312,3 @@ foreach(dir ${test_category_dirs}) add_subdirectory(${dir}) endif() endforeach() - -target_link_libraries(test_all PRIVATE CTS::util CTS::main_function oclmath) -target_link_libraries(test_all PRIVATE Catch2::Catch2 Threads::Threads) -add_sycl_to_target(TARGET test_all) diff --git a/tests/marray/CMakeLists.txt b/tests/marray/CMakeLists.txt deleted file mode 100644 index 82f462065..000000000 --- a/tests/marray/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -file(GLOB test_cases_list *.cpp) - -add_cts_test(${test_cases_list}) diff --git a/tests/marray/marray_alignment_fp16.cpp b/tests/marray/marray_alignment_fp16.cpp deleted file mode 100644 index b0791dc35..000000000 --- a/tests/marray/marray_alignment_fp16.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_alignment.h" -#include "marray_common.h" - -namespace marray_alignment_fp16 { - -using namespace sycl_cts; -using namespace marray_alignment; - -TEST_CASE("alignment fp16", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support half precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_alignment_for_type{}("sycl::half"); -} - -} // namespace marray_alignment_fp16 diff --git a/tests/marray/marray_alignment_fp64.cpp b/tests/marray/marray_alignment_fp64.cpp deleted file mode 100644 index bfda87a64..000000000 --- a/tests/marray/marray_alignment_fp64.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_alignment.h" -#include "marray_common.h" - -namespace marray_alignment_fp64 { - -using namespace sycl_cts; -using namespace marray_alignment; - -TEST_CASE("alignment fp64", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support double precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_alignment_for_type{}("double"); -} - -} // namespace marray_alignment_fp64 diff --git a/tests/marray/marray_constructor_fp16.cpp b/tests/marray/marray_constructor_fp16.cpp deleted file mode 100644 index 721f19e65..000000000 --- a/tests/marray/marray_constructor_fp16.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_constructor.h" - -namespace marray_constructor_fp16 { - -using namespace sycl_cts; -using namespace marray_constructor; - -TEST_CASE("constructor fp16", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support half precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_constructor_for_type{}("sycl::half"); -} - -} // namespace marray_constructor_fp16 diff --git a/tests/marray/marray_constructor_fp64.cpp b/tests/marray/marray_constructor_fp64.cpp deleted file mode 100644 index 69a04e7f2..000000000 --- a/tests/marray/marray_constructor_fp64.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_constructor.h" - -namespace marray_constructor_fp64 { - -using namespace sycl_cts; -using namespace marray_constructor; - -TEST_CASE("constructor fp64", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support double precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_constructor_for_type{}("double"); -} - -} // namespace marray_constructor_fp64 diff --git a/tests/marray/marray_members_fp16.cpp b/tests/marray/marray_members_fp16.cpp deleted file mode 100644 index 0fde7c3cc..000000000 --- a/tests/marray/marray_members_fp16.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_members.h" - -namespace marray_members_fp16 { - -using namespace sycl_cts; -using namespace marray_members; - -TEST_CASE("members fp16", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support half precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_members_for_type{}("sycl::half"); -}; - -} // namespace marray_members_fp16 diff --git a/tests/marray/marray_members_fp64.cpp b/tests/marray/marray_members_fp64.cpp deleted file mode 100644 index 3158ada74..000000000 --- a/tests/marray/marray_members_fp64.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_members.h" - -namespace marray_members_fp64 { - -using namespace sycl_cts; -using namespace marray_members; - -TEST_CASE("members fp64", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support double precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_members_for_type{}("double"); -}; - -} // namespace marray_members_fp64 diff --git a/tests/marray/marray_operators_arithmetic_assignment_fp16.cpp b/tests/marray/marray_operators_arithmetic_assignment_fp16.cpp deleted file mode 100644 index 99d7b1bf3..000000000 --- a/tests/marray/marray_operators_arithmetic_assignment_fp16.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_arithmetic_assignment_fp16 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("arithmetic assignment operators fp16", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support half precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_arithmetic_assignment_operators_for_type{}( - "sycl::half"); -} - -} // namespace marray_operators_arithmetic_assignment_fp16 diff --git a/tests/marray/marray_operators_arithmetic_assignment_fp64.cpp b/tests/marray/marray_operators_arithmetic_assignment_fp64.cpp deleted file mode 100644 index f1cfa655a..000000000 --- a/tests/marray/marray_operators_arithmetic_assignment_fp64.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_arithmetic_assignment_fp64 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("arithmetic assignment operators fp64", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support double precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_arithmetic_assignment_operators_for_type{}("double"); -} - -} // namespace marray_operators_arithmetic_assignment_fp64 diff --git a/tests/marray/marray_operators_arithmetic_binary_fp16.cpp b/tests/marray/marray_operators_arithmetic_binary_fp16.cpp deleted file mode 100644 index db37523ef..000000000 --- a/tests/marray/marray_operators_arithmetic_binary_fp16.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_arithmetic_binary_fp16 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("arithmetic binary operators fp16", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support half precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_arithmetic_binary_operators_for_type{}("sycl::half"); -} - -} // namespace marray_operators_arithmetic_binary_fp16 diff --git a/tests/marray/marray_operators_arithmetic_binary_fp64.cpp b/tests/marray/marray_operators_arithmetic_binary_fp64.cpp deleted file mode 100644 index 133106244..000000000 --- a/tests/marray/marray_operators_arithmetic_binary_fp64.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_arithmetic_binary_fp64 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("arithmetic binary operators fp64", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support double precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_arithmetic_binary_operators_for_type{}("double"); -} - -} // namespace marray_operators_arithmetic_binary_fp64 diff --git a/tests/marray/marray_operators_bitwise_assignment_fp16.cpp b/tests/marray/marray_operators_bitwise_assignment_fp16.cpp deleted file mode 100644 index 561ba1467..000000000 --- a/tests/marray/marray_operators_bitwise_assignment_fp16.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_bitwise_assignment_fp16 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("bitwise assignment operators fp16", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support half precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_bitwise_assignment_operators_for_type{}( - "sycl::half"); -} - -} // namespace marray_operators_bitwise_assignment_fp16 diff --git a/tests/marray/marray_operators_bitwise_assignment_fp64.cpp b/tests/marray/marray_operators_bitwise_assignment_fp64.cpp deleted file mode 100644 index 19315cdc2..000000000 --- a/tests/marray/marray_operators_bitwise_assignment_fp64.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_bitwise_assignment_fp64 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("bitwise assignment operators fp64", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support double precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_bitwise_assignment_operators_for_type{}("double"); -} - -} // namespace marray_operators_bitwise_assignment_fp64 diff --git a/tests/marray/marray_operators_bitwise_binary_fp16.cpp b/tests/marray/marray_operators_bitwise_binary_fp16.cpp deleted file mode 100644 index 6f671d10d..000000000 --- a/tests/marray/marray_operators_bitwise_binary_fp16.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_bitwise_binary_fp16 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("bitwise binary operators fp16", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support half precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_bitwise_binary_operators_for_type{}("sycl::half"); -} - -} // namespace marray_operators_bitwise_binary_fp16 diff --git a/tests/marray/marray_operators_bitwise_binary_fp64.cpp b/tests/marray/marray_operators_bitwise_binary_fp64.cpp deleted file mode 100644 index ac1b36924..000000000 --- a/tests/marray/marray_operators_bitwise_binary_fp64.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_bitwise_binary_fp64 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("bitwise binary operators fp64", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support double precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_bitwise_binary_operators_for_type{}("double"); -} - -} // namespace marray_operators_bitwise_binary_fp64 diff --git a/tests/marray/marray_operators_post_unary_fp16.cpp b/tests/marray/marray_operators_post_unary_fp16.cpp deleted file mode 100644 index c20e55359..000000000 --- a/tests/marray/marray_operators_post_unary_fp16.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_post_unary_fp16 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("suffix unary operators fp16", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support half precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_post_unary_operators_for_type{}("sycl::half"); -} - -} // namespace marray_operators_post_unary_fp16 diff --git a/tests/marray/marray_operators_post_unary_fp64.cpp b/tests/marray/marray_operators_post_unary_fp64.cpp deleted file mode 100644 index e60a44115..000000000 --- a/tests/marray/marray_operators_post_unary_fp64.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_post_unary_fp64 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("suffix unary operators fp64", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support double precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_post_unary_operators_for_type{}("double"); -} - -} // namespace marray_operators_post_unary_fp64 diff --git a/tests/marray/marray_operators_pre_unary_fp16.cpp b/tests/marray/marray_operators_pre_unary_fp16.cpp deleted file mode 100644 index c87505095..000000000 --- a/tests/marray/marray_operators_pre_unary_fp16.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_pre_unary_fp16 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("prefix unary operators fp16", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support half precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_pre_unary_operators_for_type{}("sycl::half"); -} - -} // namespace marray_operators_pre_unary_fp16 diff --git a/tests/marray/marray_operators_pre_unary_fp64.cpp b/tests/marray/marray_operators_pre_unary_fp64.cpp deleted file mode 100644 index 2d2cc8d61..000000000 --- a/tests/marray/marray_operators_pre_unary_fp64.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_pre_unary_fp64 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("prefix unary operators fp64", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support double precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_pre_unary_operators_for_type{}("double"); -} - -} // namespace marray_operators_pre_unary_fp64 diff --git a/tests/marray/marray_operators_relational_binary_fp16.cpp b/tests/marray/marray_operators_relational_binary_fp16.cpp deleted file mode 100644 index d409e6721..000000000 --- a/tests/marray/marray_operators_relational_binary_fp16.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_relational_binary_fp16 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("relational binary operators fp16", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support half precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_relational_binary_operators_for_type{}("sycl::half"); -} - -} // namespace marray_operators_relational_binary_fp16 diff --git a/tests/marray/marray_operators_relational_binary_fp64.cpp b/tests/marray/marray_operators_relational_binary_fp64.cpp deleted file mode 100644 index fbf28aa59..000000000 --- a/tests/marray/marray_operators_relational_binary_fp64.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* -// -// SYCL 2020 Conformance Test Suite -// -// Copyright (c) 2023 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -*******************************************************************************/ - -#include "../../util/extensions.h" -#include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" - -namespace marray_operators_relational_binary_fp64 { - -using namespace sycl_cts; -using namespace marray_operators; - -TEST_CASE("relational binary operators fp64", "[marray]") { - auto queue = util::get_cts_object::queue(); - using availability = - util::extensions::availability; - if (!availability::check(queue)) { - WARN( - "Device does not support double precision floating point operations." - "Skipping the test case."); - return; - } - - check_marray_relational_binary_operators_for_type{}("double"); -} - -} // namespace marray_operators_relational_binary_fp64 diff --git a/tests/marray_arithmetic_assignment/CMakeLists.txt b/tests/marray_arithmetic_assignment/CMakeLists.txt new file mode 100644 index 000000000..3ba6d02c4 --- /dev/null +++ b/tests/marray_arithmetic_assignment/CMakeLists.txt @@ -0,0 +1,32 @@ +function(configure_test_case) + cmake_parse_arguments(CTS + "" "TYPE;IN_FILENAME;OUT_FILENAME;TEST_LIST" "" ${ARGN}) + set(CTS_TYPE_NAME ${CTS_TYPE}) + configure_file(${CTS_IN_FILENAME} ${CTS_OUT_FILENAME}) + list(APPEND ${CTS_TEST_LIST} "${CMAKE_CURRENT_BINARY_DIR}/${CTS_OUT_FILENAME}") + set(${CTS_TEST_LIST} ${${CTS_TEST_LIST}} PARENT_SCOPE) +endfunction() + +list(APPEND TEMPLATE_LIST + "marray_operators_arithmetic_assignment" +) +set(TYPE_LIST "") +get_marray_elem_type(TYPE_LIST) +half_double_filter(TYPE_LIST) + +file(GLOB test_cases_list *.cpp) + +foreach(TEMP IN LISTS TEMPLATE_LIST) + foreach(TY IN LISTS TYPE_LIST) + set(OUT_FILE "${TEMP}_${TY}.cpp") + STRING(REGEX REPLACE ":" "_" OUT_FILE ${OUT_FILE}) + STRING(REGEX REPLACE " " "_" OUT_FILE ${OUT_FILE}) + configure_test_case( + TYPE "${TY}" + IN_FILENAME "${TEMP}.cpp.in" + OUT_FILENAME ${OUT_FILE} + TEST_LIST test_cases_list) + endforeach() +endforeach() + +add_cts_test(${test_cases_list}) diff --git a/tests/marray/marray_operators_arithmetic_assignment_core.cpp b/tests/marray_arithmetic_assignment/marray_operators_arithmetic_assignment.cpp.in similarity index 52% rename from tests/marray/marray_operators_arithmetic_assignment_core.cpp rename to tests/marray_arithmetic_assignment/marray_operators_arithmetic_assignment.cpp.in index 71efe0caa..ea39d0306 100644 --- a/tests/marray/marray_operators_arithmetic_assignment_core.cpp +++ b/tests/marray_arithmetic_assignment/marray_operators_arithmetic_assignment.cpp.in @@ -19,16 +19,34 @@ *******************************************************************************/ #include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" +#include "../marray_basic/marray_common.h" +#include "../marray_basic/marray_operators.h" + +// clang-format off +#cmakedefine CTS_TYPE @CTS_TYPE@ +#cmakedefine CTS_TYPE_NAME std::string("@CTS_TYPE_NAME@") +// clang-format on namespace marray_operators_arithmetic_assignment_core { using namespace marray_operators; -TEST_CASE("arithmetic assignment operators core", "[marray]") { - const auto types = marray_common::get_types(); - for_all_types(types); +TEST_CASE(CTS_TYPE_NAME + " arithmetic assignment operators core", "[marray]") { + auto queue = sycl_cts::util::get_cts_object::queue(); + if constexpr (std::is_same_v, sycl::half>) { + if (!queue.get_device().has(sycl::aspect::fp16)) + SKIP( + "Device does not support half precision floating point " + "operations."); + } else if (std::is_same_v, double>) { + if (!queue.get_device().has(sycl::aspect::fp64)) + SKIP( + "Device does not support double precision floating point " + "operations."); + } + + check_marray_arithmetic_assignment_operators_for_type{}( + CTS_TYPE_NAME); } } // namespace marray_operators_arithmetic_assignment_core diff --git a/tests/marray_arithmetic_binary/CMakeLists.txt b/tests/marray_arithmetic_binary/CMakeLists.txt new file mode 100644 index 000000000..2226bdd20 --- /dev/null +++ b/tests/marray_arithmetic_binary/CMakeLists.txt @@ -0,0 +1,32 @@ +function(configure_test_case) + cmake_parse_arguments(CTS + "" "TYPE;IN_FILENAME;OUT_FILENAME;TEST_LIST" "" ${ARGN}) + set(CTS_TYPE_NAME ${CTS_TYPE}) + configure_file(${CTS_IN_FILENAME} ${CTS_OUT_FILENAME}) + list(APPEND ${CTS_TEST_LIST} "${CMAKE_CURRENT_BINARY_DIR}/${CTS_OUT_FILENAME}") + set(${CTS_TEST_LIST} ${${CTS_TEST_LIST}} PARENT_SCOPE) +endfunction() + +list(APPEND TEMPLATE_LIST + "marray_operators_arithmetic_binary" +) +set(TYPE_LIST "") +get_marray_elem_type(TYPE_LIST) +half_double_filter(TYPE_LIST) + +file(GLOB test_cases_list *.cpp) + +foreach(TEMP IN LISTS TEMPLATE_LIST) + foreach(TY IN LISTS TYPE_LIST) + set(OUT_FILE "${TEMP}_${TY}.cpp") + STRING(REGEX REPLACE ":" "_" OUT_FILE ${OUT_FILE}) + STRING(REGEX REPLACE " " "_" OUT_FILE ${OUT_FILE}) + configure_test_case( + TYPE "${TY}" + IN_FILENAME "${TEMP}.cpp.in" + OUT_FILENAME ${OUT_FILE} + TEST_LIST test_cases_list) + endforeach() +endforeach() + +add_cts_test(${test_cases_list}) diff --git a/tests/marray/marray_operators_arithmetic_binary_core.cpp b/tests/marray_arithmetic_binary/marray_operators_arithmetic_binary.cpp.in similarity index 52% rename from tests/marray/marray_operators_arithmetic_binary_core.cpp rename to tests/marray_arithmetic_binary/marray_operators_arithmetic_binary.cpp.in index 70aec8261..9c992fb89 100644 --- a/tests/marray/marray_operators_arithmetic_binary_core.cpp +++ b/tests/marray_arithmetic_binary/marray_operators_arithmetic_binary.cpp.in @@ -19,16 +19,33 @@ *******************************************************************************/ #include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" +#include "../marray_basic/marray_common.h" +#include "../marray_basic/marray_operators.h" + +// clang-format off +#cmakedefine CTS_TYPE @CTS_TYPE@ +#cmakedefine CTS_TYPE_NAME std::string("@CTS_TYPE_NAME@") +// clang-format on namespace marray_operators_arithmetic_binary_core { using namespace marray_operators; -TEST_CASE("arithmetic binary operators core", "[marray]") { - const auto types = marray_common::get_types(); - for_all_types(types); +TEST_CASE(CTS_TYPE_NAME + " arithmetic binary operators core", "[marray]") { + auto queue = sycl_cts::util::get_cts_object::queue(); + if constexpr (std::is_same_v, sycl::half>) { + if (!queue.get_device().has(sycl::aspect::fp16)) + SKIP( + "Device does not support half precision floating point " + "operations."); + } else if (std::is_same_v, double>) { + if (!queue.get_device().has(sycl::aspect::fp64)) + SKIP( + "Device does not support double precision floating point " + "operations."); + } + + check_marray_arithmetic_binary_operators_for_type{}(CTS_TYPE_NAME); } } // namespace marray_operators_arithmetic_binary_core diff --git a/tests/marray_basic/CMakeLists.txt b/tests/marray_basic/CMakeLists.txt new file mode 100644 index 000000000..fc943b738 --- /dev/null +++ b/tests/marray_basic/CMakeLists.txt @@ -0,0 +1,34 @@ +function(configure_test_case) + cmake_parse_arguments(CTS + "" "TYPE;IN_FILENAME;OUT_FILENAME;TEST_LIST" "" ${ARGN}) + set(CTS_TYPE_NAME ${CTS_TYPE}) + configure_file(${CTS_IN_FILENAME} ${CTS_OUT_FILENAME}) + list(APPEND ${CTS_TEST_LIST} "${CMAKE_CURRENT_BINARY_DIR}/${CTS_OUT_FILENAME}") + set(${CTS_TEST_LIST} ${${CTS_TEST_LIST}} PARENT_SCOPE) +endfunction() + +list(APPEND TEMPLATE_LIST + "marray_alignment" + "marray_constructor" + "marray_members" +) +set(TYPE_LIST "") +get_marray_elem_type(TYPE_LIST) +half_double_filter(TYPE_LIST) + +file(GLOB test_cases_list *.cpp) + +foreach(TEMP IN LISTS TEMPLATE_LIST) + foreach(TY IN LISTS TYPE_LIST) + set(OUT_FILE "${TEMP}_${TY}.cpp") + STRING(REGEX REPLACE ":" "_" OUT_FILE ${OUT_FILE}) + STRING(REGEX REPLACE " " "_" OUT_FILE ${OUT_FILE}) + configure_test_case( + TYPE "${TY}" + IN_FILENAME "${TEMP}.cpp.in" + OUT_FILENAME ${OUT_FILE} + TEST_LIST test_cases_list) + endforeach() +endforeach() + +add_cts_test(${test_cases_list}) diff --git a/tests/marray/marray_alias.cpp b/tests/marray_basic/marray_alias.cpp similarity index 100% rename from tests/marray/marray_alias.cpp rename to tests/marray_basic/marray_alias.cpp diff --git a/tests/marray/marray_alignment_core.cpp b/tests/marray_basic/marray_alignment.cpp.in similarity index 80% rename from tests/marray/marray_alignment_core.cpp rename to tests/marray_basic/marray_alignment.cpp.in index 721c3fa2f..2f1395e55 100644 --- a/tests/marray/marray_alignment_core.cpp +++ b/tests/marray_basic/marray_alignment.cpp.in @@ -22,13 +22,17 @@ #include "marray_alignment.h" #include "marray_common.h" +// clang-format off +#cmakedefine CTS_TYPE @CTS_TYPE@ +#cmakedefine CTS_TYPE_NAME std::string("@CTS_TYPE_NAME@") +// clang-format on + namespace marray_alignment_core { using namespace marray_alignment; -TEST_CASE("alignment core", "[marray]") { - const auto types = marray_common::get_types(); - for_all_types(types); +TEST_CASE(CTS_TYPE_NAME + " alignment core", "[marray]") { + check_marray_alignment_for_type{}(CTS_TYPE_NAME); } } // namespace marray_alignment_core diff --git a/tests/marray/marray_alignment.h b/tests/marray_basic/marray_alignment.h similarity index 100% rename from tests/marray/marray_alignment.h rename to tests/marray_basic/marray_alignment.h diff --git a/tests/marray/marray_common.h b/tests/marray_basic/marray_common.h similarity index 100% rename from tests/marray/marray_common.h rename to tests/marray_basic/marray_common.h diff --git a/tests/marray/marray_constructor_core.cpp b/tests/marray_basic/marray_constructor.cpp.in similarity index 57% rename from tests/marray/marray_constructor_core.cpp rename to tests/marray_basic/marray_constructor.cpp.in index 1e22e6ba3..9bd5f4aff 100644 --- a/tests/marray/marray_constructor_core.cpp +++ b/tests/marray_basic/marray_constructor.cpp.in @@ -22,13 +22,30 @@ #include "marray_common.h" #include "marray_constructor.h" +// clang-format off +#cmakedefine CTS_TYPE @CTS_TYPE@ +#cmakedefine CTS_TYPE_NAME std::string("@CTS_TYPE_NAME@") +// clang-format on + namespace marray_constructor_core { using namespace marray_constructor; -TEST_CASE("constructor core", "[marray]") { - const auto types = marray_common::get_types(); - for_all_types(types); +TEST_CASE(CTS_TYPE_NAME + " constructor core", "[marray]") { + auto queue = sycl_cts::util::get_cts_object::queue(); + if constexpr (std::is_same_v, sycl::half>) { + if (!queue.get_device().has(sycl::aspect::fp16)) + SKIP( + "Device does not support half precision floating point " + "operations."); + } else if (std::is_same_v, double>) { + if (!queue.get_device().has(sycl::aspect::fp64)) + SKIP( + "Device does not support double precision floating point " + "operations."); + } + + check_marray_constructor_for_type{}(CTS_TYPE_NAME); } } // namespace marray_constructor_core diff --git a/tests/marray/marray_constructor.h b/tests/marray_basic/marray_constructor.h similarity index 100% rename from tests/marray/marray_constructor.h rename to tests/marray_basic/marray_constructor.h diff --git a/tests/marray/marray_custom_type.h b/tests/marray_basic/marray_custom_type.h similarity index 100% rename from tests/marray/marray_custom_type.h rename to tests/marray_basic/marray_custom_type.h diff --git a/tests/marray/marray_members_core.cpp b/tests/marray_basic/marray_members.cpp.in similarity index 57% rename from tests/marray/marray_members_core.cpp rename to tests/marray_basic/marray_members.cpp.in index d8a7a1dd6..fd250e14d 100644 --- a/tests/marray/marray_members_core.cpp +++ b/tests/marray_basic/marray_members.cpp.in @@ -22,13 +22,30 @@ #include "marray_common.h" #include "marray_members.h" +// clang-format off +#cmakedefine CTS_TYPE @CTS_TYPE@ +#cmakedefine CTS_TYPE_NAME std::string("@CTS_TYPE_NAME@") +// clang-format on + namespace marray_members_core { using namespace marray_members; -TEST_CASE("members core", "[marray]") { - const auto types = marray_common::get_types(); - for_all_types(types); +TEST_CASE(CTS_TYPE_NAME + " members core", "[marray]") { + auto queue = sycl_cts::util::get_cts_object::queue(); + if constexpr (std::is_same_v, sycl::half>) { + if (!queue.get_device().has(sycl::aspect::fp16)) + SKIP( + "Device does not support half precision floating point " + "operations."); + } else if (std::is_same_v, double>) { + if (!queue.get_device().has(sycl::aspect::fp64)) + SKIP( + "Device does not support double precision floating point " + "operations."); + } + + check_marray_members_for_type{}(CTS_TYPE_NAME); } } // namespace marray_members_core diff --git a/tests/marray/marray_members.h b/tests/marray_basic/marray_members.h similarity index 100% rename from tests/marray/marray_members.h rename to tests/marray_basic/marray_members.h diff --git a/tests/marray/marray_operator_helper.h b/tests/marray_basic/marray_operator_helper.h similarity index 100% rename from tests/marray/marray_operator_helper.h rename to tests/marray_basic/marray_operator_helper.h diff --git a/tests/marray/marray_operators.h b/tests/marray_basic/marray_operators.h similarity index 100% rename from tests/marray/marray_operators.h rename to tests/marray_basic/marray_operators.h diff --git a/tests/marray_bitwise/CMakeLists.txt b/tests/marray_bitwise/CMakeLists.txt new file mode 100644 index 000000000..20585d1e5 --- /dev/null +++ b/tests/marray_bitwise/CMakeLists.txt @@ -0,0 +1,33 @@ +function(configure_test_case) + cmake_parse_arguments(CTS + "" "TYPE;IN_FILENAME;OUT_FILENAME;TEST_LIST" "" ${ARGN}) + set(CTS_TYPE_NAME ${CTS_TYPE}) + configure_file(${CTS_IN_FILENAME} ${CTS_OUT_FILENAME}) + list(APPEND ${CTS_TEST_LIST} "${CMAKE_CURRENT_BINARY_DIR}/${CTS_OUT_FILENAME}") + set(${CTS_TEST_LIST} ${${CTS_TEST_LIST}} PARENT_SCOPE) +endfunction() + +list(APPEND TEMPLATE_LIST + "marray_operators_bitwise_assignment" + "marray_operators_bitwise_binary" +) +set(TYPE_LIST "") +get_marray_elem_type(TYPE_LIST) +half_double_filter(TYPE_LIST) + +file(GLOB test_cases_list *.cpp) + +foreach(TEMP IN LISTS TEMPLATE_LIST) + foreach(TY IN LISTS TYPE_LIST) + set(OUT_FILE "${TEMP}_${TY}.cpp") + STRING(REGEX REPLACE ":" "_" OUT_FILE ${OUT_FILE}) + STRING(REGEX REPLACE " " "_" OUT_FILE ${OUT_FILE}) + configure_test_case( + TYPE "${TY}" + IN_FILENAME "${TEMP}.cpp.in" + OUT_FILENAME ${OUT_FILE} + TEST_LIST test_cases_list) + endforeach() +endforeach() + +add_cts_test(${test_cases_list}) diff --git a/tests/marray/marray_operators_bitwise_assignment_core.cpp b/tests/marray_bitwise/marray_operators_bitwise_assignment.cpp.in similarity index 52% rename from tests/marray/marray_operators_bitwise_assignment_core.cpp rename to tests/marray_bitwise/marray_operators_bitwise_assignment.cpp.in index 831680058..4c90af8d0 100644 --- a/tests/marray/marray_operators_bitwise_assignment_core.cpp +++ b/tests/marray_bitwise/marray_operators_bitwise_assignment.cpp.in @@ -19,16 +19,33 @@ *******************************************************************************/ #include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" +#include "../marray_basic/marray_common.h" +#include "../marray_basic/marray_operators.h" + +// clang-format off +#cmakedefine CTS_TYPE @CTS_TYPE@ +#cmakedefine CTS_TYPE_NAME std::string("@CTS_TYPE_NAME@") +// clang-format on namespace marray_operators_bitwise_assignment_core { using namespace marray_operators; -TEST_CASE("bitwise assignment operators core", "[marray]") { - const auto types = marray_common::get_types(); - for_all_types(types); +TEST_CASE(CTS_TYPE_NAME + " bitwise assignment operators core", "[marray]") { + auto queue = sycl_cts::util::get_cts_object::queue(); + if constexpr (std::is_same_v, sycl::half>) { + if (!queue.get_device().has(sycl::aspect::fp16)) + SKIP( + "Device does not support half precision floating point " + "operations."); + } else if (std::is_same_v, double>) { + if (!queue.get_device().has(sycl::aspect::fp64)) + SKIP( + "Device does not support double precision floating point " + "operations."); + } + + check_marray_bitwise_assignment_operators_for_type{}(CTS_TYPE_NAME); } } // namespace marray_operators_bitwise_assignment_core diff --git a/tests/marray/marray_operators_bitwise_binary_core.cpp b/tests/marray_bitwise/marray_operators_bitwise_binary.cpp.in similarity index 52% rename from tests/marray/marray_operators_bitwise_binary_core.cpp rename to tests/marray_bitwise/marray_operators_bitwise_binary.cpp.in index 4d60d581c..a5d75c464 100644 --- a/tests/marray/marray_operators_bitwise_binary_core.cpp +++ b/tests/marray_bitwise/marray_operators_bitwise_binary.cpp.in @@ -19,16 +19,33 @@ *******************************************************************************/ #include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" +#include "../marray_basic/marray_common.h" +#include "../marray_basic/marray_operators.h" + +// clang-format off +#cmakedefine CTS_TYPE @CTS_TYPE@ +#cmakedefine CTS_TYPE_NAME std::string("@CTS_TYPE_NAME@") +// clang-format on namespace marray_operators_bitwise_binary_core { using namespace marray_operators; -TEST_CASE("bitwise binary operators core", "[marray]") { - const auto types = marray_common::get_types(); - for_all_types(types); +TEST_CASE(CTS_TYPE_NAME + " bitwise binary operators core", "[marray]") { + auto queue = sycl_cts::util::get_cts_object::queue(); + if constexpr (std::is_same_v, sycl::half>) { + if (!queue.get_device().has(sycl::aspect::fp16)) + SKIP( + "Device does not support half precision floating point " + "operations."); + } else if (std::is_same_v, double>) { + if (!queue.get_device().has(sycl::aspect::fp64)) + SKIP( + "Device does not support double precision floating point " + "operations."); + } + + check_marray_bitwise_binary_operators_for_type{}(CTS_TYPE_NAME); } } // namespace marray_operators_bitwise_binary_core diff --git a/tests/marray_pre_post/CMakeLists.txt b/tests/marray_pre_post/CMakeLists.txt new file mode 100644 index 000000000..4ebe44b42 --- /dev/null +++ b/tests/marray_pre_post/CMakeLists.txt @@ -0,0 +1,33 @@ +function(configure_test_case) + cmake_parse_arguments(CTS + "" "TYPE;IN_FILENAME;OUT_FILENAME;TEST_LIST" "" ${ARGN}) + set(CTS_TYPE_NAME ${CTS_TYPE}) + configure_file(${CTS_IN_FILENAME} ${CTS_OUT_FILENAME}) + list(APPEND ${CTS_TEST_LIST} "${CMAKE_CURRENT_BINARY_DIR}/${CTS_OUT_FILENAME}") + set(${CTS_TEST_LIST} ${${CTS_TEST_LIST}} PARENT_SCOPE) +endfunction() + +list(APPEND TEMPLATE_LIST + "marray_operators_post_unary" + "marray_operators_pre_unary" +) +set(TYPE_LIST "") +get_marray_elem_type(TYPE_LIST) +half_double_filter(TYPE_LIST) + +file(GLOB test_cases_list *.cpp) + +foreach(TEMP IN LISTS TEMPLATE_LIST) + foreach(TY IN LISTS TYPE_LIST) + set(OUT_FILE "${TEMP}_${TY}.cpp") + STRING(REGEX REPLACE ":" "_" OUT_FILE ${OUT_FILE}) + STRING(REGEX REPLACE " " "_" OUT_FILE ${OUT_FILE}) + configure_test_case( + TYPE "${TY}" + IN_FILENAME "${TEMP}.cpp.in" + OUT_FILENAME ${OUT_FILE} + TEST_LIST test_cases_list) + endforeach() +endforeach() + +add_cts_test(${test_cases_list}) diff --git a/tests/marray/marray_operators_post_unary_core.cpp b/tests/marray_pre_post/marray_operators_post_unary.cpp.in similarity index 52% rename from tests/marray/marray_operators_post_unary_core.cpp rename to tests/marray_pre_post/marray_operators_post_unary.cpp.in index 2c3c8e089..2feb02971 100644 --- a/tests/marray/marray_operators_post_unary_core.cpp +++ b/tests/marray_pre_post/marray_operators_post_unary.cpp.in @@ -19,16 +19,33 @@ *******************************************************************************/ #include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" +#include "../marray_basic/marray_common.h" +#include "../marray_basic/marray_operators.h" + +// clang-format off +#cmakedefine CTS_TYPE @CTS_TYPE@ +#cmakedefine CTS_TYPE_NAME std::string("@CTS_TYPE_NAME@") +// clang-format on namespace marray_operators_post_unary_core { using namespace marray_operators; -TEST_CASE("suffix unary operators core", "[marray]") { - const auto types = marray_common::get_types(); - for_all_types(types); +TEST_CASE(CTS_TYPE_NAME + " suffix unary operators core", "[marray]") { + auto queue = sycl_cts::util::get_cts_object::queue(); + if constexpr (std::is_same_v, sycl::half>) { + if (!queue.get_device().has(sycl::aspect::fp16)) + SKIP( + "Device does not support half precision floating point " + "operations."); + } else if (std::is_same_v, double>) { + if (!queue.get_device().has(sycl::aspect::fp64)) + SKIP( + "Device does not support double precision floating point " + "operations."); + } + + check_marray_post_unary_operators_for_type{}(CTS_TYPE_NAME); } } // namespace marray_operators_post_unary_core diff --git a/tests/marray/marray_operators_pre_unary_core.cpp b/tests/marray_pre_post/marray_operators_pre_unary.cpp.in similarity index 52% rename from tests/marray/marray_operators_pre_unary_core.cpp rename to tests/marray_pre_post/marray_operators_pre_unary.cpp.in index ffd05f707..b537e749d 100644 --- a/tests/marray/marray_operators_pre_unary_core.cpp +++ b/tests/marray_pre_post/marray_operators_pre_unary.cpp.in @@ -19,16 +19,33 @@ *******************************************************************************/ #include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" +#include "../marray_basic/marray_common.h" +#include "../marray_basic/marray_operators.h" + +// clang-format off +#cmakedefine CTS_TYPE @CTS_TYPE@ +#cmakedefine CTS_TYPE_NAME std::string("@CTS_TYPE_NAME@") +// clang-format on namespace marray_operators_pre_unary_core { using namespace marray_operators; -TEST_CASE("prefix unary operators core", "[marray]") { - const auto types = marray_common::get_types(); - for_all_types(types); +TEST_CASE(CTS_TYPE_NAME + " prefix unary operators core", "[marray]") { + auto queue = sycl_cts::util::get_cts_object::queue(); + if constexpr (std::is_same_v, sycl::half>) { + if (!queue.get_device().has(sycl::aspect::fp16)) + SKIP( + "Device does not support half precision floating point " + "operations."); + } else if (std::is_same_v, double>) { + if (!queue.get_device().has(sycl::aspect::fp64)) + SKIP( + "Device does not support double precision floating point " + "operations."); + } + + check_marray_pre_unary_operators_for_type{}(CTS_TYPE_NAME); } } // namespace marray_operators_pre_unary_core diff --git a/tests/marray_relational/CMakeLists.txt b/tests/marray_relational/CMakeLists.txt new file mode 100644 index 000000000..d32c22e6c --- /dev/null +++ b/tests/marray_relational/CMakeLists.txt @@ -0,0 +1,32 @@ +function(configure_test_case) + cmake_parse_arguments(CTS + "" "TYPE;IN_FILENAME;OUT_FILENAME;TEST_LIST" "" ${ARGN}) + set(CTS_TYPE_NAME ${CTS_TYPE}) + configure_file(${CTS_IN_FILENAME} ${CTS_OUT_FILENAME}) + list(APPEND ${CTS_TEST_LIST} "${CMAKE_CURRENT_BINARY_DIR}/${CTS_OUT_FILENAME}") + set(${CTS_TEST_LIST} ${${CTS_TEST_LIST}} PARENT_SCOPE) +endfunction() + +list(APPEND TEMPLATE_LIST + "marray_operators_relational_binary" +) +set(TYPE_LIST "") +get_marray_elem_type(TYPE_LIST) +half_double_filter(TYPE_LIST) + +file(GLOB test_cases_list *.cpp) + +foreach(TEMP IN LISTS TEMPLATE_LIST) + foreach(TY IN LISTS TYPE_LIST) + set(OUT_FILE "${TEMP}_${TY}.cpp") + STRING(REGEX REPLACE ":" "_" OUT_FILE ${OUT_FILE}) + STRING(REGEX REPLACE " " "_" OUT_FILE ${OUT_FILE}) + configure_test_case( + TYPE "${TY}" + IN_FILENAME "${TEMP}.cpp.in" + OUT_FILENAME ${OUT_FILE} + TEST_LIST test_cases_list) + endforeach() +endforeach() + +add_cts_test(${test_cases_list}) diff --git a/tests/marray/marray_operators_relational_binary_core.cpp b/tests/marray_relational/marray_operators_relational_binary.cpp.in similarity index 52% rename from tests/marray/marray_operators_relational_binary_core.cpp rename to tests/marray_relational/marray_operators_relational_binary.cpp.in index bcd64d566..cc43dc858 100644 --- a/tests/marray/marray_operators_relational_binary_core.cpp +++ b/tests/marray_relational/marray_operators_relational_binary.cpp.in @@ -19,16 +19,33 @@ *******************************************************************************/ #include "../common/type_coverage.h" -#include "marray_common.h" -#include "marray_operators.h" +#include "../marray_basic/marray_common.h" +#include "../marray_basic/marray_operators.h" + +// clang-format off +#cmakedefine CTS_TYPE @CTS_TYPE@ +#cmakedefine CTS_TYPE_NAME std::string("@CTS_TYPE_NAME@") +// clang-format on namespace marray_operators_relational_binary_core { using namespace marray_operators; -TEST_CASE("relational binary operators core", "[marray]") { - const auto types = marray_common::get_types(); - for_all_types(types); +TEST_CASE(CTS_TYPE_NAME + " relational binary operators core", "[marray]") { + auto queue = sycl_cts::util::get_cts_object::queue(); + if constexpr (std::is_same_v, sycl::half>) { + if (!queue.get_device().has(sycl::aspect::fp16)) + SKIP( + "Device does not support half precision floating point " + "operations."); + } else if (std::is_same_v, double>) { + if (!queue.get_device().has(sycl::aspect::fp64)) + SKIP( + "Device does not support double precision floating point " + "operations."); + } + + check_marray_relational_binary_operators_for_type{}(CTS_TYPE_NAME); } } // namespace marray_operators_relational_binary_core diff --git a/tests/platform/platform_info.cpp b/tests/platform/platform_info.cpp index 62d77a4b0..115be8f2d 100644 --- a/tests/platform/platform_info.cpp +++ b/tests/platform/platform_info.cpp @@ -46,8 +46,6 @@ class TEST_NAME : public util::test_base { */ { auto plt = util::get_cts_object::platform(cts_selector); - check_get_info_param(log, - plt); check_get_info_param(log, plt); check_get_info_param(log, plt); diff --git a/tests/reduction/reducer_api_basic.cpp b/tests/reduction/reducer_api_basic.cpp new file mode 100644 index 000000000..9bd494503 --- /dev/null +++ b/tests/reduction/reducer_api_basic.cpp @@ -0,0 +1,74 @@ +/******************************************************************************* +// +// SYCL 2020 Conformance Test Suite +// +// Copyright (c) 2023 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +*******************************************************************************/ +#include "../common/common.h" +#include "../common/disabled_for_test_case.h" +// FIXME: re-enable when sycl::reduction is implemented in hipSYCL +#if !SYCL_CTS_COMPILING_WITH_HIPSYCL +#include "reducer_api.h" +#endif + +#include +#include +#include +#include + +struct kernel_name; + +// FIXME: re-enable when sycl::reduction is implemented in hipSYCL +DISABLED_FOR_TEST_CASE(hipSYCL) +("reducer class", "[reducer]")({ + sycl::queue queue = sycl_cts::util::get_cts_object::queue(); + + // dummy output value + int red_output; + sycl::buffer buf_output{&red_output, sycl::range<1>{1}}; + + constexpr size_t result_count = 4; + std::vector results(result_count, 0); + { + sycl::buffer buf_results(results.data(), sycl::range<1>{result_count}); + queue.submit([&](sycl::handler& cgh) { + auto acc_results = + buf_results.template get_access(cgh); + auto reduction = sycl::reduction(buf_output, cgh, sycl::plus<>{}); + cgh.parallel_for( + sycl::range<1>{1}, reduction, [=](sycl::id<1> idx, auto& reducer) { + using reducer_t = std::remove_reference_t; + size_t i = 0; + acc_results[i++] = !std::is_copy_constructible_v; + acc_results[i++] = !std::is_move_constructible_v; + acc_results[i++] = !std::is_copy_assignable_v; + acc_results[i++] = !std::is_move_assignable_v; + assert(result_count == i); + }); + }); + } + + // all results are expected to evaluate to true + CHECK( + std::all_of(results.begin(), results.end(), [](int val) { return val; })); +}); + +// FIXME: re-enable when reducer is fully implemented in hipSYCL +DISABLED_FOR_TEST_CASE(hipSYCL) +("reducer identity for bool", "[reducer]")({ + sycl::queue queue = sycl_cts::util::get_cts_object::queue(); + check_reducer_identity{}(queue, "bool"); +}); diff --git a/tools/stylesheet.xml b/tools/stylesheet.xml index 8e8a0eb84..6d37b1951 100644 --- a/tools/stylesheet.xml +++ b/tools/stylesheet.xml @@ -102,6 +102,7 @@ Half Precision Floating Point Double Precision Floating Point Build Information + SYCL-CTS commit hash Full Conformance Mode CMake Input Build System Generator