-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #815 from jiezzhang/group_functions_split_by_type
Split group_scan and group_reduce tests by data types
- Loading branch information
Showing
19 changed files
with
261 additions
and
971 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,38 @@ | ||
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 | ||
"group_joint_scan" | ||
"group_scan_over_group" | ||
"group_joint_reduce" | ||
"group_reduce_over_group" | ||
) | ||
set(TYPE_LIST "") | ||
get_std_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) | ||
if(TY STREQUAL "bool") | ||
continue() | ||
endif() | ||
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}) |
This file was deleted.
Oops, something went wrong.
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,75 @@ | ||
/******************************************************************************* | ||
// | ||
// 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 "group_reduce.h" | ||
|
||
// clang-format off | ||
#cmakedefine CTS_TYPE @CTS_TYPE@ | ||
#cmakedefine CTS_TYPE_NAME std::string("@CTS_TYPE_NAME@") | ||
// clang-format on | ||
using ReduceTypes = Types; | ||
|
||
TEST_CASE(CTS_TYPE_NAME + " group and sub-group joint reduce functions", | ||
"[group_func][type_list][dim]") { | ||
auto queue = once_per_unit::get_queue(); | ||
const auto Operators = get_op_types<CTS_TYPE>(); | ||
const auto RetType = unnamed_type_pack<CTS_TYPE>(); | ||
|
||
if constexpr (std::is_same_v<std::remove_cv_t<CTS_TYPE>, 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<std::remove_cv_t<CTS_TYPE>, double>) { | ||
if (!queue.get_device().has(sycl::aspect::fp64)) | ||
SKIP( | ||
"Device does not support double precision floating point " | ||
"operations."); | ||
} | ||
|
||
for_all_combinations<invoke_joint_reduce_group>(Dims, RetType, Operators, | ||
queue); | ||
} | ||
|
||
TEMPLATE_LIST_TEST_CASE( | ||
CTS_TYPE_NAME + " group and sub-group joint reduce functions with init", | ||
"[group_func][type_list][dim]", ReduceTypes) { | ||
auto queue = once_per_unit::get_queue(); | ||
|
||
const auto Operators = get_op_types<CTS_TYPE>(); | ||
const auto RetType = unnamed_type_pack<CTS_TYPE>(); | ||
const auto ReducedType = unnamed_type_pack<TestType>(); | ||
|
||
if constexpr (std::is_same_v<std::remove_cv_t<CTS_TYPE>, 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<std::remove_cv_t<CTS_TYPE>, double>) { | ||
if (!queue.get_device().has(sycl::aspect::fp64)) | ||
SKIP( | ||
"Device does not support double precision floating point " | ||
"operations."); | ||
} | ||
|
||
// check all work group dimensions | ||
for_all_combinations<invoke_init_joint_reduce_group>( | ||
Dims, RetType, ReducedType, Operators, queue); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.