Skip to content

Commit

Permalink
Merge branch 'main' into fp16_basic_vloadstore
Browse files Browse the repository at this point in the history
  • Loading branch information
shajder committed Jul 5, 2023
2 parents c3f337b + 9e8430a commit 3550cbf
Show file tree
Hide file tree
Showing 66 changed files with 3,814 additions and 2,270 deletions.
4 changes: 2 additions & 2 deletions test_common/gl/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,7 @@ void * CreateGLRenderbuffer( GLsizei width, GLsizei height,
// Reverse and reorder to validate since in the
// kernel the read_imagef() call always returns RGBA
cl_uchar *p = (cl_uchar *)buffer;
for( size_t i = 0; i < (size_t)width * height; i++ )
for (GLsizei i = 0; i < width * height; i++)
{
cl_uchar uc0 = p[i * 4 + 0];
cl_uchar uc1 = p[i * 4 + 1];
Expand All @@ -1733,7 +1733,7 @@ void * CreateGLRenderbuffer( GLsizei width, GLsizei height,
// Reverse and reorder to validate since in the
// kernel the read_imagef() call always returns RGBA
cl_uchar *p = (cl_uchar *)buffer;
for( size_t i = 0; i < width * height; i++ )
for (GLsizei i = 0; i < width * height; i++)
{
cl_uchar uc0 = p[i * 4 + 0];
cl_uchar uc1 = p[i * 4 + 1];
Expand Down
6 changes: 3 additions & 3 deletions test_common/harness/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef _COMPAT_H_
#define _COMPAT_H_
#ifndef COMPAT_H_
#define COMPAT_H_

#if defined(_WIN32) && defined(_MSC_VER)
#include <Windows.h>
Expand Down Expand Up @@ -398,4 +398,4 @@ EXTERN_C int __builtin_clz(unsigned int pattern);
#define sleep(sec) Sleep((sec)*1000)
#endif

#endif // _COMPAT_H_
#endif // COMPAT_H_
4 changes: 2 additions & 2 deletions test_common/harness/crc32.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Agreement or Khronos Conformance Test Source License Agreement as
executed between Khronos and the recipient.
******************************************************************/

#ifndef _CRC32_H_
#define _CRC32_H_
#ifndef CRC32_H_
#define CRC32_H_

#include <stdint.h>
#include <stddef.h>
Expand Down
6 changes: 3 additions & 3 deletions test_common/harness/stringHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
// limitations under the License.
//

#ifndef BASIC_UTILS_H
#define BASIC_UTILS_H
#ifndef STRING_HELPERS_H
#define STRING_HELPERS_H

#include <memory>
#include <string>
Expand All @@ -38,4 +38,4 @@ inline std::string str_sprintf(const std::string &str, Args... args)
return std::string(buffer.get(), buffer.get() + s - 1);
}

#endif // BASIC_UTIL_H
#endif // STRING_HELPERS_H
4 changes: 2 additions & 2 deletions test_common/harness/testHarness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,9 +835,9 @@ void callTestFunctions(test_definition testList[],
std::vector<std::thread *> threads;
test_harness_state state = { testList, resultTestList, deviceToUse,
config };
for (int i = 0; i < config.numWorkerThreads; i++)
for (unsigned i = 0; i < config.numWorkerThreads; i++)
{
log_info("Spawning worker thread %i\n", i);
log_info("Spawning worker thread %u\n", i);
threads.push_back(new std::thread(test_function_runner, &state));
}

Expand Down
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
Loading

0 comments on commit 3550cbf

Please sign in to comment.