Skip to content

Commit

Permalink
Merge branch 'main' into fp16_spirv_test_decorate
Browse files Browse the repository at this point in the history
  • Loading branch information
shajder committed Jun 23, 2023
2 parents 4e70c2b + df3ec8d commit 9cdb098
Show file tree
Hide file tree
Showing 12 changed files with 1,138 additions and 624 deletions.
File renamed without changes.
6 changes: 2 additions & 4 deletions test_conformance/basic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set(MODULE_NAME BASIC)

set(${MODULE_NAME}_SOURCES
main.cpp
test_fpmath_float.cpp
test_fpmath.cpp
test_intmath.cpp
test_hiloeo.cpp test_local.cpp test_pointercast.cpp
test_if.cpp test_loop.cpp
Expand All @@ -11,7 +11,7 @@ set(${MODULE_NAME}_SOURCES
test_multireadimageonefmt.cpp test_multireadimagemultifmt.cpp
test_imagedim.cpp
test_vloadstore.cpp
test_int2float.cpp
test_int2fp.cpp
test_createkernelsinprogram.cpp
test_hostptr.cpp
test_explicit_s2v.cpp
Expand Down Expand Up @@ -70,6 +70,4 @@ if(APPLE)
list(APPEND ${MODULE_NAME}_SOURCES test_queue_priority.cpp)
endif(APPLE)

set_gnulike_module_compile_flags("-Wno-unused-but-set-variable")

include(../CMakeCommon.txt)
43 changes: 35 additions & 8 deletions test_conformance/basic/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2017 The Khronos Group Inc.
// 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.
Expand All @@ -22,14 +22,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <CL/cl_half.h>

#include "harness/testHarness.h"
#include "procs.h"

test_definition test_list[] = {
ADD_TEST(hostptr),
ADD_TEST(fpmath_float),
ADD_TEST(fpmath_float2),
ADD_TEST(fpmath_float4),
ADD_TEST(fpmath),
ADD_TEST(intmath_int),
ADD_TEST(intmath_int2),
ADD_TEST(intmath_int4),
Expand Down Expand Up @@ -58,8 +59,8 @@ test_definition test_list[] = {
ADD_TEST(image_r8),
ADD_TEST(barrier),
ADD_TEST_VERSION(wg_barrier, Version(2, 0)),
ADD_TEST(int2float),
ADD_TEST(float2int),
ADD_TEST(int2fp),
ADD_TEST(fp2int),
ADD_TEST(imagereadwrite),
ADD_TEST(imagereadwrite3d),
ADD_TEST(readimage3d),
Expand Down Expand Up @@ -155,7 +156,7 @@ test_definition test_list[] = {
ADD_TEST(simple_read_image_pitch),
ADD_TEST(simple_write_image_pitch),

#if defined( __APPLE__ )
#if defined(__APPLE__)
ADD_TEST(queue_priority),
#endif

Expand All @@ -164,9 +165,35 @@ test_definition test_list[] = {
};

const int test_num = ARRAY_SIZE( test_list );
cl_half_rounding_mode halfRoundingMode = CL_HALF_RTE;

test_status InitCL(cl_device_id device)
{
if (is_extension_available(device, "cl_khr_fp16"))
{
const cl_device_fp_config fpConfigHalf =
get_default_rounding_mode(device, CL_DEVICE_HALF_FP_CONFIG);
if ((fpConfigHalf & CL_FP_ROUND_TO_NEAREST) != 0)
{
halfRoundingMode = CL_HALF_RTE;
}
else if ((fpConfigHalf & CL_FP_ROUND_TO_ZERO) != 0)
{
halfRoundingMode = CL_HALF_RTZ;
}
else
{
log_error("Error while acquiring half rounding mode");
return TEST_FAIL;
}
}

return TEST_PASS;
}

int main(int argc, const char *argv[])
{
return runTestHarness(argc, argv, test_num, test_list, false, 0);
return runTestHarnessWithCheck(argc, argv, test_num, test_list, false, 0,
InitCL);
}

16 changes: 9 additions & 7 deletions test_conformance/basic/procs.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Copyright (c) 2017 The Khronos Group Inc.
//
// 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
Expand All @@ -13,6 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//

#include "harness/kernelHelpers.h"
#include "harness/testHarness.h"
#include "harness/errorHelpers.h"
Expand All @@ -21,9 +22,8 @@
#include "harness/rounding_mode.h"

extern int test_hostptr(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_fpmath_float(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_fpmath_float2(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_fpmath_float4(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_fpmath(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements);
extern int test_intmath_int(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_intmath_int2(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_intmath_int4(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
Expand Down Expand Up @@ -52,8 +52,10 @@ extern int test_image_r8(cl_device_id deviceID, cl_context context, cl_comm
extern int test_simplebarrier(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_barrier(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_wg_barrier(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_int2float(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_float2int(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_int2fp(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements);
extern int test_fp2int(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements);
extern int test_imagearraycopy(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_imagearraycopy3d(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_imagereadwrite(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
Expand Down
7 changes: 3 additions & 4 deletions test_conformance/basic/test_astype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
// limitations under the License.
//
#include "harness/compat.h"
#include "harness/conversions.h"
#include "harness/stringHelpers.h"
#include "harness/typeWrappers.h"

#include <limits.h>
#include <stdio.h>
Expand All @@ -22,11 +25,7 @@
#include <sys/stat.h>
#include <vector>

#include "harness/conversions.h"
#include "harness/typeWrappers.h"

#include "procs.h"
#include "utils.h"

// clang-format off

Expand Down
Loading

0 comments on commit 9cdb098

Please sign in to comment.