Skip to content

Commit

Permalink
Merge branch 'main' into semaphore_negative_clEnqueueSignalSemaphoresKHR
Browse files Browse the repository at this point in the history
  • Loading branch information
shajder committed Aug 27, 2024
2 parents e1e3516 + 6cbe8ca commit dc72b54
Show file tree
Hide file tree
Showing 81 changed files with 3,662 additions and 4,935 deletions.
10 changes: 4 additions & 6 deletions presubmit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
-DOPENCL_ICD_LOADER_HEADERS_DIR=${TOP}/OpenCL-Headers/
cmake --build . -j2
cmake --build . --parallel

#Vulkan Loader
cd ${TOP}
Expand All @@ -78,7 +78,7 @@ cmake .. -G Ninja \
-DBUILD_WSI_XCB_SUPPORT=OFF \
-DBUILD_WSI_WAYLAND_SUPPORT=OFF \
-C helper.cmake ..
cmake --build . -j2
cmake --build . --parallel

# Build CTS
cd ${TOP}
Expand All @@ -87,14 +87,12 @@ mkdir build
cd build
if [[ ${RUNNER_OS} == "Windows" ]]; then
CMAKE_OPENCL_LIBRARIES_OPTION="OpenCL"
CMAKE_CACHE_OPTIONS=""
else
CMAKE_OPENCL_LIBRARIES_OPTION="-lOpenCL -lpthread"
CMAKE_CACHE_OPTIONS="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache"
fi
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE="${BUILD_CONFIG}" \
${CMAKE_CACHE_OPTIONS} \
-DCMAKE_CACHE_OPTIONS="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache" \
-DCL_INCLUDE_DIR=${TOP}/OpenCL-Headers \
-DCL_LIB_DIR=${TOP}/OpenCL-ICD-Loader/build \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
Expand All @@ -105,4 +103,4 @@ cmake .. -G Ninja \
-DVULKAN_IS_SUPPORTED=${BUILD_VULKAN_TEST} \
-DVULKAN_INCLUDE_DIR=${TOP}/Vulkan-Headers/include/ \
-DVULKAN_LIB_DIR=${TOP}/Vulkan-Loader/build/loader/
cmake --build . -j3
cmake --build . --parallel
41 changes: 0 additions & 41 deletions readme-spir-v-binaries.txt

This file was deleted.

41 changes: 0 additions & 41 deletions test_common/config.hpp

This file was deleted.

34 changes: 18 additions & 16 deletions test_common/harness/conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,11 @@ static Long sLowerLimits[kNumExplicitTypes] = {
} \
break;

#define TO_HALF_CASE(inType) \
#define TO_HALF_CASE(inType, halfRoundingMode) \
case kHalf: \
halfPtr = (cl_half *)outRaw; \
*halfPtr = cl_half_from_float((float)(*inType##Ptr), CL_HALF_RTE); \
*halfPtr = \
cl_half_from_float((float)(*inType##Ptr), halfRoundingMode); \
break;
#define TO_FLOAT_CASE(inType) \
case kFloat: \
Expand Down Expand Up @@ -453,6 +454,7 @@ typedef unsigned long ulong;

void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
bool saturate, RoundingType roundType,
cl_half_rounding_mode halfRoundingMode,
ExplicitType outType)
{
bool *boolPtr;
Expand Down Expand Up @@ -537,7 +539,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
SIMPLE_CAST_CASE(schar, kULong, ULong)
SIMPLE_CAST_CASE(schar, kUnsignedLong, ULong)

TO_HALF_CASE(schar)
TO_HALF_CASE(schar, halfRoundingMode)
TO_FLOAT_CASE(schar)
TO_DOUBLE_CASE(schar)

Expand Down Expand Up @@ -570,7 +572,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
SIMPLE_CAST_CASE(uchar, kULong, ULong)
SIMPLE_CAST_CASE(uchar, kUnsignedLong, ULong)

TO_HALF_CASE(uchar)
TO_HALF_CASE(uchar, halfRoundingMode)
TO_FLOAT_CASE(uchar)
TO_DOUBLE_CASE(uchar)

Expand Down Expand Up @@ -603,7 +605,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
SIMPLE_CAST_CASE(uchar, kULong, ULong)
SIMPLE_CAST_CASE(uchar, kUnsignedLong, ULong)

TO_HALF_CASE(uchar)
TO_HALF_CASE(uchar, halfRoundingMode)
TO_FLOAT_CASE(uchar)
TO_DOUBLE_CASE(uchar)

Expand Down Expand Up @@ -636,7 +638,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
SIMPLE_CAST_CASE(short, kULong, ULong)
SIMPLE_CAST_CASE(short, kUnsignedLong, ULong)

TO_HALF_CASE(short)
TO_HALF_CASE(short, halfRoundingMode)
TO_FLOAT_CASE(short)
TO_DOUBLE_CASE(short)

Expand Down Expand Up @@ -669,7 +671,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
SIMPLE_CAST_CASE(ushort, kULong, ULong)
SIMPLE_CAST_CASE(ushort, kUnsignedLong, ULong)

TO_HALF_CASE(ushort)
TO_HALF_CASE(ushort, halfRoundingMode)
TO_FLOAT_CASE(ushort)
TO_DOUBLE_CASE(ushort)

Expand Down Expand Up @@ -702,7 +704,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
SIMPLE_CAST_CASE(ushort, kULong, ULong)
SIMPLE_CAST_CASE(ushort, kUnsignedLong, ULong)

TO_HALF_CASE(ushort)
TO_HALF_CASE(ushort, halfRoundingMode)
TO_FLOAT_CASE(ushort)
TO_DOUBLE_CASE(ushort)

Expand Down Expand Up @@ -735,7 +737,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
SIMPLE_CAST_CASE(int, kULong, ULong)
SIMPLE_CAST_CASE(int, kUnsignedLong, ULong)

TO_HALF_CASE(int)
TO_HALF_CASE(int, halfRoundingMode)
TO_FLOAT_CASE(int)
TO_DOUBLE_CASE(int)

Expand Down Expand Up @@ -768,7 +770,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
SIMPLE_CAST_CASE(uint, kULong, ULong)
SIMPLE_CAST_CASE(uint, kUnsignedLong, ULong)

TO_HALF_CASE(uint)
TO_HALF_CASE(uint, halfRoundingMode)
TO_FLOAT_CASE(uint)
TO_DOUBLE_CASE(uint)

Expand Down Expand Up @@ -801,7 +803,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
SIMPLE_CAST_CASE(uint, kULong, ULong)
SIMPLE_CAST_CASE(uint, kUnsignedLong, ULong)

TO_HALF_CASE(uint)
TO_HALF_CASE(uint, halfRoundingMode)
TO_FLOAT_CASE(uint)
TO_DOUBLE_CASE(uint)

Expand Down Expand Up @@ -834,7 +836,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
DOWN_CAST_CASE(Long, kULong, ULong, saturate)
DOWN_CAST_CASE(Long, kUnsignedLong, ULong, saturate)

TO_HALF_CASE(Long)
TO_HALF_CASE(Long, halfRoundingMode)
TO_FLOAT_CASE(Long)
TO_DOUBLE_CASE(Long)

Expand Down Expand Up @@ -867,7 +869,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
U_DOWN_CAST_CASE(ULong, kUnsignedInt, uint, saturate)
U_DOWN_CAST_CASE(ULong, kLong, Long, saturate)

TO_HALF_CASE(ULong)
TO_HALF_CASE(ULong, halfRoundingMode)
TO_FLOAT_CASE(ULong)
TO_DOUBLE_CASE(ULong)

Expand Down Expand Up @@ -900,7 +902,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
U_DOWN_CAST_CASE(ULong, kUnsignedInt, uint, saturate)
U_DOWN_CAST_CASE(ULong, kLong, Long, saturate)

TO_HALF_CASE(ULong)
TO_HALF_CASE(ULong, halfRoundingMode)
TO_FLOAT_CASE(ULong)
TO_DOUBLE_CASE(ULong)

Expand Down Expand Up @@ -969,7 +971,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
FLOAT_ROUND_CASE(kULong, ULong, roundType, saturate)
FLOAT_ROUND_CASE(kUnsignedLong, ULong, roundType, saturate)

TO_HALF_CASE(float)
TO_HALF_CASE(float, halfRoundingMode)

case kFloat:
memcpy(outRaw, inRaw, get_explicit_type_size(inType));
Expand Down Expand Up @@ -1003,7 +1005,7 @@ void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType,
DOUBLE_ROUND_CASE(kULong, ULong, roundType, saturate)
DOUBLE_ROUND_CASE(kUnsignedLong, ULong, roundType, saturate)

TO_HALF_CASE(double)
TO_HALF_CASE(double, halfRoundingMode)

TO_FLOAT_CASE(double);

Expand Down
3 changes: 3 additions & 0 deletions test_common/harness/conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <string.h>
#include <sys/types.h>

#include <CL/cl_half.h>

/* Note: the next three all have to match in size and order!! */

enum ExplicitTypes
Expand Down Expand Up @@ -71,6 +73,7 @@ extern const char *get_explicit_type_name(ExplicitType type);
extern void convert_explicit_value(void *inRaw, void *outRaw,
ExplicitType inType, bool saturate,
RoundingType roundType,
cl_half_rounding_mode halfRoundingMode,
ExplicitType outType);

extern void generate_random_data(ExplicitType type, size_t count, MTdata d,
Expand Down
39 changes: 39 additions & 0 deletions test_common/harness/deviceInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,42 @@ size_t get_max_param_size(cl_device_id device)
}
return ret;
}

static cl_ulong get_device_info_max_size(cl_device_id device,
cl_device_info info,
unsigned int divisor)
{
cl_ulong max_size;

if (divisor == 0)
{
throw std::runtime_error("Allocation divisor should not be 0\n");
}

if (clGetDeviceInfo(device, info, sizeof(max_size), &max_size, NULL)
!= CL_SUCCESS)
{
throw std::runtime_error("clGetDeviceInfo failed\n");
}
return max_size / divisor;
}

cl_ulong get_device_info_max_mem_alloc_size(cl_device_id device,
unsigned int divisor)
{
return get_device_info_max_size(device, CL_DEVICE_MAX_MEM_ALLOC_SIZE,
divisor);
}

cl_ulong get_device_info_global_mem_size(cl_device_id device,
unsigned int divisor)
{
return get_device_info_max_size(device, CL_DEVICE_GLOBAL_MEM_SIZE, divisor);
}

cl_ulong get_device_info_max_constant_buffer_size(cl_device_id device,
unsigned int divisor)
{
return get_device_info_max_size(device, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE,
divisor);
}
15 changes: 12 additions & 3 deletions test_common/harness/deviceInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
#ifndef _deviceInfo_h
#define _deviceInfo_h

// Configuration
#include "../config.hpp"

#include <string>

#include <CL/opencl.h>
Expand Down Expand Up @@ -51,4 +48,16 @@ std::string get_device_name(cl_device_id device);
// Returns the maximum size in bytes for Kernel Parameters
size_t get_max_param_size(cl_device_id device);

/* We need to use a portion of available alloc size,
* divide it to leave some memory for the platform. */
#define MAX_DEVICE_MEMORY_SIZE_DIVISOR (2)

/* Get max allocation size. */
cl_ulong get_device_info_max_mem_alloc_size(cl_device_id device,
unsigned int divisor = 1);
cl_ulong get_device_info_global_mem_size(cl_device_id device,
unsigned int divisor = 1);
cl_ulong get_device_info_max_constant_buffer_size(cl_device_id device,
unsigned int divisor = 1);

#endif // _deviceInfo_h
3 changes: 0 additions & 3 deletions test_common/harness/kernelHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
#ifndef _kernelHelpers_h
#define _kernelHelpers_h

// Configuration
#include "../config.hpp"

#include "compat.h"
#include "testHarness.h"

Expand Down
4 changes: 2 additions & 2 deletions test_conformance/SVM/test_allocate_shared_buffer_negative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int test_svm_allocate_shared_buffer_negative(cl_device_id deviceID,
// under construction...
err = create_cl_objects(deviceID, NULL, &context, &program, &queues[0],
&num_devices, CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
if (err) return -1;
if (err) return err;

size_t size = 1024;

Expand Down Expand Up @@ -98,5 +98,5 @@ int test_svm_allocate_shared_buffer_negative(cl_device_id deviceID,
clSVMFree(context, pBufData1);
}

return 0;
return TEST_PASS;
}
Loading

0 comments on commit dc72b54

Please sign in to comment.