update fp16 staging branch from main (#1903)

* allocations: Move results array from stack to heap (#1857)

* allocations: Fix stack overflow

* check format fixes

* Fix windows stack overflow. (#1839)

* thread_dimensions: Avoid combinations of very small LWS and very large GWS (#1856)

Modify the existing condition to include extremely small LWS like
1x1 on large GWS values

* c11_atomics: Reduce the loopcounter for sequential consistency tests (#1853)

Reduce the loop from 1000000 to 500000 since the former value
makes the test run too long and cause system issues on certain
platforms

* Limit individual allocation size using the global memory size (#1835)

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>

* geometrics: fix Wsign-compare warnings (#1855)

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>

* integer_ops: fix -Wformat warnings (#1860)

The main sources of warnings were:

 * Printing of a `size_t` which requires the `%zu` specifier.

 * Printing of `cl_long`/`cl_ulong` which is now done using the
   `PRI*64` macros to ensure portability across 32 and 64-bit builds.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>

* Replace OBSOLETE_FORAMT with OBSOLETE_FORMAT (#1776)

* Replace OBSOLETE_FORAMT with OBSOLETE_FORMAT

In imageHelpers.cpp and few other places in image tests, OBSOLETE_FORMAT is misspelled as OBSOLETE_FORAMT.
Fix misspelling by replcaing it with OBSOLETE_FORMAT.

Fixes #1769

* Remove code guarded by OBSOLETE_FORMAT

Remove code guarded by OBSOLETE_FORMAT
as suggested by review comments

Fixes #1769

* Fix formating issues for OBSOLETE_FORMAT changes

Fix formatting issues observed in files while removing
code guarded by OBSOLETE_FORMAT

Fixes #1769

* Some more formatting fixes

Some more formatting fixes to get CI clean

Fixes #1769

* Final Formating fixes

Final formatting fixes for #1769

* Enhancement: Thread dimensions user parameters (#1384)

* Fix format in the test scope

* Add user params to limit testing

Add parameters to reduce amount of testing.
Helpful for debugging or for machines with lower performance.

* Restore default value

* Print info only if testing params bigger than 0.

* [NFC] conversions: reenable Wunused-but-set-variable (#1845)

Remove an assigned-to but unused variable.

Reenable the Wunused-but-set-variable warning for the conversions
suite, as it now compiles cleanly with this warning enabled.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>

* Fix bug of conversion from long to double (#1847)

* Fix bug of conversion from long to double

It the input is long type, it should be load as long type, not ulong.

* update long2float

* math_brute_force: fix exp/exp2 rlx ULP calculation (#1848)

Fix the ULP error calculation for the `exp` and `exp2` builtins in
relaxed math mode for the full profile.

Previously, the `ulps` value kept being added to while verifying the
result buffer in a loop.  `ulps` could even become a `NaN` when the
input argument being tested was a `NaN`.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>

* Enable LARGEADDRESSAWARE for 32 bit compilation (#1858)

* Enable LARGEADDRESSAWARE for 32 bit compilation

32-bit executables built with MSVC linker have only 2GB virtual memory
address space by default, which might not be sufficient for some tests.

Enable LARGEADDRESSAWARE linker flag for 32-bit targets to allow tests
to handle addresses larger than 2 gigabytes.

https://learn.microsoft.com/en-us/cpp/build/reference/largeaddressaware-handle-large-addresses?view=msvc-170

Signed-off-by: Guo, Yilong <yilong.guo@intel.com>

* Apply suggestion

Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com>

---------

Signed-off-by: Guo, Yilong <yilong.guo@intel.com>
Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com>

* fix return code when readwrite image is not supported (#1873)

This function (do_test) starts by testing write and read individually.
Both of them can have errors.

When readwrite image is not supported, the function returns
TEST_SKIPPED_ITSELF potentially masking errors leading to the test
returning EXIT_SUCCESS even with errors along the way.

* fix macos builds by avoiding double compilation of function_list.cpp for test_spir (#1866)

* modernize CMakeLists for test_spir

* add the operating system release to the sccache key

* include the math brute force function list vs. building it twice

* fix the license header on the spirv-new tests (#1865)

The source files for the spirv-new tests were using the older Khronos
license instead of the proper Apache license.  Fixed the license in
all source files.

* compiler: fix grammar in error message (#1877)

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>

* Updated semaphore tests to use clSemaphoreReImportSyncFdKHR. (#1854)

* Updated semaphore tests to use clSemaphoreReImportSyncFdKHR.

Additionally updated common semaphore code to handle spec updates
that restrict simultaneous importing/exporting of handles.

* Fix build issues on CI

* gcc build issues

* Make clReImportSemaphoreSyncFdKHR a required API
call if cl_khr_external_semaphore_sync_fd is present.

* Implement signal and wait for all semaphore types.

* subgroups: fix for testing too large WG sizes (#1620)

It seemed to be a typo; the comment says that it
tries to fetch local size for a subgroup count with
above max WG size, but it just used the previous
subgroup count.

The test on purpose sets a SG count to be a larger
number than the max work-items in the work group.
Given the minimum SG size is 1 WI, it means that there
can be a maximum of maximum work-group size of SGs (of
1 WI of size). Thus, if we request a number of SGs that
exceeds the local size, the query should fail as expected.

* add SPIR-V version testing (#1861)

* basic SPIR-V 1.3 testing support

* updated script to compile for more SPIR-V versions

* switch to general SPIR-V versions test

* update copyright text and fix license

* improve output while test is running

* check for higher SPIR-V versions first

* fix formatting

* fix the reported platform information for math brute force (#1884)

When the math brute force test printed the platform version it always
printed information for the first platform in the system, which could
be different than the platform for the passed-in device.  Fixed by
querying the platform from the passed-in device instead.

* api tests fix: Use MTdataHolder in test_get_image_info (#1871)

* Minor fixes in mutable dispatch tests. (#1829)

* Minor fixes in mutable dispatch tests.

* Fix size of newWrapper in MutableDispatchSVMArguments.
* Fix errnoneus clCommandNDRangeKernelKHR call.

Signed-off-by: John Kesapides <john.kesapides@arm.com>

* * Set the row_pitch for imageInfo in MutableDispatchImage1DArguments
and MutableDispatchImage2DArguments. The row_pitch is
used by get_image_size() to calculate the size of
the host pointers by generate_random_image_data.

Signed-off-by: John Kesapides <john.kesapides@arm.com>

---------

Signed-off-by: John Kesapides <john.kesapides@arm.com>

* add test for cl_khr_spirv_linkonce_odr (#1226)

* initial version of the test with placeholders for linkonce_odr linkage

* add OpExtension SPV_KHR_linkonce_odr extension

* add check for extension

* switch to actual LinkOnceODR linkage

* fix formatting

* add a test case to ensure a function with linkonce_odr is exported

* add back the extension check

* fix formatting

* undo compiler optimization and actually add the call to function a

* [NFC] subgroups: remove unnecessary extern keywords (#1892)

In C and C++ all functions have external linkage by default.

Also remove the unused `gMTdata` and `test_pipe_functions`
declarations.

Fixes https://github.com/KhronosGroup/OpenCL-CTS/issues/1137

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>

* Added cl_khr_fp16 extension support for test_decorate from spirv_new (#1770)

* Added cl_khr_fp16 extension support for test_decorate from spirv_new, work in progres

* Complemented test_decorate saturation test to support cl_khr_fp16 extension (issue #142)

* Fixed clang format

* scope of modifications:

-changed naming convention of saturation .spvasm files related to
test_decorate of spirv_new
-restored float to char/uchar saturation tests
-few minor corrections

* fix ranges for half testing

* fix formating

* one more formatting fix

* remove unused function

* use isnan instead of std::isnan

isnan is currently implemented as a macro, not as a function, so
we can't use std::isnan.

* fix Clang warning about inexact conversion

---------

Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com>

* add support for custom devices (#1891)

enable the CTS to run on custom devices

---------

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Guo, Yilong <yilong.guo@intel.com>
Signed-off-by: John Kesapides <john.kesapides@arm.com>
Co-authored-by: Sreelakshmi Haridas Maruthur <sharidas@quicinc.com>
Co-authored-by: Haonan Yang <haonan.yang@intel.com>
Co-authored-by: Ahmed Hesham <117350656+ahesham-arm@users.noreply.github.com>
Co-authored-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Co-authored-by: niranjanjoshi121 <43807392+niranjanjoshi121@users.noreply.github.com>
Co-authored-by: Grzegorz Wawiorko <grzegorz.wawiorko@intel.com>
Co-authored-by: Wenwan Xing <wenwan.xing@intel.com>
Co-authored-by: Yilong Guo <yilong.guo@intel.com>
Co-authored-by: Romaric Jodin <89833130+rjodinchr@users.noreply.github.com>
Co-authored-by: joshqti <127994991+joshqti@users.noreply.github.com>
Co-authored-by: Pekka Jääskeläinen <pekka.jaaskelainen@tuni.fi>
Co-authored-by: imilenkovic00 <155085410+imilenkovic00@users.noreply.github.com>
Co-authored-by: John Kesapides <46718829+JohnKesapidesARM@users.noreply.github.com>
Co-authored-by: Marcin Hajder <marcin.hajder@gmail.com>
Co-authored-by: Aharon Abramson <aharon.abramson@mobileye.com>
This commit is contained in:
Ben Ashbaugh
2024-03-02 16:48:45 -08:00
committed by GitHub
parent d338b42e8f
commit 620c689919
122 changed files with 3877 additions and 1443 deletions

View File

@@ -157,6 +157,11 @@ if( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qlong-double -Qpc80 /DWIN32 /D_WINDOWS /W3 /GR /EHsc -nologo -Od -D_CRT_NONSTDC_NO_WARNINGS -EHsc -Wall -Qdiag-disable:68,111,177,186,161,869,1028,2259,2553,181,239,265,1188 -fp:strict -fp:source")
endif()
# To handle addresses larger than 2 gigabytes for 32bit targets
if(WIN32 AND ${CLConform_TARGET_ARCH} STREQUAL "x86")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
endif()
list(APPEND CLConform_LIBRARIES ${OPENCL_LIBRARIES})
if(ANDROID)
list(APPEND CLConform_LIBRARIES m)

View File

@@ -1,19 +1,18 @@
/******************************************************************
Copyright (c) 2016 The Khronos Group Inc.
All Rights Reserved. This code is protected by copyright laws and
contains material proprietary to the Khronos Group, Inc.
This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed
in whole or in part to third parties, and may not be reproduced, republished,
distributed, transmitted, displayed, broadcast or otherwise exploited in any
manner without the express prior written permission of Khronos Group.
The receipt or possession of this code does not convey any rights to
reproduce, disclose, or distribute its contents, or to
manufacture, use, or sell anything that it may describe, in whole
or in part other than under the terms of the Khronos Adopters
Agreement or Khronos Conformance Test Source License Agreement as
executed between Khronos and the recipient.
******************************************************************/
//
// Copyright (c) 2016-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.
//
#ifndef CRC32_H_
#define CRC32_H_

View File

@@ -97,23 +97,9 @@ uint32_t get_channel_data_type_size(cl_channel_type channelType)
case CL_UNSIGNED_INT32: return sizeof(cl_int);
case CL_UNORM_SHORT_565:
case CL_UNORM_SHORT_555:
#ifdef OBSOLETE_FORAMT
case CL_UNORM_SHORT_565_REV:
case CL_UNORM_SHORT_555_REV:
#endif
return 2;
case CL_UNORM_SHORT_555: return 2;
#ifdef OBSOLETE_FORAMT
case CL_UNORM_INT_8888:
case CL_UNORM_INT_8888_REV: return 4;
#endif
case CL_UNORM_INT_101010:
#ifdef OBSOLETE_FORAMT
case CL_UNORM_INT_101010_REV:
#endif
return 4;
case CL_UNORM_INT_101010: return 4;
case CL_FLOAT: return sizeof(cl_float);
@@ -294,23 +280,9 @@ uint32_t get_pixel_size(const cl_image_format *format)
return get_format_channel_count(format) * sizeof(cl_int);
case CL_UNORM_SHORT_565:
case CL_UNORM_SHORT_555:
#ifdef OBSOLETE_FORAMT
case CL_UNORM_SHORT_565_REV:
case CL_UNORM_SHORT_555_REV:
#endif
return 2;
case CL_UNORM_SHORT_555: return 2;
#ifdef OBSOLETE_FORAMT
case CL_UNORM_INT_8888:
case CL_UNORM_INT_8888_REV: return 4;
#endif
case CL_UNORM_INT_101010:
#ifdef OBSOLETE_FORAMT
case CL_UNORM_INT_101010_REV:
#endif
return 4;
case CL_UNORM_INT_101010: return 4;
case CL_FLOAT:
return get_format_channel_count(format) * sizeof(cl_float);

View File

@@ -347,48 +347,6 @@ void read_image_pixel(void *imageData, image_descriptor *imageInfo, int x,
break;
}
#ifdef OBSOLETE_FORMAT
case CL_UNORM_SHORT_565_REV: {
unsigned short *dPtr = (unsigned short *)ptr;
tempData[2] = (T)(dPtr[0] >> 11);
tempData[1] = (T)((dPtr[0] >> 5) & 63);
tempData[0] = (T)(dPtr[0] & 31);
break;
}
case CL_UNORM_SHORT_555_REV: {
unsigned short *dPtr = (unsigned short *)ptr;
tempData[2] = (T)((dPtr[0] >> 10) & 31);
tempData[1] = (T)((dPtr[0] >> 5) & 31);
tempData[0] = (T)(dPtr[0] & 31);
break;
}
case CL_UNORM_INT_8888: {
unsigned int *dPtr = (unsigned int *)ptr;
tempData[3] = (T)(dPtr[0] >> 24);
tempData[2] = (T)((dPtr[0] >> 16) & 0xff);
tempData[1] = (T)((dPtr[0] >> 8) & 0xff);
tempData[0] = (T)(dPtr[0] & 0xff);
break;
}
case CL_UNORM_INT_8888_REV: {
unsigned int *dPtr = (unsigned int *)ptr;
tempData[0] = (T)(dPtr[0] >> 24);
tempData[1] = (T)((dPtr[0] >> 16) & 0xff);
tempData[2] = (T)((dPtr[0] >> 8) & 0xff);
tempData[3] = (T)(dPtr[0] & 0xff);
break;
}
case CL_UNORM_INT_101010_REV: {
unsigned int *dPtr = (unsigned int *)ptr;
tempData[2] = (T)((dPtr[0] >> 20) & 0x3ff);
tempData[1] = (T)((dPtr[0] >> 10) & 0x3ff);
tempData[0] = (T)(dPtr[0] & 0x3ff);
break;
}
#endif
case CL_UNORM_SHORT_555: {
cl_ushort *dPtr = (cl_ushort *)ptr;
tempData[0] = (T)((dPtr[0] >> 10) & 31);

View File

@@ -185,6 +185,9 @@ int runTestHarnessWithCheck(int argc, const char *argv[], int testNum,
else if (strcmp(env_mode, "accelerator") == 0
|| strcmp(env_mode, "CL_DEVICE_TYPE_ACCELERATOR") == 0)
device_type = CL_DEVICE_TYPE_ACCELERATOR;
else if (strcmp(env_mode, "custom") == 0
|| strcmp(env_mode, "CL_DEVICE_TYPE_CUSTOM") == 0)
device_type = CL_DEVICE_TYPE_CUSTOM;
else if (strcmp(env_mode, "default") == 0
|| strcmp(env_mode, "CL_DEVICE_TYPE_DEFAULT") == 0)
device_type = CL_DEVICE_TYPE_DEFAULT;
@@ -314,6 +317,12 @@ int runTestHarnessWithCheck(int argc, const char *argv[], int testNum,
device_type = CL_DEVICE_TYPE_ACCELERATOR;
argc--;
}
else if (strcmp(argv[argc - 1], "custom") == 0
|| strcmp(argv[argc - 1], "CL_DEVICE_TYPE_CUSTOM") == 0)
{
device_type = CL_DEVICE_TYPE_CUSTOM;
argc--;
}
else if (strcmp(argv[argc - 1], "CL_DEVICE_TYPE_DEFAULT") == 0)
{
device_type = CL_DEVICE_TYPE_DEFAULT;
@@ -351,6 +360,9 @@ int runTestHarnessWithCheck(int argc, const char *argv[], int testNum,
case CL_DEVICE_TYPE_ACCELERATOR:
log_info("Requesting Accelerator device ");
break;
case CL_DEVICE_TYPE_CUSTOM:
log_info("Requesting Custom device ");
break;
case CL_DEVICE_TYPE_DEFAULT:
log_info("Requesting Default device ");
break;
@@ -1196,18 +1208,21 @@ Version get_device_spirv_il_version(cl_device_id device)
ASSERT_SUCCESS(err, "clGetDeviceInfo");
}
if (strstr(str.data(), "SPIR-V_1.0") != NULL)
return Version(1, 0);
else if (strstr(str.data(), "SPIR-V_1.1") != NULL)
return Version(1, 1);
else if (strstr(str.data(), "SPIR-V_1.2") != NULL)
return Version(1, 2);
else if (strstr(str.data(), "SPIR-V_1.3") != NULL)
return Version(1, 3);
// Because this query returns a space-separated list of IL version strings
// we should check for SPIR-V versions in reverse order, to return the
// highest version supported.
if (strstr(str.data(), "SPIR-V_1.5") != NULL)
return Version(1, 5);
else if (strstr(str.data(), "SPIR-V_1.4") != NULL)
return Version(1, 4);
else if (strstr(str.data(), "SPIR-V_1.5") != NULL)
return Version(1, 5);
else if (strstr(str.data(), "SPIR-V_1.3") != NULL)
return Version(1, 3);
else if (strstr(str.data(), "SPIR-V_1.2") != NULL)
return Version(1, 2);
else if (strstr(str.data(), "SPIR-V_1.1") != NULL)
return Version(1, 1);
else if (strstr(str.data(), "SPIR-V_1.0") != NULL)
return Version(1, 0);
throw std::runtime_error(std::string("Unknown SPIR-V version: ")
+ str.data());

View File

@@ -16,6 +16,8 @@
#include "common.h"
#include "harness/mt19937.h"
#include <vector>
#define GLOBAL_SIZE 65536
static const char *sources[] = {
@@ -75,9 +77,9 @@ wait_and_release(const char* s, cl_event* evs, int n)
int test_svm_migrate(cl_device_id deviceID, cl_context c, cl_command_queue queue, int num_elements)
{
cl_uint amem[GLOBAL_SIZE];
cl_uint bmem[GLOBAL_SIZE];
cl_uint cmem[GLOBAL_SIZE];
std::vector<cl_uint> amem(GLOBAL_SIZE);
std::vector<cl_uint> bmem(GLOBAL_SIZE);
std::vector<cl_uint> cmem(GLOBAL_SIZE);
cl_event evs[20];
const size_t global_size = GLOBAL_SIZE;
@@ -145,9 +147,9 @@ int test_svm_migrate(cl_device_id deviceID, cl_context c, cl_command_queue queue
test_error(error, "clSetKernelArgSVMPointer failed");
// Initialize host copy of data (and result)
fill_buffer(amem, global_size, seed);
fill_buffer(bmem, global_size, seed);
fill_buffer(cmem, global_size, seed);
fill_buffer(amem.data(), global_size, seed);
fill_buffer(bmem.data(), global_size, seed);
fill_buffer(cmem.data(), global_size, seed);
// Now we're ready to start
{
@@ -218,9 +220,9 @@ int test_svm_migrate(cl_device_id deviceID, cl_context c, cl_command_queue queue
if (error)
return -1;
memcpy((void *)asvm, (void *)amem, global_size*sizeof(cl_uint));
memcpy((void *)bsvm, (void *)bmem, global_size*sizeof(cl_uint));
memcpy((void *)csvm, (void *)cmem, global_size*sizeof(cl_uint));
memcpy((void *)asvm, (void *)amem.data(), global_size * sizeof(cl_uint));
memcpy((void *)bsvm, (void *)bmem.data(), global_size * sizeof(cl_uint));
memcpy((void *)csvm, (void *)cmem.data(), global_size * sizeof(cl_uint));
{
error = clEnqueueSVMUnmap(queues[1], (void *)asvm, 0, NULL, &evs[0]);
@@ -304,9 +306,9 @@ int test_svm_migrate(cl_device_id deviceID, cl_context c, cl_command_queue queue
return -1;
// Check kernel results
bool ok = check("memory a", (cl_uint *)asvm, amem, global_size);
ok &= check("memory b", (cl_uint *)bsvm, bmem, global_size);
ok &= check("memory c", (cl_uint *)csvm, cmem, global_size);
bool ok = check("memory a", (cl_uint *)asvm, amem.data(), global_size);
ok &= check("memory b", (cl_uint *)bsvm, bmem.data(), global_size);
ok &= check("memory c", (cl_uint *)csvm, cmem.data(), global_size);
{
void *ptrs[] = { asvm, bsvm, csvm };

View File

@@ -16,6 +16,8 @@
#include "allocation_execute.h"
#include "allocation_functions.h"
#include <vector>
const char *buffer_kernel_pattern = {
"__kernel void sample_test(%s __global uint *result, __global %s *array_sizes, uint per_item)\n"
@@ -155,7 +157,8 @@ int execute_kernel(cl_context context, cl_command_queue *queue, cl_device_id dev
size_t global_dims[3];
cl_uint per_item;
cl_uint per_item_uint;
cl_uint returned_results[NUM_OF_WORK_ITEMS], final_result;
cl_uint final_result;
std::vector<cl_uint> returned_results(NUM_OF_WORK_ITEMS);
clEventWrapper event;
cl_int event_status;
@@ -236,7 +239,9 @@ int execute_kernel(cl_context context, cl_command_queue *queue, cl_device_id dev
}
// Set the result
result_mem = clCreateBuffer(context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, sizeof(cl_uint)*NUM_OF_WORK_ITEMS, &returned_results, &error);
result_mem = clCreateBuffer(
context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR,
sizeof(cl_uint) * NUM_OF_WORK_ITEMS, returned_results.data(), &error);
test_error(error, "clCreateBuffer failed");
error = clSetKernelArg(kernel, i, sizeof(result_mem), &result_mem);
test_error(error, "clSetKernelArg failed");
@@ -342,7 +347,9 @@ int execute_kernel(cl_context context, cl_command_queue *queue, cl_device_id dev
// Verify the checksum.
// Read back the result
error = clEnqueueReadBuffer(*queue, result_mem, CL_TRUE, 0, sizeof(cl_uint)*NUM_OF_WORK_ITEMS, &returned_results, 0, NULL, NULL);
error = clEnqueueReadBuffer(*queue, result_mem, CL_TRUE, 0,
sizeof(cl_uint) * NUM_OF_WORK_ITEMS,
returned_results.data(), 0, NULL, NULL);
test_error_abort(error, "clEnqueueReadBuffer failed");
final_result = 0;
if (test == BUFFER || test == IMAGE_READ || test == BUFFER_NON_BLOCKING || test == IMAGE_READ_NON_BLOCKING) {

View File

@@ -93,6 +93,11 @@ test_status init_cl( cl_device_id device ) {
// queue, kernel code on GPU.
g_global_mem_size *= 0.60;
}
/* Cap the allocation size as the global size was deduced */
if (g_max_individual_allocation_size > g_global_mem_size)
{
g_max_individual_allocation_size = g_global_mem_size;
}
if( gReSeed )
{

View File

@@ -476,7 +476,8 @@ int test_get_image_info( cl_device_id deviceID, cl_context context, cl_mem_objec
CL_MEM_HOST_NO_ACCESS | CL_MEM_WRITE_ONLY | CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR,
CL_MEM_HOST_NO_ACCESS | CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
};
MTdata d;
MTdataHolder d_holder(gRandomSeed);
MTdata d = static_cast<MTdata>(d_holder);
PASSIVE_REQUIRE_IMAGE_SUPPORT( deviceID )
@@ -495,8 +496,6 @@ int test_get_image_info( cl_device_id deviceID, cl_context context, cl_mem_objec
imageInfo.buffer = NULL;
#endif
d = init_genrand( gRandomSeed );
for ( unsigned int i = 0; i < sizeof(imageFlags) / sizeof(cl_mem_flags); ++i )
{
imageInfo.image_row_pitch = 0;

View File

@@ -188,8 +188,9 @@ int test_sub_group_dispatch(cl_device_id deviceID, cl_context context, cl_comman
}
}
// test when input subgroup count exceeds max wg size
size_t large_sg_size = kernel_subgroup_count + 1;
// test when input subgroup count exceeds max wg size:
// there can be at most the local size of (1 WI) subgroups
size_t large_sg_size = max_local + 1;
error = clGetKernelSubGroupInfo(kernel, deviceID, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT, sizeof(size_t), &large_sg_size, sizeof(ret_ndrange1d), &ret_ndrange1d, &realSize);
test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT");
if (ret_ndrange1d != 0)

View File

@@ -20,7 +20,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <vector>
#include "procs.h"
#include "harness/conversions.h"
@@ -72,7 +72,7 @@ int test_work_item_functions(cl_device_id deviceID, cl_context context, cl_comma
clProgramWrapper program;
clKernelWrapper kernel;
clMemWrapper outData;
work_item_data testData[ 10240 ];
std::vector<work_item_data> testData(10240);
size_t threads[3], localThreads[3];
MTdata d;
@@ -80,7 +80,9 @@ int test_work_item_functions(cl_device_id deviceID, cl_context context, cl_comma
error = create_single_kernel_helper( context, &program, &kernel, 1, &workItemKernelCode, "sample_kernel" );
test_error( error, "Unable to create testing kernel" );
outData = clCreateBuffer( context, CL_MEM_READ_WRITE, sizeof( testData ), NULL, &error );
outData =
clCreateBuffer(context, CL_MEM_READ_WRITE,
sizeof(work_item_data) * testData.size(), NULL, &error);
test_error( error, "Unable to create output buffer" );
error = clSetKernelArg( kernel, 0, sizeof( outData ), &outData );
@@ -105,7 +107,10 @@ int test_work_item_functions(cl_device_id deviceID, cl_context context, cl_comma
error = clEnqueueNDRangeKernel( queue, kernel, (cl_uint)dim, NULL, threads, localThreads, 0, NULL, NULL );
test_error( error, "Unable to run kernel" );
error = clEnqueueReadBuffer( queue, outData, CL_TRUE, 0, sizeof( testData ), testData, 0, NULL, NULL );
error =
clEnqueueReadBuffer(queue, outData, CL_TRUE, 0,
sizeof(work_item_data) * testData.size(),
testData.data(), 0, NULL, NULL);
test_error( error, "Unable to read results" );
// Validate

View File

@@ -2827,7 +2827,7 @@ public:
// value from other thread
// - reads value from other thread's variable
// - repeats the above steps when both values are the same (and less
// than 1000000)
// than 500000)
// - stores the last value read from other thread (in additional
// variable) At the end of execution at least one thread should know
// the last value from other thread
@@ -2846,7 +2846,7 @@ public:
"memory_order_relaxed"
+ MemoryScopeStr()
+ ");\n"
" } while(myValue == hisValue && myValue < 1000000);\n"
" } while(myValue == hisValue && myValue < 500000);\n"
" "
+ nonAtomic + "[myId] = hisValue; \n";
}
@@ -2972,7 +2972,7 @@ public:
host_atomic_thread_fence(MemoryOrder());
hisValue = host_atomic_load<HostAtomicType, HostDataType>(
&destMemory[hisId], MEMORY_ORDER_RELAXED);
} while (myValue == hisValue && hisValue < 1000000);
} while (myValue == hisValue && hisValue < 500000);
oldValues[tid] = hisValue;
}
else
@@ -3053,11 +3053,11 @@ public:
if (myValue == hisValue)
{
// a draw - both threads should reach final value
// 1000000
if (myValue != 1000000)
// 500000
if (myValue != 500000)
{
log_error("ERROR: Invalid reference value #%u (%d "
"instead of 1000000)\n",
"instead of 500000)\n",
workOffset + i, myValue);
correct = false;
return true;

View File

@@ -34,8 +34,10 @@ pfnclEnqueueReleaseExternalMemObjectsKHR
clEnqueueReleaseExternalMemObjectsKHRptr;
pfnclReleaseSemaphoreKHR clReleaseSemaphoreKHRptr;
pfnclGetSemaphoreHandleForTypeKHR clGetSemaphoreHandleForTypeKHRptr;
pfnclReImportSemaphoreSyncFdKHR clReImportSemaphoreSyncFdKHRptr;
void init_cl_vk_ext(cl_platform_id opencl_platform)
void init_cl_vk_ext(cl_platform_id opencl_platform, cl_uint num_devices,
cl_device_id *deviceIds)
{
clEnqueueWaitSemaphoresKHRptr =
(pfnclEnqueueWaitSemaphoresKHR)clGetExtensionFunctionAddressForPlatform(
@@ -79,6 +81,21 @@ void init_cl_vk_ext(cl_platform_id opencl_platform)
throw std::runtime_error("Failed to get the function pointer of "
"clGetSemaphoreHandleForTypeKHRptr!");
}
// Required only if cl_khr_external_semaphore_sync_fd is reported
clReImportSemaphoreSyncFdKHRptr = (pfnclReImportSemaphoreSyncFdKHR)
clGetExtensionFunctionAddressForPlatform(
opencl_platform, "clReImportSemaphoreSyncFdKHR");
for (cl_uint i = 0; i < num_devices; i++)
{
if (is_extension_available(deviceIds[i],
"cl_khr_external_semaphore_sync_fd")
&& (NULL == clReImportSemaphoreSyncFdKHRptr))
{
throw std::runtime_error("Failed to get the function pointer of "
"clReImportSemaphoreSyncFdKHR!");
}
}
}
cl_int setMaxImageDimensions(cl_device_id deviceID, size_t &max_width,
@@ -669,7 +686,6 @@ clExternalMemoryImage::clExternalMemoryImage(
break;
#elif !defined(__APPLE__)
case VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD:
log_info(" Opaque file descriptors are not supported on Windows\n");
fd = (int)deviceMemory.getHandle(externalMemoryHandleType);
errcode_ret = check_external_memory_handle_type(
devList[0], CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR);
@@ -738,7 +754,9 @@ clExternalMemoryImage::clExternalMemoryImage() {}
// clExternalSemaphore implementation //
//////////////////////////////////////////
clExternalSemaphore::clExternalSemaphore(
clExternalSemaphore::~clExternalSemaphore() = default;
clExternalImportableSemaphore::clExternalImportableSemaphore(
const VulkanSemaphore &semaphore, cl_context context,
VulkanExternalSemaphoreHandleType externalSemaphoreHandleType,
cl_device_id deviceId)
@@ -759,17 +777,12 @@ clExternalSemaphore::clExternalSemaphore(
switch (externalSemaphoreHandleType)
{
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD:
#ifdef _WIN32
ASSERT(0);
#else
log_info(" Opaque file descriptors are not supported on Windows\n");
fd = (int)semaphore.getHandle(externalSemaphoreHandleType);
err = check_external_semaphore_handle_type(
devList[0], CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR);
sema_props.push_back(
(cl_semaphore_properties_khr)CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR);
sema_props.push_back((cl_semaphore_properties_khr)fd);
#endif
break;
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT:
#ifndef _WIN32
@@ -802,12 +815,10 @@ clExternalSemaphore::clExternalSemaphore(
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD:
err = check_external_semaphore_handle_type(
devList[0], CL_SEMAPHORE_HANDLE_SYNC_FD_KHR);
sema_props.push_back(static_cast<cl_semaphore_properties_khr>(
CL_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR));
sema_props.push_back(static_cast<cl_semaphore_properties_khr>(
CL_SEMAPHORE_HANDLE_SYNC_FD_KHR));
sema_props.push_back(static_cast<cl_semaphore_properties_khr>(
CL_SEMAPHORE_EXPORT_HANDLE_TYPES_LIST_END_KHR));
sema_props.push_back(static_cast<cl_semaphore_properties_khr>(-1));
break;
default:
ASSERT(0);
@@ -837,7 +848,7 @@ clExternalSemaphore::clExternalSemaphore(
}
}
clExternalSemaphore::~clExternalSemaphore() noexcept(false)
clExternalImportableSemaphore::~clExternalImportableSemaphore()
{
cl_int err = clReleaseSemaphoreKHRptr(m_externalSemaphore);
if (err != CL_SUCCESS)
@@ -846,7 +857,89 @@ clExternalSemaphore::~clExternalSemaphore() noexcept(false)
}
}
int clExternalSemaphore::signal(cl_command_queue cmd_queue)
int clExternalImportableSemaphore::wait(cl_command_queue cmd_queue)
{
int err = CL_SUCCESS;
if (m_externalHandleType == VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD)
{
cl_int err = 0;
fd = (int)m_deviceSemaphore.getHandle(m_externalHandleType);
err = clReImportSemaphoreSyncFdKHRptr(m_externalSemaphore, nullptr, fd);
if (err != CL_SUCCESS)
{
return err;
}
}
err = clEnqueueWaitSemaphoresKHRptr(cmd_queue, 1, &m_externalSemaphore,
NULL, 0, NULL, NULL);
return err;
}
int clExternalImportableSemaphore::signal(cl_command_queue cmd_queue)
{
return clEnqueueSignalSemaphoresKHRptr(cmd_queue, 1, &m_externalSemaphore,
NULL, 0, NULL, NULL);
}
cl_semaphore_khr &clExternalImportableSemaphore::getCLSemaphore()
{
return m_externalSemaphore;
}
clExternalExportableSemaphore::clExternalExportableSemaphore(
const VulkanSemaphore &semaphore, cl_context context,
VulkanExternalSemaphoreHandleType externalSemaphoreHandleType,
cl_device_id deviceId)
: m_deviceSemaphore(semaphore)
{
cl_int err = 0;
cl_device_id devList[] = { deviceId, NULL };
m_externalHandleType = externalSemaphoreHandleType;
m_externalSemaphore = nullptr;
m_device = deviceId;
m_context = context;
std::vector<cl_semaphore_properties_khr> sema_props{
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_KHR,
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_BINARY_KHR,
};
sema_props.push_back(
(cl_semaphore_properties_khr)CL_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR);
sema_props.push_back(
(cl_semaphore_properties_khr)getCLSemaphoreTypeFromVulkanType(
externalSemaphoreHandleType));
sema_props.push_back((cl_semaphore_properties_khr)
CL_SEMAPHORE_EXPORT_HANDLE_TYPES_LIST_END_KHR);
sema_props.push_back(
(cl_semaphore_properties_khr)CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR);
sema_props.push_back((cl_semaphore_properties_khr)devList[0]);
sema_props.push_back(
(cl_semaphore_properties_khr)CL_SEMAPHORE_DEVICE_HANDLE_LIST_END_KHR);
sema_props.push_back(0);
m_externalSemaphore =
clCreateSemaphoreWithPropertiesKHRptr(context, sema_props.data(), &err);
if (CL_SUCCESS != err)
{
log_error("clCreateSemaphoreWithPropertiesKHRptr failed with %d\n",
err);
throw std::runtime_error(
"clCreateSemaphoreWithPropertiesKHRptr failed! ");
}
}
clExternalExportableSemaphore::~clExternalExportableSemaphore()
{
cl_int err = clReleaseSemaphoreKHRptr(m_externalSemaphore);
if (err != CL_SUCCESS)
{
throw std::runtime_error("clReleaseSemaphoreKHR failed!");
}
}
int clExternalExportableSemaphore::signal(cl_command_queue cmd_queue)
{
int err = clEnqueueSignalSemaphoresKHRptr(
cmd_queue, 1, &m_externalSemaphore, NULL, 0, NULL, nullptr);
@@ -886,60 +979,13 @@ int clExternalSemaphore::signal(cl_command_queue cmd_queue)
return err;
}
int clExternalSemaphore::wait(cl_command_queue cmd_queue)
int clExternalExportableSemaphore::wait(cl_command_queue command_queue)
{
int err = CL_SUCCESS;
if (m_externalHandleType == VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD)
{
cl_int err = 0;
cl_device_id devList[] = { m_device, NULL };
std::vector<cl_semaphore_properties_khr> sema_props{
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_KHR,
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_BINARY_KHR,
};
fd = (int)m_deviceSemaphore.getHandle(m_externalHandleType);
err = check_external_semaphore_handle_type(
devList[0], CL_SEMAPHORE_HANDLE_SYNC_FD_KHR);
if (CL_SUCCESS != err)
{
log_error("CL_SEMAPHORE_HANDLE_SYNC_FD_KHR not supported\n");
return err;
}
sema_props.push_back(
(cl_semaphore_properties_khr)CL_SEMAPHORE_HANDLE_SYNC_FD_KHR);
sema_props.push_back((cl_semaphore_properties_khr)fd);
sema_props.push_back(0);
if (m_externalSemaphore)
{
err = clReleaseSemaphoreKHRptr(m_externalSemaphore);
if (err != CL_SUCCESS)
{
log_error("Failed to release CL external semaphore\n");
return err;
}
m_externalSemaphore = nullptr;
}
m_externalSemaphore = clCreateSemaphoreWithPropertiesKHRptr(
m_context, sema_props.data(), &err);
if (CL_SUCCESS != err)
{
log_error("clCreateSemaphoreWithPropertiesKHRptr failed with %d\n",
err);
return err;
}
}
err = clEnqueueWaitSemaphoresKHRptr(cmd_queue, 1, &m_externalSemaphore,
NULL, 0, NULL, NULL);
return err;
return clEnqueueWaitSemaphoresKHRptr(command_queue, 1, &m_externalSemaphore,
NULL, 0, NULL, nullptr);
}
cl_semaphore_khr &clExternalSemaphore::getCLSemaphore()
cl_semaphore_khr &clExternalExportableSemaphore::getCLSemaphore()
{
return m_externalSemaphore;
}

View File

@@ -54,6 +54,9 @@ typedef cl_int (*pfnclGetSemaphoreHandleForTypeKHR)(
cl_semaphore_khr sema_object, cl_device_id device,
cl_external_semaphore_handle_type_khr handleType, size_t handle_size,
void *handle, size_t *handleSize);
typedef cl_int (*pfnclReImportSemaphoreSyncFdKHR)(
cl_semaphore_khr sema_object,
cl_semaphore_reimport_properties_khr *reimport_props, int fd);
extern pfnclCreateSemaphoreWithPropertiesKHR
clCreateSemaphoreWithPropertiesKHRptr;
@@ -64,6 +67,7 @@ extern pfnclEnqueueAcquireExternalMemObjectsKHR
extern pfnclEnqueueReleaseExternalMemObjectsKHR
clEnqueueReleaseExternalMemObjectsKHRptr;
extern pfnclReleaseSemaphoreKHR clReleaseSemaphoreKHRptr;
extern pfnclReImportSemaphoreSyncFdKHR pfnclReImportSemaphoreSyncFdKHRptr;
cl_int getCLImageInfoFromVkImageInfo(const VkImageCreateInfo *, size_t,
cl_image_format *, cl_image_desc *);
@@ -97,7 +101,6 @@ protected:
cl_mem m_externalMemory;
int fd;
void *handle;
cl_command_queue cmd_queue;
clExternalMemoryImage();
public:
@@ -112,6 +115,15 @@ public:
};
class clExternalSemaphore {
public:
virtual int signal(cl_command_queue command_queue) = 0;
virtual int wait(cl_command_queue command_queue) = 0;
virtual cl_semaphore_khr &getCLSemaphore() = 0;
virtual ~clExternalSemaphore() = 0;
};
class clExternalImportableSemaphore : public virtual clExternalSemaphore {
protected:
cl_semaphore_khr m_externalSemaphore;
VulkanExternalSemaphoreHandleType m_externalHandleType;
@@ -122,18 +134,39 @@ protected:
void *handle;
public:
clExternalSemaphore(
clExternalImportableSemaphore(
const VulkanSemaphore &deviceSemaphore, cl_context context,
VulkanExternalSemaphoreHandleType externalSemaphoreHandleType,
cl_device_id deviceId);
virtual ~clExternalSemaphore() noexcept(false);
int signal(cl_command_queue command_queue);
int wait(cl_command_queue command_queue);
cl_semaphore_khr &getCLSemaphore();
// operator openclExternalSemaphore_t() const;
~clExternalImportableSemaphore() override;
int wait(cl_command_queue command_queue) override;
int signal(cl_command_queue command_queue) override;
cl_semaphore_khr &getCLSemaphore() override;
};
extern void init_cl_vk_ext(cl_platform_id);
class clExternalExportableSemaphore : public virtual clExternalSemaphore {
protected:
cl_semaphore_khr m_externalSemaphore;
VulkanExternalSemaphoreHandleType m_externalHandleType;
cl_device_id m_device;
cl_context m_context;
const VulkanSemaphore &m_deviceSemaphore;
int fd;
void *handle;
public:
clExternalExportableSemaphore(
const VulkanSemaphore &deviceSemaphore, cl_context context,
VulkanExternalSemaphoreHandleType externalSemaphoreHandleType,
cl_device_id deviceId);
~clExternalExportableSemaphore() override;
int signal(cl_command_queue command_queue) override;
int wait(cl_command_queue command_queue) override;
cl_semaphore_khr &getCLSemaphore() override;
};
extern void init_cl_vk_ext(cl_platform_id, cl_uint num_devices,
cl_device_id *deviceIds);
VulkanImageTiling vkClExternalMemoryHandleTilingAssumption(
cl_device_id deviceId,

View File

@@ -171,8 +171,8 @@ cl_int check_compiler_feature_info(cl_device_id deviceID, cl_context context,
}
else
{
log_error("Error: The macro feature is defined and undefined "
"in the same time\n");
log_error("Error: The feature macro is defined and undefined "
"at the same time\n");
error = OutputBuildLogs(program_supported, 1, &deviceID);
test_error(error, "OutputBuildLogs failed.\n");
error = OutputBuildLogs(program_not_supported, 1, &deviceID);

View File

@@ -16,6 +16,6 @@ set_source_files_properties(
COMPILE_FLAGS -march=i686)
endif(NOT CMAKE_CL_64 AND NOT MSVC AND NOT ANDROID)
set_gnulike_module_compile_flags("-Wno-unused-but-set-variable -Wno-sign-compare")
set_gnulike_module_compile_flags("-Wno-sign-compare")
include(../CMakeCommon.txt)

View File

@@ -467,11 +467,11 @@ void DataInfoSpec<InType, OutType, InFP, OutFP>::conv(OutType *out, InType *in)
if (std::is_same<cl_double, OutType>::value)
{
#if defined(_MSC_VER)
cl_ulong l = ((cl_ulong *)in)[0];
double result;
if (std::is_same<cl_ulong, InType>::value)
{
cl_ulong l = ((cl_ulong *)in)[0];
cl_long sl = ((cl_long)l < 0) ? (cl_long)((l >> 1) | (l & 1))
: (cl_long)l;
#if defined(_M_X64)
@@ -484,6 +484,7 @@ void DataInfoSpec<InType, OutType, InFP, OutFP>::conv(OutType *out, InType *in)
}
else
{
cl_long l = ((cl_long *)in)[0];
#if defined(_M_X64)
_mm_store_sd(&result, _mm_cvtsi64_sd(_mm_setzero_pd(), l));
#else
@@ -504,10 +505,10 @@ void DataInfoSpec<InType, OutType, InFP, OutFP>::conv(OutType *out, InType *in)
cl_float outVal = 0.f;
#if defined(_MSC_VER) && defined(_M_X64)
cl_ulong l = ((cl_ulong *)in)[0];
float result;
if (std::is_same<cl_ulong, InType>::value)
{
cl_ulong l = ((cl_ulong *)in)[0];
cl_long sl = ((cl_long)l < 0) ? (cl_long)((l >> 1) | (l & 1))
: (cl_long)l;
_mm_store_ss(&result, _mm_cvtsi64_ss(_mm_setzero_ps(), sl));
@@ -516,6 +517,7 @@ void DataInfoSpec<InType, OutType, InFP, OutFP>::conv(OutType *out, InType *in)
}
else
{
cl_long l = ((cl_long *)in)[0];
_mm_store_ss(&result, _mm_cvtsi64_ss(_mm_setzero_ps(), l));
outVal = (l == 0 ? 0.0f : result); // Per IEEE-754-2008 5.4.1,
// 0's always convert to +0.0

View File

@@ -198,7 +198,6 @@ float qcom_u64_2_f32(uint64_t data, bool sat, roundingMode rnd)
return as_float(result);
}
case qcomRTN: {
int inExact = 0;
if (!data)
return 0.0f;
uint32_t exponent = (127 + 64 - clz(data) - 1) << (FLT_MANT_DIG - 1); //add 1 for the implied 1.0 in normalized fp32 numbers
@@ -206,8 +205,6 @@ float qcom_u64_2_f32(uint64_t data, bool sat, roundingMode rnd)
uint32_t mantissa;
if (mantShift >= 0){
uint64_t temp = (uint64_t)data >> mantShift;
if (temp << mantShift != data)
inExact = 1;
mantissa = (uint32_t)temp;
}
else

View File

@@ -664,8 +664,8 @@ struct MutableDispatchSVMArguments : public BasicMutableCommandBufferTest
// Allocate and initialize SVM for modified execution
cl_int *newWrapper =
(cl_int *)clSVMAlloc(context, CL_MEM_READ_WRITE, sizeof(cl_int), 0);
cl_int *newWrapper = (cl_int *)clSVMAlloc(context, CL_MEM_READ_WRITE,
sizeof(cl_int *), 0);
cl_int *newBuffer = (cl_int *)clSVMAlloc(
context, CL_MEM_READ_WRITE, num_elements * sizeof(cl_int), 0);
test_assert_error(newWrapper != nullptr && newBuffer != nullptr,

View File

@@ -92,6 +92,7 @@ struct MutableDispatchImage1DArguments : public BasicMutableCommandBufferTest
imageInfo.type = CL_MEM_OBJECT_IMAGE1D;
imageInfo.format = &formats;
imageInfo.width = 4;
imageInfo.rowPitch = imageInfo.width * get_pixel_size(imageInfo.format);
BufferOwningPtr<char> imageValues_input, imageValues_output, outputData;
MTdataHolder d(gRandomSeed);
@@ -285,6 +286,7 @@ struct MutableDispatchImage2DArguments : public BasicMutableCommandBufferTest
imageInfo.width = 4;
imageInfo.height = 4;
imageInfo.format = &formats;
imageInfo.rowPitch = imageInfo.width * get_pixel_size(imageInfo.format);
BufferOwningPtr<char> imageValues_input, imageValues_output;

View File

@@ -207,7 +207,7 @@ struct Dimensions : public InfoMutableCommandBufferTest
{
cl_int error = clCommandNDRangeKernelKHR(
command_buffer, nullptr, nullptr, kernel, dimensions, nullptr,
&global_work_size, nullptr, 0, nullptr, nullptr, &command);
global_work_size_3d, nullptr, 0, nullptr, nullptr, &command);
test_error(error, "clCommandNDRangeKernelKHR failed");
cl_uint test_dimensions = 0;
@@ -231,6 +231,7 @@ struct Dimensions : public InfoMutableCommandBufferTest
cl_mutable_command_khr command = nullptr;
const size_t dimensions = 3;
const size_t global_work_size_3d[3] = { 64, 1, 1 };
};
struct InfoType : public InfoMutableCommandBufferTest

View File

@@ -64,7 +64,7 @@ static void log_info_semaphore_type(
log_info("%s", semaphore_type_description.str().c_str());
}
static int init_vuikan_device()
static int init_vuikan_device(cl_uint num_devices, cl_device_id* deviceIds)
{
cl_platform_id platform = nullptr;
@@ -77,7 +77,7 @@ static int init_vuikan_device()
return err;
}
init_cl_vk_ext(platform);
init_cl_vk_ext(platform, num_devices, deviceIds);
return CL_SUCCESS;
}
@@ -101,7 +101,7 @@ int test_external_semaphores_queries(cl_device_id deviceID, cl_context context,
return TEST_SKIPPED_ITSELF;
}
if (init_vuikan_device())
if (init_vuikan_device(1, &deviceID))
{
log_info("Cannot initialise Vulkan. "
"Skipping test.\n");
@@ -130,8 +130,8 @@ int test_external_semaphores_queries(cl_device_id deviceID, cl_context context,
VulkanSemaphore vkVk2CLSemaphore(vkDevice,
vkExternalSemaphoreHandleType);
clExternalSemaphore sema_ext(vkVk2CLSemaphore, context,
vkExternalSemaphoreHandleType, deviceID);
clExternalImportableSemaphore sema_ext(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceID);
// Needed by the macro
cl_semaphore_khr sema = sema_ext.getCLSemaphore();
@@ -181,7 +181,7 @@ int test_external_semaphores_multi_context(cl_device_id deviceID,
return TEST_SKIPPED_ITSELF;
}
if (init_vuikan_device())
if (init_vuikan_device(1, &deviceID))
{
log_info("Cannot initialise Vulkan. "
"Skipping test.\n");
@@ -219,10 +219,11 @@ int test_external_semaphores_multi_context(cl_device_id deviceID,
return TEST_FAIL;
}
clExternalSemaphore sema_ext_1(vkVk2CLSemaphore, context,
vkExternalSemaphoreHandleType, deviceID);
clExternalSemaphore sema_ext_2(vkVk2CLSemaphore, context2,
vkExternalSemaphoreHandleType, deviceID);
clExternalExportableSemaphore sema_ext_1(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceID);
clExternalExportableSemaphore sema_ext_2(vkVk2CLSemaphore, context2,
vkExternalSemaphoreHandleType,
deviceID);
clCommandQueueWrapper queue1 =
clCreateCommandQueue(context, deviceID, 0, &err);
@@ -288,7 +289,7 @@ static int semaphore_external_cross_queue_helper(cl_device_id deviceID,
return TEST_SKIPPED_ITSELF;
}
if (init_vuikan_device())
if (init_vuikan_device(1, &deviceID))
{
log_info("Cannot initialise Vulkan. "
"Skipping test.\n");
@@ -313,8 +314,8 @@ static int semaphore_external_cross_queue_helper(cl_device_id deviceID,
VulkanSemaphore vkVk2CLSemaphore(vkDevice,
vkExternalSemaphoreHandleType);
clExternalSemaphore sema_ext(vkVk2CLSemaphore, context,
vkExternalSemaphoreHandleType, deviceID);
clExternalExportableSemaphore sema_ext(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceID);
// Obtain pointers to semaphore's API
GET_PFN(deviceID, clEnqueueSignalSemaphoresKHR);
@@ -362,7 +363,7 @@ int test_external_semaphores_simple_1(cl_device_id deviceID, cl_context context,
return TEST_SKIPPED_ITSELF;
}
if (init_vuikan_device())
if (init_vuikan_device(1, &deviceID))
{
log_info("Cannot initialise Vulkan. "
"Skipping test.\n");
@@ -392,8 +393,8 @@ int test_external_semaphores_simple_1(cl_device_id deviceID, cl_context context,
VulkanSemaphore vkVk2CLSemaphore(vkDevice,
vkExternalSemaphoreHandleType);
clExternalSemaphore sema_ext(vkVk2CLSemaphore, context,
vkExternalSemaphoreHandleType, deviceID);
clExternalExportableSemaphore sema_ext(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceID);
cl_int err = CL_SUCCESS;
@@ -439,7 +440,7 @@ int test_external_semaphores_simple_2(cl_device_id deviceID, cl_context context,
return TEST_SKIPPED_ITSELF;
}
if (init_vuikan_device())
if (init_vuikan_device(1, &deviceID))
{
log_info("Cannot initialise Vulkan. "
"Skipping test.\n");
@@ -468,8 +469,8 @@ int test_external_semaphores_simple_2(cl_device_id deviceID, cl_context context,
VulkanSemaphore vkVk2CLSemaphore(vkDevice,
vkExternalSemaphoreHandleType);
clExternalSemaphore sema_ext(vkVk2CLSemaphore, context,
vkExternalSemaphoreHandleType, deviceID);
clExternalExportableSemaphore sema_ext(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceID);
cl_int err = CL_SUCCESS;
@@ -545,7 +546,7 @@ int test_external_semaphores_reuse(cl_device_id deviceID, cl_context context,
return TEST_SKIPPED_ITSELF;
}
if (init_vuikan_device())
if (init_vuikan_device(1, &deviceID))
{
log_info("Cannot initialise Vulkan. "
"Skipping test.\n");
@@ -574,8 +575,8 @@ int test_external_semaphores_reuse(cl_device_id deviceID, cl_context context,
VulkanSemaphore vkVk2CLSemaphore(vkDevice,
vkExternalSemaphoreHandleType);
clExternalSemaphore sema_ext(vkVk2CLSemaphore, context,
vkExternalSemaphoreHandleType, deviceID);
clExternalExportableSemaphore sema_ext(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceID);
cl_int err = CL_SUCCESS;
@@ -668,7 +669,7 @@ static int external_semaphore_cross_queue_helper(cl_device_id deviceID,
return TEST_SKIPPED_ITSELF;
}
if (init_vuikan_device())
if (init_vuikan_device(1, &deviceID))
{
log_info("Cannot initialise Vulkan. "
"Skipping test.\n");
@@ -697,8 +698,8 @@ static int external_semaphore_cross_queue_helper(cl_device_id deviceID,
VulkanSemaphore vkVk2CLSemaphore(vkDevice,
vkExternalSemaphoreHandleType);
clExternalSemaphore sema_ext(vkVk2CLSemaphore, context,
vkExternalSemaphoreHandleType, deviceID);
clExternalExportableSemaphore sema_ext(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceID);
cl_int err = CL_SUCCESS;
@@ -785,7 +786,7 @@ int test_external_semaphores_cross_queues_io2(cl_device_id deviceID,
return TEST_SKIPPED_ITSELF;
}
if (init_vuikan_device())
if (init_vuikan_device(1, &deviceID))
{
log_info("Cannot initialise Vulkan. "
"Skipping test.\n");
@@ -823,10 +824,11 @@ int test_external_semaphores_cross_queues_io2(cl_device_id deviceID,
VulkanSemaphore vkVk2CLSemaphore(vkDevice,
vkExternalSemaphoreHandleType);
clExternalSemaphore sema_ext_1(vkVk2CLSemaphore, context,
vkExternalSemaphoreHandleType, deviceID);
clExternalSemaphore sema_ext_2(vkVk2CLSemaphore, context2,
vkExternalSemaphoreHandleType, deviceID);
clExternalExportableSemaphore sema_ext_1(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceID);
clExternalExportableSemaphore sema_ext_2(vkVk2CLSemaphore, context2,
vkExternalSemaphoreHandleType,
deviceID);
clCommandQueueWrapper queue1 =
clCreateCommandQueue(context, deviceID, 0, &err);
@@ -891,7 +893,7 @@ int test_external_semaphores_multi_signal(cl_device_id deviceID,
return TEST_SKIPPED_ITSELF;
}
if (init_vuikan_device())
if (init_vuikan_device(1, &deviceID))
{
log_info("Cannot initialise Vulkan. "
"Skipping test.\n");
@@ -922,10 +924,12 @@ int test_external_semaphores_multi_signal(cl_device_id deviceID,
VulkanSemaphore vkVk2CLSemaphore2(vkDevice,
vkExternalSemaphoreHandleType);
clExternalSemaphore sema_ext_1(vkVk2CLSemaphore1, context,
vkExternalSemaphoreHandleType, deviceID);
clExternalSemaphore sema_ext_2(vkVk2CLSemaphore2, context,
vkExternalSemaphoreHandleType, deviceID);
clExternalExportableSemaphore sema_ext_1(vkVk2CLSemaphore1, context,
vkExternalSemaphoreHandleType,
deviceID);
clExternalExportableSemaphore sema_ext_2(vkVk2CLSemaphore2, context,
vkExternalSemaphoreHandleType,
deviceID);
cl_int err = CL_SUCCESS;
@@ -980,7 +984,7 @@ int test_external_semaphores_multi_wait(cl_device_id deviceID,
return TEST_SKIPPED_ITSELF;
}
if (init_vuikan_device())
if (init_vuikan_device(1, &deviceID))
{
log_info("Cannot initialise Vulkan. "
"Skipping test.\n");
@@ -1011,10 +1015,12 @@ int test_external_semaphores_multi_wait(cl_device_id deviceID,
VulkanSemaphore vkVk2CLSemaphore2(vkDevice,
vkExternalSemaphoreHandleType);
clExternalSemaphore sema_ext_1(vkVk2CLSemaphore1, context,
vkExternalSemaphoreHandleType, deviceID);
clExternalSemaphore sema_ext_2(vkVk2CLSemaphore2, context,
vkExternalSemaphoreHandleType, deviceID);
clExternalExportableSemaphore sema_ext_1(vkVk2CLSemaphore1, context,
vkExternalSemaphoreHandleType,
deviceID);
clExternalExportableSemaphore sema_ext_2(vkVk2CLSemaphore2, context,
vkExternalSemaphoreHandleType,
deviceID);
cl_int err = CL_SUCCESS;

View File

@@ -6,7 +6,5 @@ set(${MODULE_NAME}_SOURCES
test_geometrics.cpp
)
set_gnulike_module_compile_flags("-Wno-sign-compare")
include(../CMakeCommon.txt)

View File

@@ -189,7 +189,7 @@ int test_geom_cross_double(cl_device_id deviceID, cl_context context, cl_command
clKernelWrapper kernel;
clMemWrapper streams[3];
cl_double testVector[4];
int error, i;
int error;
size_t threads[1], localThreads[1];
BufferOwningPtr<cl_double> A(malloc(bufSize));
BufferOwningPtr<cl_double> B(malloc(bufSize));
@@ -203,7 +203,7 @@ int test_geom_cross_double(cl_device_id deviceID, cl_context context, cl_command
return -1;
/* Generate some streams. Note: deliberately do some random data in w to verify that it gets ignored */
for( i = 0; i < size * vecsize; i++ )
for (unsigned int i = 0; i < size * vecsize; i++)
{
inDataA[ i ] = get_random_double( -512.f, 512.f, d );
inDataB[ i ] = get_random_double( -512.f, 512.f, d );
@@ -233,7 +233,7 @@ int test_geom_cross_double(cl_device_id deviceID, cl_context context, cl_command
}
/* Assign streams and execute */
for( i = 0; i < 3; i++ )
for (unsigned int i = 0; i < 3; i++)
{
error = clSetKernelArg(kernel, i, sizeof( streams[i] ), &streams[i]);
test_error( error, "Unable to set indexed kernel arguments" );
@@ -253,7 +253,7 @@ int test_geom_cross_double(cl_device_id deviceID, cl_context context, cl_command
test_error( error, "Unable to read output array!" );
/* And verify! */
for( i = 0; i < size; i++ )
for (unsigned int i = 0; i < size; i++)
{
double errorTolerances[ 4 ];
// On an embedded device w/ round-to-zero, 3 ulps is the worst-case tolerance for cross product
@@ -265,9 +265,12 @@ int test_geom_cross_double(cl_device_id deviceID, cl_context context, cl_command
if( errs[ 0 ] > errorTolerances[ 0 ] || errs[ 1 ] > errorTolerances[ 1 ] || errs[ 2 ] > errorTolerances[ 2 ] )
{
log_error( "ERROR: Data sample %d does not validate! Expected (%a,%a,%a,%a), got (%a,%a,%a,%a)\n",
i, testVector[0], testVector[1], testVector[2], testVector[3],
outData[i*vecsize], outData[i*vecsize+1], outData[i*vecsize+2], outData[i*vecsize+3] );
log_error("ERROR: Data sample %u does not validate! Expected "
"(%a,%a,%a,%a), got (%a,%a,%a,%a)\n",
i, testVector[0], testVector[1], testVector[2],
testVector[3], outData[i * vecsize],
outData[i * vecsize + 1], outData[i * vecsize + 2],
outData[i * vecsize + 3]);
log_error( " Input: (%a %a %a) and (%a %a %a)\n",
inDataA[ i * vecsize + 0 ], inDataA[ i * vecsize + 1 ], inDataA[ i * vecsize + 2 ],
inDataB[ i * vecsize + 0 ], inDataB[ i * vecsize + 1 ], inDataB[ i * vecsize + 2 ] );

View File

@@ -16,26 +16,12 @@
#include "common.h"
cl_channel_type floatFormats[] = {
CL_UNORM_SHORT_565,
CL_UNORM_SHORT_555,
CL_UNORM_INT_101010,
#ifdef OBSOLETE_FORAMT
CL_UNORM_SHORT_565_REV,
CL_UNORM_SHORT_555_REV,
CL_UNORM_INT_8888,
CL_UNORM_INT_8888_REV,
CL_UNORM_INT_101010_REV,
#endif
CL_UNORM_SHORT_565, CL_UNORM_SHORT_555, CL_UNORM_INT_101010,
#ifdef CL_SFIXED14_APPLE
CL_SFIXED14_APPLE,
#endif
CL_UNORM_INT8,
CL_SNORM_INT8,
CL_UNORM_INT16,
CL_SNORM_INT16,
CL_FLOAT,
CL_HALF_FLOAT,
(cl_channel_type)-1,
CL_UNORM_INT8, CL_SNORM_INT8, CL_UNORM_INT16, CL_SNORM_INT16,
CL_FLOAT, CL_HALF_FLOAT, (cl_channel_type)-1,
};
cl_channel_type intFormats[] = {

View File

@@ -202,7 +202,7 @@ static int doTest( cl_device_id device, cl_context context, cl_command_queue que
if ((testTypesToRun & kReadWriteTests)
&& checkForReadWriteImageSupport(device))
{
return TEST_SKIPPED_ITSELF;
return ret;
}
if( ( testTypesToRun & kReadWriteTests ) && !gTestMipmaps )

View File

@@ -15,6 +15,8 @@
//
#include "harness/compat.h"
#include <cinttypes>
#include <stdio.h>
#include <string.h>
#include <limits.h>
@@ -35,7 +37,12 @@ static int verify_abs_char( const void *p, const void *q, size_t n, const char *
if( inA[i] < 0 )
r = -inA[i];
if( r != outptr[i] )
{ log_info( "%ld) Failure for abs( (char%s) 0x%2.2x) = *0x%2.2x vs 0x%2.2x\n", i, sizeName, inA[i],r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for abs( (char%s) 0x%2.2x) = *0x%2.2x vs "
"0x%2.2x\n",
i, sizeName, inA[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -52,7 +59,12 @@ static int verify_abs_short( const void *p, const void *q, size_t n, const char
if( inA[i] < 0 )
r = -inA[i];
if( r != outptr[i] )
{ log_info( "%ld) Failure for abs( (short%s) 0x%4.4x) = *0x%4.4x vs 0x%4.4x\n", i, sizeName, inA[i],r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for abs( (short%s) 0x%4.4x) = *0x%4.4x vs "
"0x%4.4x\n",
i, sizeName, inA[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -68,7 +80,12 @@ static int verify_abs_int( const void *p, const void *q, size_t n, const char *s
if( inA[i] < 0 )
r = -inA[i];
if( r != outptr[i] )
{ log_info( "%ld) Failure for abs( (int%s) 0x%2.2x) = *0x%8.8x vs 0x%8.8x\n", i, sizeName, inA[i],r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for abs( (int%s) 0x%2.2x) = *0x%8.8x vs "
"0x%8.8x\n",
i, sizeName, inA[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -84,7 +101,12 @@ static int verify_abs_long( const void *p, const void *q, size_t n, const char *
if( inA[i] < 0 )
r = -inA[i];
if( r != outptr[i] )
{ log_info( "%ld) Failure for abs( (long%s) 0x%16.16llx) = *0x%16.16llx vs 0x%16.16llx\n", i, sizeName, inA[i],r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for abs( (long%s) 0x%16.16" PRIx64
") = *0x%16.16" PRIx64 " vs 0x%16.16" PRIx64 "\n",
i, sizeName, inA[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -100,7 +122,12 @@ static int verify_abs_uchar( const void *p, const void *q, size_t n, const char
{
cl_uchar r = inA[i];
if( r != outptr[i] )
{ log_info( "%ld) Failure for abs( (uchar%s) 0x%2.2x) = *0x%2.2x vs 0x%2.2x\n", i, sizeName, inA[i],r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for abs( (uchar%s) 0x%2.2x) = *0x%2.2x vs "
"0x%2.2x\n",
i, sizeName, inA[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -115,7 +142,12 @@ static int verify_abs_ushort( const void *p, const void *q, size_t n, const char
{
cl_ushort r = inA[i];
if( r != outptr[i] )
{ log_info( "%ld) Failure for abs( (short%s) 0x%4.4x) = *0x%4.4x vs 0x%4.4x\n", i, sizeName, inA[i],r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for abs( (short%s) 0x%4.4x) = *0x%4.4x vs "
"0x%4.4x\n",
i, sizeName, inA[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -129,7 +161,12 @@ static int verify_abs_uint( const void *p, const void *q, size_t n, const char *
{
cl_uint r = inA[i];
if( r != outptr[i] )
{ log_info( "%ld) Failure for abs( (int%s) 0x%2.2x) = *0x%8.8x vs 0x%8.8x\n", i, sizeName, inA[i],r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for abs( (int%s) 0x%2.2x) = *0x%8.8x vs "
"0x%8.8x\n",
i, sizeName, inA[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -143,7 +180,12 @@ static int verify_abs_ulong( const void *p, const void *q, size_t n, const char
{
cl_ulong r = inA[i];
if( r != outptr[i] )
{ log_info( "%ld) Failure for abs( (long%s) 0x%16.16llx) = *0x%16.16llx vs 0x%16.16llx\n", i, sizeName, inA[i],r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for abs( (long%s) 0x%16.16" PRIx64
") = *0x%16.16" PRIx64 " vs 0x%16.16" PRIx64 "\n",
i, sizeName, inA[i], r, outptr[i]);
return -1;
}
}
return 0;
}

View File

@@ -20,6 +20,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <cinttypes>
#include "procs.h"
template <class Integer>
@@ -43,7 +45,12 @@ static int verify_absdiff_char( const void *p, const void *q, const void *r, siz
{
cl_uchar r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (char%s) 0x%2.2x, (char%s) 0x%2.2x) = *0x%2.2x vs 0x%2.2x\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (char%s) 0x%2.2x, (char%s) "
"0x%2.2x) = *0x%2.2x vs 0x%2.2x\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -58,7 +65,12 @@ static int verify_absdiff_uchar( const void *p, const void *q, const void *r, si
{
cl_uchar r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (uchar%s) 0x%2.2x, (uchar%s) 0x%2.2x) = *0x%2.2x vs 0x%2.2x\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (uchar%s) 0x%2.2x, (uchar%s) "
"0x%2.2x) = *0x%2.2x vs 0x%2.2x\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -73,7 +85,12 @@ static int verify_absdiff_short( const void *p, const void *q, const void *r, si
{
cl_ushort r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (short%s) 0x%4.4x, (short%s) 0x%4.4x) = *0x%4.4x vs 0x%4.4x\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (short%s) 0x%4.4x, (short%s) "
"0x%4.4x) = *0x%4.4x vs 0x%4.4x\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -88,7 +105,12 @@ static int verify_absdiff_ushort( const void *p, const void *q, const void *r, s
{
cl_ushort r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (ushort%s) 0x%4.4x, (ushort%s) 0x%4.4x) = *0x%4.4x vs 0x%4.4x\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (ushort%s) 0x%4.4x, (ushort%s) "
"0x%4.4x) = *0x%4.4x vs 0x%4.4x\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -104,7 +126,9 @@ static int verify_absdiff_int( const void *p, const void *q, const void *r, size
cl_uint r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{
log_info( "%ld) Failure for absdiff( (int%s) 0x%8.8x, (int%s) 0x%8.8x) = *0x%8.8x vs 0x%8.8x\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] );
log_info("%zu) Failure for absdiff( (int%s) 0x%8.8x, (int%s) "
"0x%8.8x) = *0x%8.8x vs 0x%8.8x\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
@@ -121,7 +145,12 @@ static int verify_absdiff_uint( const void *p, const void *q, const void *r, siz
{
cl_uint r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (uint%s) 0x%8.8x, (uint%s) 0x%8.8x) = *0x%8.8x vs 0x%8.8x\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (uint%s) 0x%8.8x, (uint%s) "
"0x%8.8x) = *0x%8.8x vs 0x%8.8x\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -136,7 +165,13 @@ static int verify_absdiff_long( const void *p, const void *q, const void *r, siz
{
cl_ulong r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (long%s) 0x%16.16llx, (long%s) 0x%16.16llx) = *0x%16.16llx vs 0x%16.16llx\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (long%s) 0x%16.16" PRIx64
", (long%s) 0x%16.16" PRIx64 ") = *0x%16.16" PRIx64
" vs 0x%16.16" PRIx64 "\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -151,7 +186,13 @@ static int verify_absdiff_ulong( const void *p, const void *q, const void *r, si
{
cl_ulong r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (ulong%s) 0x%16.16llx, (ulong%s) 0x%16.16llx) = *0x%16.16llx vs 0x%16.16llx\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (ulong%s) 0x%16.16" PRIx64
", (ulong%s) 0x%16.16" PRIx64 ") = *0x%16.16" PRIx64
" vs 0x%16.16" PRIx64 "\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}

View File

@@ -22,6 +22,7 @@
#include <sys/stat.h>
#include <algorithm>
#include <cinttypes>
#include "procs.h"
@@ -140,7 +141,13 @@ static int verify_addsat_long( const cl_long *inA, const cl_long *inB, const cl_
r = CL_LONG_MIN;
}
if( r != outptr[i] )
{ log_info( "%d) Failure for add_sat( (long%s) 0x%16.16llx, (long%s) 0x%16.16llx) = *0x%16.16llx vs 0x%16.16llx\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%d) Failure for add_sat( (long%s) 0x%16.16" PRIx64
", (long%s) 0x%16.16" PRIx64 ") = *0x%16.16" PRIx64
" vs 0x%16.16" PRIx64 "\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -154,7 +161,13 @@ static int verify_addsat_ulong( const cl_ulong *inA, const cl_ulong *inB, const
if( r < inA[i] )
r = CL_ULONG_MAX;
if( r != outptr[i] )
{ log_info( "%d) Failure for add_sat( (ulong%s) 0x%16.16llx, (ulong%s) 0x%16.16llx) = *0x%16.16llx vs 0x%16.16llx\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%d) Failure for add_sat( (ulong%s) 0x%16.16" PRIx64
", (ulong%s) 0x%16.16" PRIx64 ") = *0x%16.16" PRIx64
" vs 0x%16.16" PRIx64 "\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}

View File

@@ -17,6 +17,7 @@
#include "harness/conversions.h"
#include <algorithm>
#include <cinttypes>
#define TEST_SIZE 512
@@ -198,13 +199,23 @@ int test_single_param_integer_kernel(cl_command_queue queue, cl_context context,
case 8:
if( useOpKernel )
log_error( "ERROR: Data sample %d:%d does not validate! Expected (0x%16.16llx), got (0x%16.16llx), sources (0x%16.16llx, 0x%16.16llx)\n",
(int)i, (int)j, ((cl_ulong*)&expected)[0], *( (cl_ulong *)p ),
*( (cl_ulong *)in ), *( (cl_ulong *)in2 ) );
log_error("ERROR: Data sample %d:%d does not "
"validate! Expected (0x%16.16" PRIx64
"), got (0x%16.16" PRIx64
"), sources (0x%16.16" PRIx64
", 0x%16.16" PRIx64 ")\n",
(int)i, (int)j,
((cl_ulong *)&expected)[0],
*((cl_ulong *)p), *((cl_ulong *)in),
*((cl_ulong *)in2));
else
log_error( "ERROR: Data sample %d:%d does not validate! Expected (0x%16.16llx), got (0x%16.16llx), sources (0x%16.16llx)\n",
(int)i, (int)j, ((cl_ulong*)&expected)[0], *( (cl_ulong *)p ),
*( (cl_ulong *)in ) );
log_error("ERROR: Data sample %d:%d does not "
"validate! Expected (0x%16.16" PRIx64
"), got (0x%16.16" PRIx64
"), sources (0x%16.16" PRIx64 ")\n",
(int)i, (int)j,
((cl_ulong *)&expected)[0],
*((cl_ulong *)p), *((cl_ulong *)in));
break;
}
return -1;
@@ -750,10 +761,14 @@ int test_two_param_integer_kernel(cl_command_queue queue, cl_context context, co
break;
case 8:
log_error( "ERROR: Data sample %d:%d does not validate! Expected (0x%16.16llx), got (0x%16.16llx), sources (0x%16.16llx, 0x%16.16llx)\n",
(int)i, (int)j, ((cl_ulong*)&expected)[ 0 ], *( (cl_ulong *)out ),
*( (cl_ulong *)inA ),
*( (cl_ulong *)inB ) );
log_error("ERROR: Data sample %d:%d does not validate! "
"Expected (0x%16.16" PRIx64
"), got (0x%16.16" PRIx64
"), sources (0x%16.16" PRIx64
", 0x%16.16" PRIx64 ")\n",
(int)i, (int)j, ((cl_ulong *)&expected)[0],
*((cl_ulong *)out), *((cl_ulong *)inA),
*((cl_ulong *)inB));
break;
}
return -1;
@@ -1417,11 +1432,14 @@ int test_three_param_integer_kernel(cl_command_queue queue, cl_context context,
break;
case 8:
log_error( "ERROR: Data sample %d:%d does not validate! Expected (0x%16.16llx), got (0x%16.16llx), sources (0x%16.16llx, 0x%16.16llx, 0x%16.16llx)\n",
(int)i, (int)j, ((cl_ulong*)&expected)[ 0 ], *( (cl_ulong *)out ),
*( (cl_ulong *)inA ),
*( (cl_ulong *)inB ),
*( (cl_ulong *)inC ) );
log_error("ERROR: Data sample %d:%d does not validate! "
"Expected (0x%16.16" PRIx64
"), got (0x%16.16" PRIx64
"), sources (0x%16.16" PRIx64
", 0x%16.16" PRIx64 ", 0x%16.16" PRIx64 ")\n",
(int)i, (int)j, ((cl_ulong *)&expected)[0],
*((cl_ulong *)out), *((cl_ulong *)inA),
*((cl_ulong *)inB), *((cl_ulong *)inC));
break;
}
return -1;

View File

@@ -139,8 +139,10 @@ verify_int_mad24(int *inptrA, int *inptrB, int *inptrC, int *outptr, size_t n, s
r = a * b + inptrC[i];
if (r != outptr[i])
{
log_error( "Failed at %ld) 0x%8.8x * 0x%8.8x + 0x%8.8x = *0x%8.8x vs 0x%8.8x\n", i, a, b, inptrC[i], r, outptr[i] );
return -1;
log_error("Failed at %zu) 0x%8.8x * 0x%8.8x + 0x%8.8x = *0x%8.8x "
"vs 0x%8.8x\n",
i, a, b, inptrC[i], r, outptr[i]);
return -1;
}
}
@@ -160,8 +162,10 @@ verify_uint_mad24(cl_uint *inptrA, cl_uint *inptrB, cl_uint *inptrC, cl_uint *ou
r = a * b + inptrC[i];
if (r != outptr[i])
{
log_error( "Failed at %ld) 0x%8.8x * 0x%8.8x + 0x%8.8x = *0x%8.8x vs 0x%8.8x\n", i, a, b, inptrC[i], r, outptr[i] );
return -1;
log_error("Failed at %zu) 0x%8.8x * 0x%8.8x + 0x%8.8x = *0x%8.8x "
"vs 0x%8.8x\n",
i, a, b, inptrC[i], r, outptr[i]);
return -1;
}
}

View File

@@ -153,8 +153,10 @@ verify_uint_mul24(cl_uint *inptrA, cl_uint *inptrB, cl_uint *outptr, size_t n, s
r = (inptrA[i] & 0xffffffU) * (inptrB[i] & 0xffffffU);
if (r != outptr[i])
{
log_error( "failed at %ld: 0x%8.8x * 0x%8.8x = *0x%8.8x vs 0x%8.8x\n", i, inptrA[i], inptrB[i], r, outptr[i] );
return -1;
log_error(
"failed at %zu: 0x%8.8x * 0x%8.8x = *0x%8.8x vs 0x%8.8x\n", i,
inptrA[i], inptrB[i], r, outptr[i]);
return -1;
}
}

View File

@@ -20,6 +20,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <cinttypes>
#include "procs.h"
#define str(s) #s
@@ -36,26 +38,29 @@
} \
}
#define __verify_popcount_func(__T) \
static int verify_popcount_##__T( const void *p, const void *r, size_t n, const char *sizeName, size_t vecSize ) \
{ \
const __T *inA = (const __T *) p; \
const __T *outptr = (const __T *) r; \
size_t i; \
int _n = sizeof(__T)*8; \
__T ref; \
for(i = 0; i < n; i++) \
{ \
__T x = inA[i]; \
__T res = outptr[i]; \
__popcnt(x, __T, _n, ref); \
if(res != ref) \
{ \
log_info( "%ld) Failure for popcount( (%s%s) 0x%x ) = *%d vs %d\n", i, str(__T), sizeName, x, (int)ref, (int)res ); \
return -1; \
}\
} \
return 0; \
#define __verify_popcount_func(__T) \
static int verify_popcount_##__T(const void *p, const void *r, size_t n, \
const char *sizeName, size_t vecSize) \
{ \
const __T *inA = (const __T *)p; \
const __T *outptr = (const __T *)r; \
size_t i; \
int _n = sizeof(__T) * 8; \
__T ref; \
for (i = 0; i < n; i++) \
{ \
__T x = inA[i]; \
__T res = outptr[i]; \
__popcnt(x, __T, _n, ref); \
if (res != ref) \
{ \
log_info( \
"%zu) Failure for popcount( (%s%s) 0x%x ) = *%d vs %d\n", \
i, str(__T), sizeName, (int)x, (int)ref, (int)res); \
return -1; \
} \
} \
return 0; \
}
__verify_popcount_func(cl_char);

View File

@@ -22,6 +22,7 @@
#include <sys/stat.h>
#include <algorithm>
#include <cinttypes>
#include "procs.h"
@@ -140,7 +141,13 @@ static int verify_subsat_long( const cl_long *inA, const cl_long *inB, const cl_
r = CL_LONG_MIN;
}
if( r != outptr[i] )
{ log_info( "%d) Failure for sub_sat( (long%s) 0x%16.16llx, (long%s) 0x%16.16llx) = *0x%16.16llx vs 0x%16.16llx\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%d) Failure for sub_sat( (long%s) 0x%16.16" PRIx64
", (long%s) 0x%16.16" PRIx64 ") = *0x%16.16" PRIx64
" vs 0x%16.16" PRIx64 "\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -154,7 +161,13 @@ static int verify_subsat_ulong( const cl_ulong *inA, const cl_ulong *inB, const
if( inA[i] < inB[i] )
r = 0;
if( r != outptr[i] )
{ log_info( "%d) Failure for sub_sat( (ulong%s) 0x%16.16llx, (ulong%s) 0x%16.16llx) = *0x%16.16llx vs 0x%16.16llx\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%d) Failure for sub_sat( (ulong%s) 0x%16.16" PRIx64
", (ulong%s) 0x%16.16" PRIx64 ") = *0x%16.16" PRIx64
" vs 0x%16.16" PRIx64 "\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}

View File

@@ -16,6 +16,8 @@
#include "testBase.h"
#include "harness/conversions.h"
#include <cinttypes>
#define TEST_SIZE 512
enum OpKonstants
@@ -71,8 +73,8 @@ int test_unary_op( cl_command_queue queue, cl_context context, OpKonstants which
}
else
{
sprintf( loadLine, "vload%ld( tid, inOut )", vecSize );
sprintf( storeLine, "vstore%ld( inOutVal, tid, inOut )", vecSize );
sprintf(loadLine, "vload%zu( tid, inOut )", vecSize);
sprintf(storeLine, "vstore%zu( inOutVal, tid, inOut )", vecSize);
}
char sizeNames[][4] = { "", "", "2", "3", "4", "", "", "", "8", "", "", "", "", "", "", "", "16" };
@@ -159,8 +161,9 @@ template<typename T> int VerifyFn( void * actualPtr, void * inputPtr, size_t vec
if( actualData[ index ] != nextVal )
{
log_error( "ERROR: Validation failed on vector %ld:%ld (expected %lld, got %lld)", i, j,
(cl_long)nextVal, (cl_long)actualData[ index ] );
log_error("ERROR: Validation failed on vector %zu:%zu "
"(expected %" PRId64 ", got %" PRId64 ")",
i, j, (cl_long)nextVal, (cl_long)actualData[index]);
return -1;
}
}

View File

@@ -213,7 +213,7 @@ void * create_upsample_data( ExplicitType type, void *sourceA, void *sourceB, si
}
break;
default:
log_error( "ERROR: unknown type size: %ld\n", tSize );
log_error("ERROR: unknown type size: %zu\n", tSize);
return NULL;
}

View File

@@ -20,6 +20,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <cinttypes>
#include "procs.h"
#include "harness/conversions.h"
@@ -227,20 +229,50 @@ verify_long(int test, size_t vector_size, cl_long *inptrA, cl_long *inptrB, cl_l
if (r != outptr[i]) {
// Shift is tricky
if (test == 8 || test == 9) {
log_error("cl_long Verification failed at element %ld of %ld : 0x%llx %s 0x%llx = 0x%llx, got 0x%llx\n", i, n, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("\t1) Vector shift failure at element %ld: original is 0x%llx %s %d (0x%llx)\n", i, inptrA[i], tests[test], (int)inptrB[i], inptrB[i]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %lld (0x%llx).\n", (int)log2(sizeof(cl_long)*8), inptrB[i]&shift_mask, inptrB[i]&shift_mask);
log_error("cl_long Verification failed at element %zu of "
"%zu : 0x%" PRIx64 " %s 0x%" PRIx64
" = 0x%" PRIx64 ", got 0x%" PRIx64 "\n",
i, n, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
log_error(
"\t1) Vector shift failure at element %zu: original is "
"0x%" PRIx64 " %s %d (0x%" PRIx64 ")\n",
i, inptrA[i], tests[test], (int)inptrB[i], inptrB[i]);
log_error("\t2) Take the %d LSBs of the shift to get the "
"final shift amount %" PRId64 " (0x%" PRIx64
").\n",
(int)log2(sizeof(cl_long) * 8),
inptrB[i] & shift_mask, inptrB[i] & shift_mask);
}
else if (test == 10 || test == 11) {
log_error("cl_long Verification failed at element %ld of %ld (%ld): 0x%llx %s 0x%llx = 0x%llx, got 0x%llx\n", i, n, j, inptrA[i], tests[test], inptrB[j], r, outptr[i]);
log_error("\t1) Scalar shift failure at element %ld: original is 0x%llx %s %d (0x%llx)\n", i, inptrA[i], tests[test], (int)inptrB[j], inptrB[j]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %lld (0x%llx).\n", (int)log2(sizeof(cl_long)*8), inptrB[j]&shift_mask, inptrB[j]&shift_mask);
log_error("cl_long Verification failed at element %zu of "
"%zu (%zu): 0x%" PRIx64 " %s 0x%" PRIx64
" = 0x%" PRIx64 ", got 0x%" PRIx64 "\n",
i, n, j, inptrA[i], tests[test], inptrB[j], r,
outptr[i]);
log_error(
"\t1) Scalar shift failure at element %zu: original is "
"0x%" PRIx64 " %s %d (0x%" PRIx64 ")\n",
i, inptrA[i], tests[test], (int)inptrB[j], inptrB[j]);
log_error("\t2) Take the %d LSBs of the shift to get the "
"final shift amount %" PRId64 " (0x%" PRIx64
").\n",
(int)log2(sizeof(cl_long) * 8),
inptrB[j] & shift_mask, inptrB[j] & shift_mask);
} else if (test == 13) {
log_error("cl_int Verification failed at element %ld (%ld): (0x%llx < 0x%llx) ? 0x%llx : 0x%llx = 0x%llx, got 0x%llx\n", i, j, inptrA[j], inptrB[j],
inptrA[i], inptrB[i], r, outptr[i]);
log_error("cl_int Verification failed at element %zu "
"(%zu): (0x%" PRIx64 " < 0x%" PRIx64
") ? 0x%" PRIx64 " : 0x%" PRIx64 " = 0x%" PRIx64
", got 0x%" PRIx64 "\n",
i, j, inptrA[j], inptrB[j], inptrA[i], inptrB[i],
r, outptr[i]);
} else {
log_error("cl_long Verification failed at element %ld of %ld: 0x%llx %s 0x%llx = 0x%llx, got 0x%llx\n", i, n, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("cl_long Verification failed at element %zu of "
"%zu: 0x%" PRIx64 " %s 0x%" PRIx64 " = 0x%" PRIx64
", got 0x%" PRIx64 "\n",
i, n, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
}
count++;
if (count >= MAX_ERRORS_TO_PRINT) {
@@ -423,19 +455,49 @@ verify_ulong(int test, size_t vector_size, cl_ulong *inptrA, cl_ulong *inptrB, c
if (r != outptr[i]) {
// Shift is tricky
if (test == 8 || test == 9) {
log_error("cl_ulong Verification failed at element %ld of %ld: 0x%llx %s 0x%llx = 0x%llx, got 0x%llx\n", i, n, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("\t1) Shift failure at element %ld: original is 0x%llx %s %d (0x%llx)\n", i, inptrA[i], tests[test], (int)inptrB[i], inptrB[i]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %llu (0x%llx).\n", (int)log2(sizeof(cl_ulong)*8), inptrB[i]&shift_mask, inptrB[i]&shift_mask);
log_error("cl_ulong Verification failed at element %zu of "
"%zu: 0x%" PRIx64 " %s 0x%" PRIx64 " = 0x%" PRIx64
", got 0x%" PRIx64 "\n",
i, n, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
log_error("\t1) Shift failure at element %zu: original is "
"0x%" PRIx64 " %s %d (0x%" PRIx64 ")\n",
i, inptrA[i], tests[test], (int)inptrB[i],
inptrB[i]);
log_error("\t2) Take the %d LSBs of the shift to get the "
"final shift amount %" PRIu64 " (0x%" PRIx64
").\n",
(int)log2(sizeof(cl_ulong) * 8),
inptrB[i] & shift_mask, inptrB[i] & shift_mask);
}
else if (test == 10 || test == 11) {
log_error("cl_ulong Verification failed at element %ld of %ld (%ld): 0x%llx %s 0x%llx = 0x%llx, got 0x%llx\n", i, n, j, inptrA[i], tests[test], inptrB[j], r, outptr[i]);
log_error("\t1) Scalar shift failure at element %ld: original is 0x%llx %s %d (0x%llx)\n", i, inptrA[i], tests[test], (int)inptrB[j], inptrB[j]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %lld (0x%llx).\n", (int)log2(sizeof(cl_long)*8), inptrB[j]&shift_mask, inptrB[j]&shift_mask);
log_error("cl_ulong Verification failed at element %zu of "
"%zu (%zu): 0x%" PRIx64 " %s 0x%" PRIx64
" = 0x%" PRIx64 ", got 0x%" PRIx64 "\n",
i, n, j, inptrA[i], tests[test], inptrB[j], r,
outptr[i]);
log_error(
"\t1) Scalar shift failure at element %zu: original is "
"0x%" PRIx64 " %s %d (0x%" PRIx64 ")\n",
i, inptrA[i], tests[test], (int)inptrB[j], inptrB[j]);
log_error("\t2) Take the %d LSBs of the shift to get the "
"final shift amount %" PRId64 " (0x%" PRIx64
").\n",
(int)log2(sizeof(cl_long) * 8),
inptrB[j] & shift_mask, inptrB[j] & shift_mask);
} else if (test == 13) {
log_error("cl_int Verification failed at element %ld of %ld (%ld): (0x%llx < 0x%llx) ? 0x%llx : 0x%llx = 0x%llx, got 0x%llx\n", i, n, j, inptrA[j], inptrB[j],
inptrA[i], inptrB[i], r, outptr[i]);
log_error("cl_int Verification failed at element %zu of "
"%zu (%zu): (0x%" PRIx64 " < 0x%" PRIx64
") ? 0x%" PRIx64 " : 0x%" PRIx64 " = 0x%" PRIx64
", got 0x%" PRIx64 "\n",
i, n, j, inptrA[j], inptrB[j], inptrA[i],
inptrB[i], r, outptr[i]);
} else {
log_error("cl_ulong Verification failed at element %ld of %ld: 0x%llx %s 0x%llx = 0x%llx, got 0x%llx\n", i, n, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("cl_ulong Verification failed at element %zu of "
"%zu: 0x%" PRIx64 " %s 0x%" PRIx64 " = 0x%" PRIx64
", got 0x%" PRIx64 "\n",
i, n, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
}
count++;
if (count >= MAX_ERRORS_TO_PRINT) {
@@ -624,19 +686,37 @@ verify_int(int test, size_t vector_size, cl_int *inptrA, cl_int *inptrB, cl_int
if (r != outptr[i]) {
// Shift is tricky
if (test == 8 || test == 9) {
log_error("cl_int Verification failed at element %ld: 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("\t1) Shift failure at element %ld: original is 0x%x %s %d (0x%x)\n", i, inptrA[i], tests[test], (int)inptrB[i], inptrB[i]);
log_error("cl_int Verification failed at element %zu: 0x%x "
"%s 0x%x = 0x%x, got 0x%x\n",
i, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
log_error("\t1) Shift failure at element %zu: original is "
"0x%x %s %d (0x%x)\n",
i, inptrA[i], tests[test], (int)inptrB[i],
inptrB[i]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %d (0x%x).\n", (int)log2(sizeof(cl_int)*8), inptrB[i]&shift_mask, inptrB[i]&shift_mask);
}
else if (test == 10 || test == 11) {
log_error("cl_int Verification failed at element %ld (%ld): 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, j, inptrA[i], tests[test], inptrB[j], r, outptr[i]);
log_error("\t1) Scalar shift failure at element %ld: original is 0x%x %s %d (0x%x)\n", i, inptrA[i], tests[test], (int)inptrB[j], inptrB[j]);
log_error("cl_int Verification failed at element %zu "
"(%zu): 0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, j, inptrA[i], tests[test], inptrB[j], r,
outptr[i]);
log_error("\t1) Scalar shift failure at element %zu: "
"original is 0x%x %s %d (0x%x)\n",
i, inptrA[i], tests[test], (int)inptrB[j],
inptrB[j]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %d (0x%x).\n", (int)log2(sizeof(cl_int)*8), inptrB[j]&shift_mask, inptrB[j]&shift_mask);
} else if (test == 13) {
log_error("cl_int Verification failed at element %ld (%ld): (0x%x < 0x%x) ? 0x%x : 0x%x = 0x%x, got 0x%x\n", i, j, inptrA[j], inptrB[j],
inptrA[i], inptrB[i], r, outptr[i]);
log_error(
"cl_int Verification failed at element %zu (%zu): "
"(0x%x < 0x%x) ? 0x%x : 0x%x = 0x%x, got 0x%x\n",
i, j, inptrA[j], inptrB[j], inptrA[i], inptrB[i], r,
outptr[i]);
} else {
log_error("cl_int Verification failed at element %ld: 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("cl_int Verification failed at element %zu: 0x%x "
"%s 0x%x = 0x%x, got 0x%x\n",
i, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
}
count++;
if (count >= MAX_ERRORS_TO_PRINT) {
@@ -819,19 +899,37 @@ verify_uint(int test, size_t vector_size, cl_uint *inptrA, cl_uint *inptrB, cl_u
if (r != outptr[i]) {
// Shift is tricky
if (test == 8 || test == 9) {
log_error("cl_uint Verification failed at element %ld: 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("\t1) Shift failure at element %ld: original is 0x%x %s %d (0x%x)\n", i, inptrA[i], tests[test], (int)inptrB[i], inptrB[i]);
log_error("cl_uint Verification failed at element %zu: "
"0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
log_error("\t1) Shift failure at element %zu: original is "
"0x%x %s %d (0x%x)\n",
i, inptrA[i], tests[test], (int)inptrB[i],
inptrB[i]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %d (0x%x).\n", (int)log2(sizeof(cl_uint)*8), inptrB[i]&shift_mask, inptrB[i]&shift_mask);
}
else if (test == 10 || test == 11) {
log_error("cl_uint Verification failed at element %ld (%ld): 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, j, inptrA[i], tests[test], inptrB[j], r, outptr[i]);
log_error("\t1) Scalar shift failure at element %ld: original is 0x%x %s %d (0x%x)\n", i, inptrA[i], tests[test], (int)inptrB[j], inptrB[j]);
log_error("cl_uint Verification failed at element %zu "
"(%zu): 0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, j, inptrA[i], tests[test], inptrB[j], r,
outptr[i]);
log_error("\t1) Scalar shift failure at element %zu: "
"original is 0x%x %s %d (0x%x)\n",
i, inptrA[i], tests[test], (int)inptrB[j],
inptrB[j]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %d (0x%x).\n", (int)log2(sizeof(cl_uint)*8), inptrB[j]&shift_mask, inptrB[j]&shift_mask);
} else if (test == 13) {
log_error("cl_int Verification failed at element %ld (%ld): (0x%x < 0x%x) ? 0x%x : 0x%x = 0x%x, got 0x%x\n", i, j, inptrA[j], inptrB[j],
inptrA[i], inptrB[i], r, outptr[i]);
log_error(
"cl_int Verification failed at element %zu (%zu): "
"(0x%x < 0x%x) ? 0x%x : 0x%x = 0x%x, got 0x%x\n",
i, j, inptrA[j], inptrB[j], inptrA[i], inptrB[i], r,
outptr[i]);
} else {
log_error("cl_uint Verification failed at element %ld: 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("cl_uint Verification failed at element %zu: "
"0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
}
count++;
if (count >= MAX_ERRORS_TO_PRINT) {
@@ -1015,19 +1113,37 @@ verify_short(int test, size_t vector_size, cl_short *inptrA, cl_short *inptrB, c
if (r != outptr[i]) {
// Shift is tricky
if (test == 8 || test == 9) {
log_error("cl_short Verification failed at element %ld: 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("\t1) Shift failure at element %ld: original is 0x%x %s %d (0x%x)\n", i, inptrA[i], tests[test], (int)inptrB[i], inptrB[i]);
log_error("cl_short Verification failed at element %zu: "
"0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
log_error("\t1) Shift failure at element %zu: original is "
"0x%x %s %d (0x%x)\n",
i, inptrA[i], tests[test], (int)inptrB[i],
inptrB[i]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %d (0x%x).\n", (int)log2(sizeof(cl_short)*8), inptrB[i]&shift_mask, inptrB[i]&shift_mask);
}
else if (test == 10 || test == 11) {
log_error("cl_short Verification failed at element %ld (%ld): 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, j, inptrA[i], tests[test], inptrB[j], r, outptr[i]);
log_error("\t1) Scalar shift failure at element %ld: original is 0x%x %s %d (0x%x)\n", i, inptrA[i], tests[test], (int)inptrB[j], inptrB[j]);
log_error("cl_short Verification failed at element %zu "
"(%zu): 0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, j, inptrA[i], tests[test], inptrB[j], r,
outptr[i]);
log_error("\t1) Scalar shift failure at element %zu: "
"original is 0x%x %s %d (0x%x)\n",
i, inptrA[i], tests[test], (int)inptrB[j],
inptrB[j]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %d (0x%x).\n", (int)log2(sizeof(cl_short)*8), inptrB[j]&shift_mask, inptrB[j]&shift_mask);
} else if (test == 13) {
log_error("cl_int Verification failed at element %ld (%ld): (0x%x < 0x%x) ? 0x%x : 0x%x = 0x%x, got 0x%x\n", i, j, inptrA[j], inptrB[j],
inptrA[i], inptrB[i], r, outptr[i]);
log_error(
"cl_int Verification failed at element %zu (%zu): "
"(0x%x < 0x%x) ? 0x%x : 0x%x = 0x%x, got 0x%x\n",
i, j, inptrA[j], inptrB[j], inptrA[i], inptrB[i], r,
outptr[i]);
} else {
log_error("cl_short Verification failed at element %ld: 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("cl_short Verification failed at element %zu: "
"0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
}
count++;
if (count >= MAX_ERRORS_TO_PRINT) {
@@ -1213,19 +1329,37 @@ verify_ushort(int test, size_t vector_size, cl_ushort *inptrA, cl_ushort *inptrB
if (r != outptr[i]) {
// Shift is tricky
if (test == 8 || test == 9) {
log_error("cl_ushort Verification failed at element %ld: 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("\t1) Shift failure at element %ld: original is 0x%x %s %d (0x%x)\n", i, inptrA[i], tests[test], (int)inptrB[i], inptrB[i]);
log_error("cl_ushort Verification failed at element %zu: "
"0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
log_error("\t1) Shift failure at element %zu: original is "
"0x%x %s %d (0x%x)\n",
i, inptrA[i], tests[test], (int)inptrB[i],
inptrB[i]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %d (0x%x).\n", (int)log2(sizeof(cl_ushort)*8), inptrB[i]&shift_mask, inptrB[i]&shift_mask);
}
else if (test == 10 || test == 11) {
log_error("cl_ushort Verification failed at element %ld (%ld): 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, j, inptrA[i], tests[test], inptrB[j], r, outptr[i]);
log_error("\t1) Scalar shift failure at element %ld: original is 0x%x %s %d (0x%x)\n", i, inptrA[i], tests[test], (int)inptrB[j], inptrB[j]);
log_error("cl_ushort Verification failed at element %zu "
"(%zu): 0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, j, inptrA[i], tests[test], inptrB[j], r,
outptr[i]);
log_error("\t1) Scalar shift failure at element %zu: "
"original is 0x%x %s %d (0x%x)\n",
i, inptrA[i], tests[test], (int)inptrB[j],
inptrB[j]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %d (0x%x).\n", (int)log2(sizeof(cl_ushort)*8), inptrB[j]&shift_mask, inptrB[j]&shift_mask);
} else if (test == 13) {
log_error("cl_int Verification failed at element %ld (%ld): (0x%x < 0x%x) ? 0x%x : 0x%x = 0x%x, got 0x%x\n", i, j, inptrA[j], inptrB[j],
inptrA[i], inptrB[i], r, outptr[i]);
log_error(
"cl_int Verification failed at element %zu (%zu): "
"(0x%x < 0x%x) ? 0x%x : 0x%x = 0x%x, got 0x%x\n",
i, j, inptrA[j], inptrB[j], inptrA[i], inptrB[i], r,
outptr[i]);
} else {
log_error("cl_ushort Verification failed at element %ld: 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("cl_ushort Verification failed at element %zu: "
"0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
}
count++;
if (count >= MAX_ERRORS_TO_PRINT) {
@@ -1413,19 +1547,37 @@ verify_char(int test, size_t vector_size, cl_char *inptrA, cl_char *inptrB, cl_c
if (r != outptr[i]) {
// Shift is tricky
if (test == 8 || test == 9) {
log_error("cl_char Verification failed at element %ld: 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("\t1) Shift failure at element %ld: original is 0x%x %s %d (0x%x)\n", i, inptrA[i], tests[test], (int)inptrB[i], inptrB[i]);
log_error("cl_char Verification failed at element %zu: "
"0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
log_error("\t1) Shift failure at element %zu: original is "
"0x%x %s %d (0x%x)\n",
i, inptrA[i], tests[test], (int)inptrB[i],
inptrB[i]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %d (0x%x).\n", (int)log2(sizeof(cl_char)*8), inptrB[i]&shift_mask, inptrB[i]&shift_mask);
}
else if (test == 10 || test == 11) {
log_error("cl_char Verification failed at element %ld (%ld): 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, j, inptrA[i], tests[test], inptrB[j], r, outptr[i]);
log_error("\t1) Scalar shift failure at element %ld: original is 0x%x %s %d (0x%x)\n", i, inptrA[i], tests[test], (int)inptrB[j], inptrB[j]);
log_error("cl_char Verification failed at element %zu "
"(%zu): 0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, j, inptrA[i], tests[test], inptrB[j], r,
outptr[i]);
log_error("\t1) Scalar shift failure at element %zu: "
"original is 0x%x %s %d (0x%x)\n",
i, inptrA[i], tests[test], (int)inptrB[j],
inptrB[j]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %d (0x%x).\n", (int)log2(sizeof(cl_long)*8), inptrB[j]&shift_mask, inptrB[j]&shift_mask);
} else if (test == 13) {
log_error("cl_int Verification failed at element %ld (%ld): (0x%x < 0x%x) ? 0x%x : 0x%x = 0x%x, got 0x%x\n", i, j, inptrA[j], inptrB[j],
inptrA[i], inptrB[i], r, outptr[i]);
log_error(
"cl_int Verification failed at element %zu (%zu): "
"(0x%x < 0x%x) ? 0x%x : 0x%x = 0x%x, got 0x%x\n",
i, j, inptrA[j], inptrB[j], inptrA[i], inptrB[i], r,
outptr[i]);
} else {
log_error("cl_char Verification failed at element %ld: 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("cl_char Verification failed at element %zu: "
"0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
}
count++;
if (count >= MAX_ERRORS_TO_PRINT) {
@@ -1619,19 +1771,37 @@ verify_uchar(int test, size_t vector_size, cl_uchar *inptrA, cl_uchar *inptrB, c
if (r != outptr[i]) {
// Shift is tricky
if (test == 8 || test == 9) {
log_error("cl_uchar Verification failed at element %ld: 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("\t1) Shift failure at element %ld: original is 0x%x %s %d (0x%x)\n", i, inptrA[i], tests[test], (int)inptrB[i], inptrB[i]);
log_error("cl_uchar Verification failed at element %zu: "
"0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
log_error("\t1) Shift failure at element %zu: original is "
"0x%x %s %d (0x%x)\n",
i, inptrA[i], tests[test], (int)inptrB[i],
inptrB[i]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %d (0x%x).\n", (int)log2(sizeof(cl_uchar)*8), inptrB[i]&shift_mask, inptrB[i]&shift_mask);
}
else if (test == 10 || test == 11) {
log_error("cl_uchar Verification failed at element %ld (%ld): 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, j, inptrA[i], tests[test], inptrB[j], r, outptr[i]);
log_error("\t1) Scalar shift failure at element %ld: original is 0x%x %s %d (0x%x)\n", i, inptrA[i], tests[test], (int)inptrB[j], inptrB[j]);
log_error("cl_uchar Verification failed at element %zu "
"(%zu): 0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, j, inptrA[i], tests[test], inptrB[j], r,
outptr[i]);
log_error("\t1) Scalar shift failure at element %zu: "
"original is 0x%x %s %d (0x%x)\n",
i, inptrA[i], tests[test], (int)inptrB[j],
inptrB[j]);
log_error("\t2) Take the %d LSBs of the shift to get the final shift amount %d (0x%x).\n", (int)log2(sizeof(cl_uchar)*8), inptrB[j]&shift_mask, inptrB[j]&shift_mask);
} else if (test == 13) {
log_error("cl_int Verification failed at element %ld (%ld): (0x%x < 0x%x) ? 0x%x : 0x%x = 0x%x, got 0x%x\n", i, j, inptrA[j], inptrB[j],
inptrA[i], inptrB[i], r, outptr[i]);
log_error(
"cl_int Verification failed at element %zu (%zu): "
"(0x%x < 0x%x) ? 0x%x : 0x%x = 0x%x, got 0x%x\n",
i, j, inptrA[j], inptrB[j], inptrA[i], inptrB[i], r,
outptr[i]);
} else {
log_error("cl_uchar Verification failed at element %ld: 0x%x %s 0x%x = 0x%x, got 0x%x\n", i, inptrA[i], tests[test], inptrB[i], r, outptr[i]);
log_error("cl_uchar Verification failed at element %zu: "
"0x%x %s 0x%x = 0x%x, got 0x%x\n",
i, inptrA[i], tests[test], inptrB[i], r,
outptr[i]);
}
count++;
if (count >= MAX_ERRORS_TO_PRINT) {

View File

@@ -843,10 +843,11 @@ test_status InitCL(cl_device_id device)
IsTininessDetectedBeforeRounding();
cl_platform_id platform;
int err = clGetPlatformIDs(1, &platform, NULL);
int err = clGetDeviceInfo(gDevice, CL_DEVICE_PLATFORM, sizeof(platform),
&platform, NULL);
if (err)
{
print_error(err, "clGetPlatformIDs failed");
print_error(err, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed");
return TEST_FAIL;
}

View File

@@ -303,15 +303,14 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
if (strcmp(fname, "exp") == 0 || strcmp(fname, "exp2") == 0)
{
float exp_error = ulps;
// For full profile, ULP depends on input value.
// For embedded profile, ULP comes from functionList.
if (!gIsEmbedded)
{
exp_error += floor(fabs(2 * s[j]));
ulps = 3.0f + floor(fabs(2 * s[j]));
}
fail = !(fabsf(err) <= exp_error);
ulps = exp_error;
fail = !(fabsf(err) <= ulps);
}
if (strcmp(fname, "tan") == 0)
{

View File

@@ -1,6 +1,3 @@
# Import function list from math_brute_force
add_definitions(-DFUNCTION_LIST_ULPS_ONLY)
set(SPIR_OUT ${CONFORMANCE_PREFIX}spir${CONFORMANCE_SUFFIX})
set (SPIR_SOURCES
@@ -9,25 +6,18 @@ set (SPIR_SOURCES
run_build_test.cpp
run_services.cpp
kernelargs.cpp
../math_brute_force/function_list.cpp
)
add_executable(${SPIR_OUT}
${SPIR_SOURCES})
if(UNIX)
set_target_properties(${SPIR_OUT} PROPERTIES
COMPILE_FLAGS "-fexceptions -frtti")
target_compile_options(${SPIR_OUT} PRIVATE -fexceptions -frtti)
elseif(MSVC)
set_target_properties(${SPIR_OUT} PROPERTIES
COMPILE_FLAGS "/GR /EHs /EHc")
target_compile_options(${SPIR_OUT} PRIVATE /GR /EHs /EHc)
endif()
TARGET_LINK_LIBRARIES(${SPIR_OUT} harness
${CLConform_LIBRARIES})
set_source_files_properties(${SPIR_SOURCES} PROPERTIES LANGUAGE CXX)
target_link_libraries(${SPIR_OUT} harness ${CLConform_LIBRARIES})
# Need to copy the spir zips to sit beside the executable

View File

@@ -13,6 +13,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Import function list from math_brute_force
#define FUNCTION_LIST_ULPS_ONLY
#include "../math_brute_force/function_list.cpp"
#include "harness/compat.h"
#include <stdio.h>

View File

@@ -1,16 +1,3 @@
######################################################################################################
#Copyright (c) 2016 The Khronos Group Inc. All Rights Reserved.
#
#This code is protected by copyright laws and contains material proprietary to the Khronos Group, Inc.
#This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed in whole or in part to
#third parties, and may not be reproduced, republished, distributed, transmitted, displayed,
#broadcast or otherwise exploited in any manner without the express prior written permission
#of Khronos Group. The receipt or possession of this code does not convey any rights to reproduce,
#disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe,
#in whole or in part other than under the terms of the Khronos Adopters Agreement
#or Khronos Conformance Test Source License Agreement as executed between Khronos and the recipient.
######################################################################################################
set(MODULE_NAME SPIRV_NEW)
file(GLOB SPIRV_NEW_SOURCES "*.cpp")

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#####################################################################
# Copyright (c) 2020 The Khronos Group Inc. All Rights Reserved.
# Copyright (c) 2020-2023 The Khronos Group Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -30,6 +30,16 @@ import subprocess
import sys
from textwrap import wrap
# sub-directories for specific SPIR-V environments
spirv_envs = [
'', # all files in the root directory are considered SPIR-V 1.0
'spv1.1',
'spv1.2',
'spv1.3',
'spv1.4',
'spv1.5',
'spv1.6',
]
def fatal(message):
"""Print an error message and exit with a non-zero status, to
@@ -39,7 +49,7 @@ def fatal(message):
sys.exit(1)
def assemble_spirv(asm_dir, bin_dir, spirv_as, verbose):
def assemble_spirv(asm_dir, bin_dir, spirv_as, spirv_env, verbose):
"""Assemble SPIR-V source into binaries."""
if not os.path.exists(bin_dir):
@@ -57,8 +67,8 @@ def assemble_spirv(asm_dir, bin_dir, spirv_as, verbose):
bin_file = asm_file_root + asm_file_ext.replace('asm', '')
bin_file_path = os.path.join(bin_dir, bin_file)
command = '"{}" --target-env spv1.0 "{}" -o "{}"'.format(
spirv_as, asm_file_path, bin_file_path)
command = '"{}" --target-env "{}" "{}" -o "{}"'.format(
spirv_as, spirv_env, asm_file_path, bin_file_path)
if subprocess.call(command, shell=True) != 0:
assembly_failures = True
print('ERROR: Failure assembling {}: '
@@ -72,7 +82,7 @@ def assemble_spirv(asm_dir, bin_dir, spirv_as, verbose):
'messages from the assembler, if any.')))
def validate_spirv(bin_dir, spirv_val, verbose):
def validate_spirv(bin_dir, spirv_val, spirv_env, verbose):
"""Validates SPIR-V binaries. Ignores known failures."""
validation_failures = False
@@ -83,8 +93,8 @@ def validate_spirv(bin_dir, spirv_val, verbose):
if verbose:
print(' Validating {}'.format(bin_file))
command = '"{}" "{}"'.format(
spirv_val, bin_file_path)
command = '"{}" --target-env "{}" "{}"'.format(
spirv_val, spirv_env, bin_file_path)
if subprocess.call(command, shell=True) != 0:
print('ERROR: Failure validating {}: '
'see above output.'.format(
@@ -95,8 +105,6 @@ def validate_spirv(bin_dir, spirv_val, verbose):
if validation_failures:
fatal('ERROR: Validation failure(s) found. '
'See above for validation output.')
else:
print('All SPIR-V binaries validated successfully.')
def parse_args():
@@ -144,18 +152,26 @@ def main():
args = parse_args()
print('Assembling SPIR-V source into binaries...')
assemble_spirv(args.source_dir, args.output_dir, args.assembler,
args.verbose)
print('Finished assembling SPIR-V binaries.')
print()
for subdir in spirv_envs:
src_dir = os.path.join(args.source_dir, subdir)
out_dir = os.path.join(args.output_dir, subdir)
spirv_env = 'spv1.0' if subdir == '' else subdir
print('Assembling SPIR-V source into binaries for target {}...'.
format(spirv_env))
assemble_spirv(src_dir, out_dir, args.assembler,
spirv_env, args.verbose)
print('Finished assembling SPIR-V binaries.')
print()
if args.skip_validation:
print('Skipping validation of SPIR-V binaries as requested.')
else:
print('Validating SPIR-V binaries...')
validate_spirv(args.output_dir, args.validator, args.verbose)
print()
if args.skip_validation:
print('Skipping validation of SPIR-V binaries as requested.')
else:
print('Validating SPIR-V binaries for target {}...'.
format(spirv_env))
validate_spirv(out_dir, args.validator,
spirv_env, args.verbose)
print('All SPIR-V binaries validated successfully.')
print()
print('Done.')

View File

@@ -1,15 +1,18 @@
/******************************************************************
Copyright (c) 2016 The Khronos Group Inc. All Rights Reserved.
This code is protected by copyright laws and contains material proprietary to the Khronos Group, Inc.
This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed in whole or in part to
third parties, and may not be reproduced, republished, distributed, transmitted, displayed,
broadcast or otherwise exploited in any manner without the express prior written permission
of Khronos Group. The receipt or possession of this code does not convey any rights to reproduce,
disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe,
in whole or in part other than under the terms of the Khronos Adopters Agreement
or Khronos Conformance Test Source License Agreement as executed between Khronos and the recipient.
******************************************************************/
//
// Copyright (c) 2016-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 <stdio.h>
#include <string.h>
@@ -30,9 +33,12 @@ const std::string slash = "/";
#endif
const std::string spvExt = ".spv";
bool gVersionSkip = false;
std::string gAddrWidth = "";
std::string spvBinariesPath = "spirv_bin";
std::string spvBinariesPathArg = "--spirv-binaries-path";
const std::string spvBinariesPathArg = "--spirv-binaries-path";
const std::string spvVersionSkipArg = "--skip-spirv-version-check";
std::vector<unsigned char> readBinary(const char *file_name)
{
@@ -224,7 +230,10 @@ test_status InitCL(cl_device_id id)
void printUsage() {
log_info("Reading SPIR-V files from default '%s' path.\n", spvBinariesPath.c_str());
log_info("In case you want to set other directory use '%s' argument.\n", spvBinariesPathArg.c_str());
log_info("In case you want to set other directory use '%s' argument.\n",
spvBinariesPathArg.c_str());
log_info("To skip the SPIR-V version check use the '%s' argument.\n",
spvVersionSkipArg.c_str());
}
int main(int argc, const char *argv[])
@@ -243,6 +252,11 @@ int main(int argc, const char *argv[])
modifiedSpvBinariesPath = true;
}
}
if (argv[i] == spvVersionSkipArg)
{
gVersionSkip = true;
argsRemoveNum++;
}
if (argsRemoveNum > 0) {
for (int j = i; j < (argc - argsRemoveNum); ++j)

View File

@@ -1,17 +1,18 @@
/******************************************************************
Copyright (c) 2016 The Khronos Group Inc. All Rights Reserved.
This code is protected by copyright laws and contains material proprietary to
the Khronos Group, Inc. This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not
be disclosed in whole or in part to third parties, and may not be reproduced,
republished, distributed, transmitted, displayed, broadcast or otherwise
exploited in any manner without the express prior written permission of Khronos
Group. The receipt or possession of this code does not convey any rights to
reproduce, disclose, or distribute its contents, or to manufacture, use, or sell
anything that it may describe, in whole or in part other than under the terms of
the Khronos Adopters Agreement or Khronos Conformance Test Source License
Agreement as executed between Khronos and the recipient.
******************************************************************/
//
// Copyright (c) 2016-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.
//
#pragma once

View File

@@ -0,0 +1,33 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 18
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %9 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%9 = OpFunction %void None %8
%10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpLabel
%13 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 16
%14 = OpCompositeExtract %uint %13 0
%15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %14
%16 = OpLoad %uint %15 Aligned 4
%17 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %10 %14
OpStore %17 %16 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,38 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 22
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %10 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
%10 = OpFunction %void None %9
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%13 = OpLabel
%14 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 32
%15 = OpCompositeExtract %ulong %14 0
%16 = OpUConvert %uint %15
%17 = OpSConvert %ulong %16
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %12 %17
%19 = OpLoad %uint %18 Aligned 4
%20 = OpSConvert %ulong %16
%21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %20
OpStore %21 %19 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,42 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 20
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Float16
OpCapability Int16
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %1 "decorate_rounding_rte_half_short" %gl_GlobalInvocationID
OpName %res "res"
OpName %in "in"
OpName %entry "entry"
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
OpDecorate %6 FPRoundingMode RTE
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%ushort = OpTypeInt 16 0
%_ptr_CrossWorkgroup_ushort = OpTypePointer CrossWorkgroup %ushort
%half = OpTypeFloat 16
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
%14 = OpTypeFunction %void %_ptr_CrossWorkgroup_ushort %_ptr_CrossWorkgroup_half
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%1 = OpFunction %void None %14
%res = OpFunctionParameter %_ptr_CrossWorkgroup_ushort
%in = OpFunctionParameter %_ptr_CrossWorkgroup_half
%entry = OpLabel
%15 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 0
%16 = OpCompositeExtract %uint %15 0
%17 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %in %16
%18 = OpLoad %half %17 Aligned 2
%6 = OpConvertFToS %ushort %18
%19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %res %16
OpStore %19 %6
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,46 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 23
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpCapability Int16
OpCapability Float16
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "decorate_rounding_rte_half_short" %gl_GlobalInvocationID
OpName %res "res"
OpName %in "in"
OpName %entry "entry"
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
OpDecorate %6 FPRoundingMode RTE
%ulong = OpTypeInt 64 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%ushort = OpTypeInt 16 0
%_ptr_CrossWorkgroup_ushort = OpTypePointer CrossWorkgroup %ushort
%half = OpTypeFloat 16
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
%14 = OpTypeFunction %void %_ptr_CrossWorkgroup_ushort %_ptr_CrossWorkgroup_half
%ulong_32 = OpConstant %ulong 32
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
%1 = OpFunction %void None %14
%res = OpFunctionParameter %_ptr_CrossWorkgroup_ushort
%in = OpFunctionParameter %_ptr_CrossWorkgroup_half
%entry = OpLabel
%16 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 0
%17 = OpCompositeExtract %ulong %16 0
%18 = OpShiftLeftLogical %ulong %17 %ulong_32
%19 = OpShiftRightArithmetic %ulong %18 %ulong_32
%20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %in %19
%21 = OpLoad %half %20 Aligned 2
%6 = OpConvertFToS %ushort %21
%22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %res %19
OpStore %22 %6
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,42 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 21
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Float16
OpCapability Int16
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %1 "decorate_rounding_rtn_half_short" %gl_GlobalInvocationID
OpName %res "res"
OpName %in "in"
OpName %entry "entry"
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
OpDecorate %6 FPRoundingMode RTN
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%ushort = OpTypeInt 16 0
%_ptr_CrossWorkgroup_ushort = OpTypePointer CrossWorkgroup %ushort
%half = OpTypeFloat 16
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
%15 = OpTypeFunction %void %_ptr_CrossWorkgroup_ushort %_ptr_CrossWorkgroup_half
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%1 = OpFunction %void None %15
%res = OpFunctionParameter %_ptr_CrossWorkgroup_ushort
%in = OpFunctionParameter %_ptr_CrossWorkgroup_half
%entry = OpLabel
%16 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 0
%17 = OpCompositeExtract %uint %16 0
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %in %17
%19 = OpLoad %half %18 Aligned 2
%6 = OpConvertFToS %ushort %19
%20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %res %17
OpStore %20 %6
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,46 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 23
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpCapability Float16
OpCapability Int16
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "decorate_rounding_rtn_half_short" %gl_GlobalInvocationID
OpName %res "res"
OpName %in "in"
OpName %entry "entry"
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
OpDecorate %6 FPRoundingMode RTN
%ulong = OpTypeInt 64 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%ushort = OpTypeInt 16 0
%_ptr_CrossWorkgroup_ushort = OpTypePointer CrossWorkgroup %ushort
%half = OpTypeFloat 16
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
%14 = OpTypeFunction %void %_ptr_CrossWorkgroup_ushort %_ptr_CrossWorkgroup_half
%ulong_32 = OpConstant %ulong 32
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
%1 = OpFunction %void None %14
%res = OpFunctionParameter %_ptr_CrossWorkgroup_ushort
%in = OpFunctionParameter %_ptr_CrossWorkgroup_half
%entry = OpLabel
%16 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 0
%17 = OpCompositeExtract %ulong %16 0
%18 = OpShiftLeftLogical %ulong %17 %ulong_32
%19 = OpShiftRightArithmetic %ulong %18 %ulong_32
%20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %in %19
%21 = OpLoad %half %20 Aligned 2
%6 = OpConvertFToS %ushort %21
%22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %res %19
OpStore %22 %6
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,42 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 21
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Float16
OpCapability Int16
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %1 "decorate_rounding_rtp_half_short" %gl_GlobalInvocationID
OpName %res "res"
OpName %in "in"
OpName %entry "entry"
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
OpDecorate %6 FPRoundingMode RTP
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%ushort = OpTypeInt 16 0
%_ptr_CrossWorkgroup_ushort = OpTypePointer CrossWorkgroup %ushort
%half = OpTypeFloat 16
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
%15 = OpTypeFunction %void %_ptr_CrossWorkgroup_ushort %_ptr_CrossWorkgroup_half
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%1 = OpFunction %void None %15
%res = OpFunctionParameter %_ptr_CrossWorkgroup_ushort
%in = OpFunctionParameter %_ptr_CrossWorkgroup_half
%entry = OpLabel
%16 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 0
%17 = OpCompositeExtract %uint %16 0
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %in %17
%19 = OpLoad %half %18 Aligned 2
%6 = OpConvertFToS %ushort %19
%20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %res %17
OpStore %20 %6
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,46 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 23
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpCapability Float16
OpCapability Int16
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "decorate_rounding_rtp_half_short" %gl_GlobalInvocationID
OpName %res "res"
OpName %in "in"
OpName %entry "entry"
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
OpDecorate %6 FPRoundingMode RTP
%ulong = OpTypeInt 64 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%ushort = OpTypeInt 16 0
%_ptr_CrossWorkgroup_ushort = OpTypePointer CrossWorkgroup %ushort
%half = OpTypeFloat 16
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
%14 = OpTypeFunction %void %_ptr_CrossWorkgroup_ushort %_ptr_CrossWorkgroup_half
%ulong_32 = OpConstant %ulong 32
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
%1 = OpFunction %void None %14
%res = OpFunctionParameter %_ptr_CrossWorkgroup_ushort
%in = OpFunctionParameter %_ptr_CrossWorkgroup_half
%entry = OpLabel
%16 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 0
%17 = OpCompositeExtract %ulong %16 0
%18 = OpShiftLeftLogical %ulong %17 %ulong_32
%19 = OpShiftRightArithmetic %ulong %18 %ulong_32
%20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %in %19
%21 = OpLoad %half %20 Aligned 2
%6 = OpConvertFToS %ushort %21
%22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %res %19
OpStore %22 %6
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,42 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 21
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Float16
OpCapability Int16
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %1 "decorate_rounding_rtz_half_short" %gl_GlobalInvocationID
OpName %res "res"
OpName %in "in"
OpName %entry "entry"
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
OpDecorate %6 FPRoundingMode RTZ
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%ushort = OpTypeInt 16 0
%_ptr_CrossWorkgroup_ushort = OpTypePointer CrossWorkgroup %ushort
%half = OpTypeFloat 16
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
%15 = OpTypeFunction %void %_ptr_CrossWorkgroup_ushort %_ptr_CrossWorkgroup_half
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%1 = OpFunction %void None %15
%res = OpFunctionParameter %_ptr_CrossWorkgroup_ushort
%in = OpFunctionParameter %_ptr_CrossWorkgroup_half
%entry = OpLabel
%16 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 0
%17 = OpCompositeExtract %uint %16 0
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %in %17
%19 = OpLoad %half %18 Aligned 2
%6 = OpConvertFToS %ushort %19
%20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %res %17
OpStore %20 %6
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,46 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 23
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpCapability Float16
OpCapability Int16
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "decorate_rounding_rtz_half_short" %gl_GlobalInvocationID
OpName %res "res"
OpName %in "in"
OpName %entry "entry"
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
OpDecorate %6 FPRoundingMode RTZ
%ulong = OpTypeInt 64 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%ushort = OpTypeInt 16 0
%_ptr_CrossWorkgroup_ushort = OpTypePointer CrossWorkgroup %ushort
%half = OpTypeFloat 16
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
%14 = OpTypeFunction %void %_ptr_CrossWorkgroup_ushort %_ptr_CrossWorkgroup_half
%ulong_32 = OpConstant %ulong 32
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
%1 = OpFunction %void None %14
%res = OpFunctionParameter %_ptr_CrossWorkgroup_ushort
%in = OpFunctionParameter %_ptr_CrossWorkgroup_half
%entry = OpLabel
%16 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 0
%17 = OpCompositeExtract %ulong %16 0
%18 = OpShiftLeftLogical %ulong %17 %ulong_32
%19 = OpShiftRightArithmetic %ulong %18 %ulong_32
%20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %in %19
%21 = OpLoad %half %20 Aligned 2
%6 = OpConvertFToS %ushort %21
%22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_ushort %res %19
OpStore %22 %6
OpReturn
OpFunctionEnd

View File

@@ -8,7 +8,7 @@
OpCapability Kernel
OpCapability Float64
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_int" %gl_GlobalInvocationID
OpEntryPoint Kernel %1 "decorate_saturated_conversion_double_to_int" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"

View File

@@ -9,7 +9,7 @@
OpCapability Int64
OpCapability Float64
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_uint" %gl_GlobalInvocationID
OpEntryPoint Kernel %1 "decorate_saturated_conversion_double_to_int" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"

View File

@@ -8,7 +8,7 @@
OpCapability Kernel
OpCapability Float64
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_uint" %gl_GlobalInvocationID
OpEntryPoint Kernel %1 "decorate_saturated_conversion_double_to_uint" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"

View File

@@ -9,7 +9,7 @@
OpCapability Int64
OpCapability Float64
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_int" %gl_GlobalInvocationID
OpEntryPoint Kernel %1 "decorate_saturated_conversion_double_to_uint" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"

View File

@@ -8,7 +8,7 @@
OpCapability Kernel
OpCapability Int8
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_char" %gl_GlobalInvocationID
OpEntryPoint Kernel %1 "decorate_saturated_conversion_float_to_char" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"

View File

@@ -9,7 +9,7 @@
OpCapability Int64
OpCapability Int8
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_char" %gl_GlobalInvocationID
OpEntryPoint Kernel %1 "decorate_saturated_conversion_float_to_char" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"

View File

@@ -8,7 +8,7 @@
OpCapability Kernel
OpCapability Int16
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_short" %gl_GlobalInvocationID
OpEntryPoint Kernel %1 "decorate_saturated_conversion_float_to_short" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"

View File

@@ -9,7 +9,7 @@
OpCapability Int64
OpCapability Int16
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_short" %gl_GlobalInvocationID
OpEntryPoint Kernel %1 "decorate_saturated_conversion_float_to_short" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"

View File

@@ -8,7 +8,7 @@
OpCapability Kernel
OpCapability Int8
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_uchar" %gl_GlobalInvocationID
OpEntryPoint Kernel %1 "decorate_saturated_conversion_float_to_uchar" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"

View File

@@ -9,7 +9,7 @@
OpCapability Int64
OpCapability Int8
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_uchar" %gl_GlobalInvocationID
OpEntryPoint Kernel %1 "decorate_saturated_conversion_float_to_uchar" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"

View File

@@ -8,7 +8,7 @@
OpCapability Kernel
OpCapability Int16
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_ushort" %gl_GlobalInvocationID
OpEntryPoint Kernel %1 "decorate_saturated_conversion_float_to_ushort" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"

View File

@@ -9,7 +9,7 @@
OpCapability Int64
OpCapability Int16
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_ushort" %gl_GlobalInvocationID
OpEntryPoint Kernel %1 "decorate_saturated_conversion_float_to_ushort" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"

View File

@@ -0,0 +1,47 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 25
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int8
OpCapability Float16
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_half_to_char" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpName %entry "entry"
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
OpDecorate %7 SaturatedConversion
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%uchar = OpTypeInt 8 0
%_ptr_CrossWorkgroup_uchar = OpTypePointer CrossWorkgroup %uchar
%half = OpTypeFloat 16
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
%16 = OpTypeFunction %void %_ptr_CrossWorkgroup_uchar %_ptr_CrossWorkgroup_half %_ptr_CrossWorkgroup_half
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%1 = OpFunction %void None %16
%res = OpFunctionParameter %_ptr_CrossWorkgroup_uchar
%lhs = OpFunctionParameter %_ptr_CrossWorkgroup_half
%rhs = OpFunctionParameter %_ptr_CrossWorkgroup_half
%entry = OpLabel
%17 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 0
%18 = OpCompositeExtract %uint %17 0
%19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %lhs %18
%20 = OpLoad %half %19 Aligned 2
%21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %rhs %18
%22 = OpLoad %half %21 Aligned 2
%23 = OpFMul %half %20 %22
%7 = OpConvertFToS %uchar %23
%24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar %res %18
OpStore %24 %7
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,51 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 28
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpCapability Int8
OpCapability Float16
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_half_to_char" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpName %entry "entry"
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
OpDecorate %7 SaturatedConversion
%ulong = OpTypeInt 64 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%uchar = OpTypeInt 8 0
%_ptr_CrossWorkgroup_uchar = OpTypePointer CrossWorkgroup %uchar
%half = OpTypeFloat 16
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
%16 = OpTypeFunction %void %_ptr_CrossWorkgroup_uchar %_ptr_CrossWorkgroup_half %_ptr_CrossWorkgroup_half
%ulong_32 = OpConstant %ulong 32
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
%1 = OpFunction %void None %16
%res = OpFunctionParameter %_ptr_CrossWorkgroup_uchar
%lhs = OpFunctionParameter %_ptr_CrossWorkgroup_half
%rhs = OpFunctionParameter %_ptr_CrossWorkgroup_half
%entry = OpLabel
%18 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 0
%19 = OpCompositeExtract %ulong %18 0
%20 = OpShiftLeftLogical %ulong %19 %ulong_32
%21 = OpShiftRightArithmetic %ulong %20 %ulong_32
%22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %lhs %21
%23 = OpLoad %half %22 Aligned 2
%24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %rhs %21
%25 = OpLoad %half %24 Aligned 2
%26 = OpFMul %half %23 %25
%7 = OpConvertFToS %uchar %26
%27 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar %res %21
OpStore %27 %7
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,47 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 25
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int8
OpCapability Float16
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_half_to_uchar" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpName %entry "entry"
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
OpDecorate %7 SaturatedConversion
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%uchar = OpTypeInt 8 0
%_ptr_CrossWorkgroup_uchar = OpTypePointer CrossWorkgroup %uchar
%half = OpTypeFloat 16
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
%16 = OpTypeFunction %void %_ptr_CrossWorkgroup_uchar %_ptr_CrossWorkgroup_half %_ptr_CrossWorkgroup_half
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%1 = OpFunction %void None %16
%res = OpFunctionParameter %_ptr_CrossWorkgroup_uchar
%lhs = OpFunctionParameter %_ptr_CrossWorkgroup_half
%rhs = OpFunctionParameter %_ptr_CrossWorkgroup_half
%entry = OpLabel
%17 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 0
%18 = OpCompositeExtract %uint %17 0
%19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %lhs %18
%20 = OpLoad %half %19 Aligned 2
%21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %rhs %18
%22 = OpLoad %half %21 Aligned 2
%23 = OpFMul %half %20 %22
%7 = OpConvertFToU %uchar %23
%24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar %res %18
OpStore %24 %7
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,51 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 28
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpCapability Int8
OpCapability Float16
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "decorate_saturated_conversion_half_to_uchar" %gl_GlobalInvocationID
OpName %res "res"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpName %entry "entry"
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
OpDecorate %7 SaturatedConversion
%ulong = OpTypeInt 64 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%uchar = OpTypeInt 8 0
%_ptr_CrossWorkgroup_uchar = OpTypePointer CrossWorkgroup %uchar
%half = OpTypeFloat 16
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
%16 = OpTypeFunction %void %_ptr_CrossWorkgroup_uchar %_ptr_CrossWorkgroup_half %_ptr_CrossWorkgroup_half
%ulong_32 = OpConstant %ulong 32
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
%1 = OpFunction %void None %16
%res = OpFunctionParameter %_ptr_CrossWorkgroup_uchar
%lhs = OpFunctionParameter %_ptr_CrossWorkgroup_half
%rhs = OpFunctionParameter %_ptr_CrossWorkgroup_half
%entry = OpLabel
%18 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 0
%19 = OpCompositeExtract %ulong %18 0
%20 = OpShiftLeftLogical %ulong %19 %ulong_32
%21 = OpShiftRightArithmetic %ulong %20 %ulong_32
%22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %lhs %21
%23 = OpLoad %half %22 Aligned 2
%24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %rhs %21
%25 = OpLoad %half %24 Aligned 2
%26 = OpFMul %half %23 %25
%7 = OpConvertFToU %uchar %26
%27 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar %res %21
OpStore %27 %7
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,47 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 27
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpExtension "SPV_KHR_linkonce_odr"
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %17 "test_linkonce_odr" %__spirv_BuiltInGlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
OpDecorate %18 FuncParamAttr NoCapture
OpDecorate %a LinkageAttributes "a" LinkOnceODR
OpDecorate %b LinkageAttributes "b" Import
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%uint = OpTypeInt 32 0
%uint_5 = OpConstant %uint 5
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%6 = OpTypeFunction %uint %uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%16 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input
%b = OpFunction %uint None %6
%8 = OpFunctionParameter %uint
OpFunctionEnd
%a = OpFunction %uint Pure %6
%10 = OpFunctionParameter %uint
%11 = OpLabel
%13 = OpIAdd %uint %10 %uint_5
OpReturnValue %13
OpFunctionEnd
%17 = OpFunction %void None %16
%18 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%19 = OpLabel
%20 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16
%21 = OpCompositeExtract %uint %20 0
%22 = OpFunctionCall %uint %a %21
%23 = OpFunctionCall %uint %b %21
%24 = OpIAdd %uint %22 %23
%25 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %18 %21
OpStore %25 %24 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,51 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 30
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpExtension "SPV_KHR_linkonce_odr"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %18 "test_linkonce_odr" %__spirv_BuiltInGlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
OpDecorate %19 FuncParamAttr NoCapture
OpDecorate %a LinkageAttributes "a" LinkOnceODR
OpDecorate %b LinkageAttributes "b" Import
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%uint_5 = OpConstant %uint 5
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%7 = OpTypeFunction %uint %uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%17 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input
%b = OpFunction %uint None %7
%9 = OpFunctionParameter %uint
OpFunctionEnd
%a = OpFunction %uint Pure %7
%11 = OpFunctionParameter %uint
%12 = OpLabel
%14 = OpIAdd %uint %11 %uint_5
OpReturnValue %14
OpFunctionEnd
%18 = OpFunction %void None %17
%19 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%20 = OpLabel
%21 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 32
%22 = OpCompositeExtract %ulong %21 0
%23 = OpUConvert %uint %22
%24 = OpFunctionCall %uint %a %23
%25 = OpFunctionCall %uint %b %23
%26 = OpIAdd %uint %24 %25
%27 = OpSConvert %ulong %23
%28 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %27
OpStore %28 %26 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,44 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 27
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpExtension "SPV_KHR_linkonce_odr"
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %17 "test_linkonce_odr" %__spirv_BuiltInGlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
OpDecorate %18 FuncParamAttr NoCapture
OpDecorate %a LinkageAttributes "a" Import
OpDecorate %b LinkageAttributes "b" Import
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%uint = OpTypeInt 32 0
%uint_5 = OpConstant %uint 5
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%6 = OpTypeFunction %uint %uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%16 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input
%b = OpFunction %uint None %6
%8 = OpFunctionParameter %uint
OpFunctionEnd
%a = OpFunction %uint None %6
%10 = OpFunctionParameter %uint
OpFunctionEnd
%17 = OpFunction %void None %16
%18 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%19 = OpLabel
%20 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16
%21 = OpCompositeExtract %uint %20 0
%22 = OpFunctionCall %uint %a %21
%23 = OpFunctionCall %uint %b %21
%24 = OpIAdd %uint %22 %23
%25 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %18 %21
OpStore %25 %24 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,48 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 30
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpExtension "SPV_KHR_linkonce_odr"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %18 "test_linkonce_odr" %__spirv_BuiltInGlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
OpDecorate %19 FuncParamAttr NoCapture
OpDecorate %a LinkageAttributes "a" Import
OpDecorate %b LinkageAttributes "b" Import
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%uint_5 = OpConstant %uint 5
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%7 = OpTypeFunction %uint %uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%17 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input
%b = OpFunction %uint None %7
%9 = OpFunctionParameter %uint
OpFunctionEnd
%a = OpFunction %uint None %7
%11 = OpFunctionParameter %uint
OpFunctionEnd
%18 = OpFunction %void None %17
%19 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%20 = OpLabel
%21 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 32
%22 = OpCompositeExtract %ulong %21 0
%23 = OpUConvert %uint %22
%24 = OpFunctionCall %uint %a %23
%25 = OpFunctionCall %uint %b %23
%26 = OpIAdd %uint %24 %25
%27 = OpSConvert %ulong %23
%28 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %27
OpStore %28 %26 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,28 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 14
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpExtension "SPV_KHR_linkonce_odr"
OpMemoryModel Physical32 OpenCL
OpDecorate %a LinkageAttributes "a" LinkOnceODR
OpDecorate %b LinkageAttributes "b" Export
%uint = OpTypeInt 32 0
%uint_5 = OpConstant %uint 5
%uint_0 = OpConstant %uint 0
%3 = OpTypeFunction %uint %uint
%a = OpFunction %uint Pure %3
%5 = OpFunctionParameter %uint
%6 = OpLabel
%8 = OpIAdd %uint %5 %uint_5
OpReturnValue %8
OpFunctionEnd
%b = OpFunction %uint Pure %3
%10 = OpFunctionParameter %uint
%11 = OpLabel
%13 = OpISub %uint %uint_0 %10
OpReturnValue %13
OpFunctionEnd

View File

@@ -0,0 +1,28 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 14
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpExtension "SPV_KHR_linkonce_odr"
OpMemoryModel Physical64 OpenCL
OpDecorate %a LinkageAttributes "a" LinkOnceODR
OpDecorate %b LinkageAttributes "b" Export
%uint = OpTypeInt 32 0
%uint_5 = OpConstant %uint 5
%uint_0 = OpConstant %uint 0
%3 = OpTypeFunction %uint %uint
%a = OpFunction %uint Pure %3
%5 = OpFunctionParameter %uint
%6 = OpLabel
%8 = OpIAdd %uint %5 %uint_5
OpReturnValue %8
OpFunctionEnd
%b = OpFunction %uint Pure %3
%10 = OpFunctionParameter %uint
%11 = OpLabel
%13 = OpISub %uint %uint_0 %10
OpReturnValue %13
OpFunctionEnd

View File

@@ -0,0 +1,33 @@
; SPIR-V
; Version: 1.1
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 18
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %9 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%9 = OpFunction %void None %8
%10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpLabel
%13 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 16
%14 = OpCompositeExtract %uint %13 0
%15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %14
%16 = OpLoad %uint %15 Aligned 4
%17 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %10 %14
OpStore %17 %16 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,38 @@
; SPIR-V
; Version: 1.1
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 22
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %10 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
%10 = OpFunction %void None %9
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%13 = OpLabel
%14 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 32
%15 = OpCompositeExtract %ulong %14 0
%16 = OpUConvert %uint %15
%17 = OpSConvert %ulong %16
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %12 %17
%19 = OpLoad %uint %18 Aligned 4
%20 = OpSConvert %ulong %16
%21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %20
OpStore %21 %19 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,33 @@
; SPIR-V
; Version: 1.2
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 18
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %9 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%9 = OpFunction %void None %8
%10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpLabel
%13 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 16
%14 = OpCompositeExtract %uint %13 0
%15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %14
%16 = OpLoad %uint %15 Aligned 4
%17 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %10 %14
OpStore %17 %16 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,38 @@
; SPIR-V
; Version: 1.2
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 22
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %10 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
%10 = OpFunction %void None %9
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%13 = OpLabel
%14 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 32
%15 = OpCompositeExtract %ulong %14 0
%16 = OpUConvert %uint %15
%17 = OpSConvert %ulong %16
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %12 %17
%19 = OpLoad %uint %18 Aligned 4
%20 = OpSConvert %ulong %16
%21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %20
OpStore %21 %19 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,33 @@
; SPIR-V
; Version: 1.3
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 18
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %9 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%9 = OpFunction %void None %8
%10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpLabel
%13 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 16
%14 = OpCompositeExtract %uint %13 0
%15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %14
%16 = OpLoad %uint %15 Aligned 4
%17 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %10 %14
OpStore %17 %16 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,38 @@
; SPIR-V
; Version: 1.3
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 22
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %10 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
%10 = OpFunction %void None %9
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%13 = OpLabel
%14 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 32
%15 = OpCompositeExtract %ulong %14 0
%16 = OpUConvert %uint %15
%17 = OpSConvert %ulong %16
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %12 %17
%19 = OpLoad %uint %18 Aligned 4
%20 = OpSConvert %ulong %16
%21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %20
OpStore %21 %19 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,33 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 18
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %9 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%9 = OpFunction %void None %8
%10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpLabel
%13 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 16
%14 = OpCompositeExtract %uint %13 0
%15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %14
%16 = OpLoad %uint %15 Aligned 4
%17 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %10 %14
OpStore %17 %16 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,38 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 22
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %10 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
%10 = OpFunction %void None %9
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%13 = OpLabel
%14 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 32
%15 = OpCompositeExtract %ulong %14 0
%16 = OpUConvert %uint %15
%17 = OpSConvert %ulong %16
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %12 %17
%19 = OpLoad %uint %18 Aligned 4
%20 = OpSConvert %ulong %16
%21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %20
OpStore %21 %19 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,33 @@
; SPIR-V
; Version: 1.5
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 18
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %9 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%9 = OpFunction %void None %8
%10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpLabel
%13 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 16
%14 = OpCompositeExtract %uint %13 0
%15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %14
%16 = OpLoad %uint %15 Aligned 4
%17 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %10 %14
OpStore %17 %16 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,38 @@
; SPIR-V
; Version: 1.5
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 22
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %10 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
%10 = OpFunction %void None %9
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%13 = OpLabel
%14 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 32
%15 = OpCompositeExtract %ulong %14 0
%16 = OpUConvert %uint %15
%17 = OpSConvert %ulong %16
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %12 %17
%19 = OpLoad %uint %18 Aligned 4
%20 = OpSConvert %ulong %16
%21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %20
OpStore %21 %19 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,33 @@
; SPIR-V
; Version: 1.6
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 18
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %9 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%8 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%9 = OpFunction %void None %8
%10 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpLabel
%13 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 16
%14 = OpCompositeExtract %uint %13 0
%15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %14
%16 = OpLoad %uint %15 Aligned 4
%17 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %10 %14
OpStore %17 %16 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,38 @@
; SPIR-V
; Version: 1.6
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 22
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %10 "test_basic" %gl_GlobalInvocationID
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_GlobalInvocationID Constant
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
%10 = OpFunction %void None %9
%11 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%12 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%13 = OpLabel
%14 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 32
%15 = OpCompositeExtract %ulong %14 0
%16 = OpUConvert %uint %15
%17 = OpSConvert %ulong %16
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %12 %17
%19 = OpLoad %uint %18 Aligned 4
%20 = OpSConvert %ulong %16
%21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %11 %20
OpStore %21 %19 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -1,15 +1,19 @@
/******************************************************************
Copyright (c) 2016 The Khronos Group Inc. All Rights Reserved.
//
// Copyright (c) 2016-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.
//
This code is protected by copyright laws and contains material proprietary to the Khronos Group, Inc.
This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed in whole or in part to
third parties, and may not be reproduced, republished, distributed, transmitted, displayed,
broadcast or otherwise exploited in any manner without the express prior written permission
of Khronos Group. The receipt or possession of this code does not convey any rights to reproduce,
disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe,
in whole or in part other than under the terms of the Khronos Adopters Agreement
or Khronos Conformance Test Source License Agreement as executed between Khronos and the recipient.
******************************************************************/
#pragma once
#ifndef _testBase_h

View File

@@ -0,0 +1,123 @@
//
// 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 "testBase.h"
#include "types.hpp"
#include <map>
#include <sstream>
#include <string>
extern bool gVersionSkip;
TEST_SPIRV_FUNC(basic_versions)
{
cl_int error = CL_SUCCESS;
MTdataHolder d(gRandomSeed);
std::vector<cl_int> h_src(num_elements);
generate_random_data(kInt, h_src.size(), d, h_src.data());
clMemWrapper src =
clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
h_src.size() * sizeof(cl_int), h_src.data(), &error);
test_error(error, "Unable to create source buffer");
clMemWrapper dst =
clCreateBuffer(context, 0, h_src.size() * sizeof(cl_int), NULL, &error);
test_error(error, "Unable to create destination buffer");
std::map<std::string, std::string> mapILtoSubdir({
{ "SPIR-V_1.0", "" }, // SPIR-V 1.0 files are in the base directory
{ "SPIR-V_1.1", "spv1.1" },
{ "SPIR-V_1.2", "spv1.2" },
{ "SPIR-V_1.3", "spv1.3" },
{ "SPIR-V_1.4", "spv1.4" },
{ "SPIR-V_1.5", "spv1.5" },
{ "SPIR-V_1.6", "spv1.6" },
});
size_t sz = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_IL_VERSION, 0, NULL, &sz);
test_error(error, "Unable to query device IL versions size");
std::string ilVersions;
ilVersions.resize(sz);
error = clGetDeviceInfo(deviceID, CL_DEVICE_IL_VERSION, sz, &ilVersions[0],
NULL);
test_error(error, "Unable to query device IL versions string");
for (auto& testCase : mapILtoSubdir)
{
if (gVersionSkip)
{
log_info(" Skipping version check for %s.\n",
testCase.first.c_str());
}
else if (ilVersions.find(testCase.first) == std::string::npos)
{
log_info(" Version %s is not supported; skipping test.\n",
testCase.first.c_str());
continue;
}
else
{
log_info(" testing %s...\n", testCase.first.c_str());
}
const cl_int zero = 0;
error =
clEnqueueFillBuffer(queue, dst, &zero, sizeof(zero), 0,
h_src.size() * sizeof(cl_int), 0, NULL, NULL);
test_error(error, "Unable to initialize destination buffer");
std::string filename = testCase.second + "/basic";
clProgramWrapper prog;
error = get_program_with_il(prog, deviceID, context, filename.c_str());
test_error(error, "Unable to build SPIR-V program");
clKernelWrapper kernel = clCreateKernel(prog, "test_basic", &error);
test_error(error, "Unable to create SPIR-V kernel");
error |= clSetKernelArg(kernel, 0, sizeof(dst), &dst);
error |= clSetKernelArg(kernel, 1, sizeof(src), &src);
test_error(error, "Unable to set kernel arguments");
size_t global = num_elements;
error = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &global, NULL, 0,
NULL, NULL);
test_error(error, "Unable to enqueue kernel");
std::vector<cl_int> h_dst(num_elements);
error = clEnqueueReadBuffer(queue, dst, CL_TRUE, 0,
h_dst.size() * sizeof(cl_int), h_dst.data(),
0, NULL, NULL);
test_error(error, "Unable to read destination buffer");
for (int i = 0; i < num_elements; i++)
{
if (h_dst[i] != h_src[i])
{
log_error("Values do not match at location %d\n", i);
return TEST_FAIL;
}
}
}
return TEST_PASS;
}

View File

@@ -1,15 +1,18 @@
/******************************************************************
Copyright (c) 2018 The Khronos Group Inc. All Rights Reserved.
This code is protected by copyright laws and contains material proprietary to the Khronos Group, Inc.
This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed in whole or in part to
third parties, and may not be reproduced, republished, distributed, transmitted, displayed,
broadcast or otherwise exploited in any manner without the express prior written permission
of Khronos Group. The receipt or possession of this code does not convey any rights to reproduce,
disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe,
in whole or in part other than under the terms of the Khronos Adopters Agreement
or Khronos Conformance Test Source License Agreement as executed between Khronos and the recipient.
******************************************************************/
//
// Copyright (c) 2018-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 "testBase.h"
#include "types.hpp"

View File

@@ -1,15 +1,18 @@
/******************************************************************
Copyright (c) 2016 The Khronos Group Inc. All Rights Reserved.
This code is protected by copyright laws and contains material proprietary to the Khronos Group, Inc.
This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed h_in whole or h_in part to
third parties, and may not be reproduced, republished, distributed, transmitted, displayed,
broadcast or otherwise exploited h_in any manner without the express prior written permission
of Khronos Group. The receipt or possession of this code does not convey any rights to reproduce,
disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe,
h_in whole or h_in part other than under the terms of the Khronos Adopters Agreement
or Khronos Conformance Test Source License Agreement as executed between Khronos and the recipient.
******************************************************************/
//
// Copyright (c) 2016-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 "testBase.h"
#include "types.hpp"
@@ -19,10 +22,7 @@ or Khronos Conformance Test Source License Agreement as executed between Khronos
#include <limits>
#include <cmath>
#ifndef isnan
// Ensure isnan is always present as a macro
#define isnan std::isnan
#endif
#include <CL/cl_half.h>
long double reference_remainderl(long double x, long double y);
int gIsInRTZMode = 0;
@@ -30,7 +30,6 @@ int gDeviceILogb0 = 1;
int gDeviceILogbNaN = 1;
int gCheckTininessBeforeRounding = 1;
static int verify_results(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
@@ -44,7 +43,8 @@ static int verify_results(cl_device_id deviceID,
cl_int err = 0;
RandomSeed seed(gRandomSeed);
for (int i = 0; i < num; i++) {
for (int i = 0; i < num; i++)
{
h_lhs[i] = genrand<cl_int>(seed);
h_rhs[i] = genrand<cl_int>(seed);
}
@@ -86,8 +86,10 @@ static int verify_results(cl_device_id deviceID,
err = clEnqueueReadBuffer(queue, res, CL_TRUE, 0, bytes, &h_res[0], 0, NULL, NULL);
SPIRV_CHECK_ERROR(err, "Failed to read to output");
for (int i = 0; i < num; i++) {
if (h_res[i] != (h_lhs[i] + h_rhs[i])) {
for (int i = 0; i < num; i++)
{
if (h_res[i] != (h_lhs[i] + h_rhs[i]))
{
log_error("Values do not match at location %d\n", i);
return -1;
}
@@ -132,12 +134,10 @@ TEST_SPIRV_FUNC(decorate_constant)
TEST_SPIRV_FUNC(decorate_cpacked)
{
PACKED(
struct packed_struct_t {
cl_int ival;
cl_char cval;
}
);
PACKED(struct packed_struct_t {
cl_int ival;
cl_char cval;
});
typedef struct packed_struct_t packed_t;
@@ -166,9 +166,10 @@ TEST_SPIRV_FUNC(decorate_cpacked)
err = clEnqueueReadBuffer(queue, res, CL_TRUE, 0, bytes, &h_res[0], 0, NULL, NULL);
SPIRV_CHECK_ERROR(err, "Failed to read to output");
for (int i = 0; i < num; i++) {
if (h_res[i].ival != 2100483600 ||
h_res[i].cval != 127) {
for (int i = 0; i < num; i++)
{
if (h_res[i].ival != 2100483600 || h_res[i].cval != 127)
{
log_error("Values do not match at location %d\n", i);
return -1;
}
@@ -177,20 +178,79 @@ TEST_SPIRV_FUNC(decorate_cpacked)
return 0;
}
template<typename Ti, typename Tl, typename To>
int verify_saturated_results(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
const char *kname,
const clProgramWrapper &prog)
template <typename Ti, typename Tl, typename To>
static inline Ti generate_saturated_lhs_input(RandomSeed &seed)
{
if(std::string(kname).find("double") != std::string::npos) {
if(!is_extension_available(deviceID, "cl_khr_fp64")) {
log_info("Extension cl_khr_fp64 not supported; skipping double tests.\n");
return 0;
}
constexpr auto loVal = std::numeric_limits<To>::min();
constexpr auto hiVal = std::numeric_limits<To>::max();
constexpr Tl range = (Tl)(hiVal) - (Tl)(loVal);
if (std::is_same<cl_half, Ti>::value)
{
return cl_half_from_float(genrand<float>(seed) * range, CL_HALF_RTE);
}
return genrand<Ti>(seed) * range;
}
template <typename Ti, typename Tl, typename To>
static inline Ti generate_saturated_rhs_input(RandomSeed &seed)
{
constexpr auto hiVal = std::numeric_limits<To>::max();
Tl val = genrand<Tl>(seed) % hiVal;
if (std::is_same<cl_half, Ti>::value)
{
if (val > 0 && val * 20 < hiVal)
{
return cl_half_from_float(NAN, CL_HALF_RTE);
}
return cl_half_from_float(val, CL_HALF_RTE);
}
if (val > 0 && val * 20 < hiVal)
{
return (Ti)NAN;
}
return val;
}
template <typename Ti, typename Tl, typename To>
static inline To compute_saturated_output(Ti lhs, Ti rhs)
{
constexpr auto loVal = std::numeric_limits<To>::min();
constexpr auto hiVal = std::numeric_limits<To>::max();
if (std::is_same<Ti, cl_half>::value)
{
cl_float f = cl_half_to_float(lhs) * cl_half_to_float(rhs);
// Quantize to fp16:
f = cl_half_to_float(cl_half_from_float(f, CL_HALF_RTE));
To val = (To)std::min<float>(std::max<float>(f, loVal), hiVal);
if (isnan(cl_half_from_float(rhs, CL_HALF_RTE)))
{
val = 0;
}
return val;
}
Tl ival = (Tl)(lhs * rhs);
To val = (To)std::min<Ti>(std::max<Ti>(ival, loVal), hiVal);
if (isnan(rhs))
{
val = 0;
}
return val;
}
template <typename Ti, typename Tl, typename To>
int verify_saturated_results(cl_device_id deviceID, cl_context context,
cl_command_queue queue, const char *kname,
const clProgramWrapper &prog)
{
cl_int err = 0;
const int num = 1 << 20;
@@ -204,21 +264,11 @@ int verify_saturated_results(cl_device_id deviceID,
std::vector<Ti> h_lhs(num);
std::vector<Ti> h_rhs(num);
To loVal = std::numeric_limits<To>::min();
To hiVal = std::numeric_limits<To>::max();
Tl range = (Tl)(hiVal) - (Tl)(loVal);
RandomSeed seed(gRandomSeed);
for (int i = 0; i < num; i++) {
h_lhs[i] = genrand<Ti>(seed) * range;
Tl val = (genrand<Tl>(seed) % hiVal);
// randomly set some values on rhs to NaN
if (val * 20 < hiVal) {
h_rhs[i] = NAN;
} else {
h_rhs[i] = (Ti)(val);
}
for (int i = 0; i < num; i++)
{
h_lhs[i] = generate_saturated_lhs_input<Ti, Tl, To>(seed);
h_rhs[i] = generate_saturated_rhs_input<Ti, Tl, To>(seed);
}
clMemWrapper lhs = clCreateBuffer(context, CL_MEM_READ_ONLY, in_bytes, NULL, &err);
@@ -253,16 +303,13 @@ int verify_saturated_results(cl_device_id deviceID,
err = clEnqueueReadBuffer(queue, res, CL_TRUE, 0, out_bytes, &h_res[0], 0, NULL, NULL);
SPIRV_CHECK_ERROR(err, "Failed to read to output");
for (int i = 0; i < num; i++) {
Tl ival = (Tl)(h_lhs[i] * h_rhs[i]);
To val = (To)std::min<Ti>(std::max<Ti>(ival, loVal), hiVal);
for (int i = 0; i < num; i++)
{
To val = compute_saturated_output<Ti, Tl, To>(h_lhs[i], h_rhs[i]);
if (isnan(h_rhs[i])) {
val = 0;
}
if (val != h_res[i]) {
log_error("Value error at %d\n", i);
if (val != h_res[i])
{
log_error("Value error at %d: got %d, want %d\n", i, val, h_res[i]);
return -1;
}
}
@@ -278,31 +325,47 @@ int test_saturate_full(cl_device_id deviceID,
const char *name,
const char *types)
{
if(std::string(types).find("double") != std::string::npos) {
if(!is_extension_available(deviceID, "cl_khr_fp64")) {
log_info("Extension cl_khr_fp64 not supported; skipping double tests.\n");
if (std::string(types).find("double") != std::string::npos)
{
if (!is_extension_available(deviceID, "cl_khr_fp64"))
{
log_info("Extension cl_khr_fp64 not supported; skipping double "
"tests.\n");
return 0;
}
}
if (std::string(types).find("half") != std::string::npos)
{
if (!is_extension_available(deviceID, "cl_khr_fp16"))
{
log_info(
"Extension cl_khr_fp16 not supported; skipping half tests.\n");
return 0;
}
}
clProgramWrapper prog;
cl_int err = 0;
err = get_program_with_il(prog, deviceID, context, name);
SPIRV_CHECK_ERROR(err, "Failed to build program");
return verify_saturated_results<Ti, Tl, To>(deviceID, context, queue, name, prog);
return verify_saturated_results<Ti, Tl, To>(deviceID, context, queue, name,
prog);
}
#define TEST_SATURATED_CONVERSION(Ti, Tl, To) \
TEST_SPIRV_FUNC(decorate_saturated_conversion_##To) \
{ \
typedef cl_##Ti cl_Ti; \
typedef cl_##Tl cl_Tl; \
typedef cl_##To cl_To; \
return test_saturate_full<cl_Ti, cl_Tl, cl_To> \
(deviceID, context, queue, \
"decorate_saturated_conversion_" #To, \
#Ti #Tl #To); \
} \
#define TEST_SATURATED_CONVERSION(Ti, Tl, To) \
TEST_SPIRV_FUNC(decorate_saturated_conversion_##Ti##_to_##To) \
{ \
typedef cl_##Ti cl_Ti; \
typedef cl_##Tl cl_Tl; \
typedef cl_##To cl_To; \
const char *name = "decorate_saturated_conversion_" #Ti "_to_" #To; \
return test_saturate_full<cl_Ti, cl_Tl, cl_To>( \
deviceID, context, queue, name, #Ti #Tl #To); \
}
TEST_SATURATED_CONVERSION(half, short, char)
TEST_SATURATED_CONVERSION(half, ushort, uchar)
TEST_SATURATED_CONVERSION(float, int, char)
TEST_SATURATED_CONVERSION(float, uint, uchar)
TEST_SATURATED_CONVERSION(float, int, short)
@@ -318,9 +381,22 @@ int test_fp_rounding(cl_device_id deviceID,
std::vector<Ti> &h_in,
std::vector<To> &h_out)
{
if(std::string(name).find("double") != std::string::npos) {
if(!is_extension_available(deviceID, "cl_khr_fp64")) {
log_info("Extension cl_khr_fp64 not supported; skipping double tests.\n");
if (std::string(name).find("double") != std::string::npos)
{
if (!is_extension_available(deviceID, "cl_khr_fp64"))
{
log_info("Extension cl_khr_fp64 not supported; skipping double "
"tests.\n");
return 0;
}
}
if (std::string(name).find("half") != std::string::npos)
{
if (!is_extension_available(deviceID, "cl_khr_fp16"))
{
log_info(
"Extension cl_khr_fp16 not supported; skipping half tests.\n");
return 0;
}
}
@@ -359,9 +435,12 @@ int test_fp_rounding(cl_device_id deviceID,
err = clEnqueueReadBuffer(queue, out, CL_TRUE, 0, out_bytes, &h_res[0], 0, NULL, NULL);
SPIRV_CHECK_ERROR(err, "Failed to read from output");
for (int i = 0; i < num; i++) {
if (h_res[i] != h_out[i]) {
log_error("Values do not match at location %d. Original :%lf, Expected: %ld, Found %ld\n",
for (int i = 0; i < num; i++)
{
if (h_res[i] != h_out[i])
{
log_error("Values do not match at location %d. Original :%lf, "
"Expected: %ld, Found %ld\n",
i, h_in[i], h_out[i], h_res[i]);
return -1;
}
@@ -370,60 +449,80 @@ int test_fp_rounding(cl_device_id deviceID,
return 0;
}
template<typename Ti, typename To>
inline To round_to_zero(Ti in)
template <typename T> static inline double to_double(T in) { return in; }
template <> inline double to_double(cl_half in) { return cl_half_to_float(in); }
template <typename Ti, typename To> static inline To round_to_zero(Ti in)
{
To out = (To)(in);
return out;
return (To)to_double(in);
}
template<typename T>
int sign(T val)
template <typename T> static inline int sign(T val)
{
if (val < 0) return -1;
if (val > 0) return 1;
return 0;
}
template<typename Ti, typename To>
inline To round_to_even(Ti in)
template <typename Ti, typename To> static inline To round_to_even(Ti in)
{
// https://en.wikipedia.org/wiki/Rounding#Round_half_to_even
return std::floor(in + 0.5) - 1 + std::abs(sign(reference_remainderl((long double)in, 2) - 0.5));
double din = to_double(in);
return std::floor(din + 0.5) - 1
+ std::abs(sign(reference_remainderl((long double)din, 2) - 0.5));
}
template<typename Ti, typename To>
inline To round_to_posinf(Ti in)
template <typename Ti, typename To> static inline To round_to_posinf(Ti in)
{
To out = std::ceil(in);
return out;
return std::ceil(to_double(in));
}
template<typename Ti, typename To>
inline To round_to_neginf(Ti in)
template <typename Ti, typename To> static inline To round_to_neginf(Ti in)
{
To out = std::floor(in);
return out;
return std::floor(to_double(in));
}
#define TEST_SPIRV_FP_ROUNDING_DECORATE(name, func, Ti, To) \
TEST_SPIRV_FUNC(decorate_fp_rounding_mode_##name##_##Ti##_##To) \
{ \
typedef cl_##Ti clTi; \
typedef cl_##To clTo; \
const int num = 1 << 16; \
std::vector<clTi> in(num); \
std::vector<clTo> out(num); \
RandomSeed seed(gRandomSeed); \
\
for (int i = 0; i < num; i++) { \
in[i] = num * genrand<clTi>(seed) - num/2; \
out[i] = func<clTi, clTo>(in[i]); \
} \
const char *name = "decorate_rounding_" #name "_" #Ti "_" #To; \
return test_fp_rounding(deviceID, context, queue, \
name, in, out); \
} \
template <typename Ti, typename To>
static inline Ti generate_fprounding_input(RandomSeed &seed)
{
if (std::is_same<cl_half, Ti>::value)
{
constexpr auto minVal =
static_cast<cl_float>(std::numeric_limits<To>::min() / 2);
constexpr auto maxVal =
static_cast<cl_float>(std::numeric_limits<To>::max() / 2);
cl_float f = genrandReal_range<cl_float>(minVal, maxVal, seed);
return cl_half_from_float(f, CL_HALF_RTE);
}
constexpr auto minVal = static_cast<Ti>(std::numeric_limits<To>::min() / 2);
constexpr auto maxVal = static_cast<Ti>(std::numeric_limits<To>::max() / 2);
return genrandReal_range<Ti>(minVal, maxVal, seed);
}
#define TEST_SPIRV_FP_ROUNDING_DECORATE(name, func, Ti, To) \
TEST_SPIRV_FUNC(decorate_fp_rounding_mode_##name##_##Ti##_##To) \
{ \
typedef cl_##Ti clTi; \
typedef cl_##To clTo; \
const int num = 1 << 16; \
std::vector<clTi> in(num); \
std::vector<clTo> out(num); \
RandomSeed seed(gRandomSeed); \
\
for (int i = 0; i < num; i++) \
{ \
in[i] = generate_fprounding_input<clTi, clTo>(seed); \
out[i] = func<clTi, clTo>(in[i]); \
} \
const char *name = "decorate_rounding_" #name "_" #Ti "_" #To; \
return test_fp_rounding(deviceID, context, queue, name, in, out); \
}
TEST_SPIRV_FP_ROUNDING_DECORATE(rte, round_to_even, half, short);
TEST_SPIRV_FP_ROUNDING_DECORATE(rtz, round_to_zero, half, short);
TEST_SPIRV_FP_ROUNDING_DECORATE(rtp, round_to_posinf, half, short);
TEST_SPIRV_FP_ROUNDING_DECORATE(rtn, round_to_neginf, half, short);
TEST_SPIRV_FP_ROUNDING_DECORATE(rte, round_to_even, float, int);
TEST_SPIRV_FP_ROUNDING_DECORATE(rtz, round_to_zero, float, int);

View File

@@ -1,17 +1,18 @@
/******************************************************************
Copyright (c) 2020 The Khronos Group Inc. All Rights Reserved.
This code is protected by copyright laws and contains material proprietary to
the Khronos Group, Inc. This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not
be disclosed in whole or in part to third parties, and may not be reproduced,
republished, distributed, transmitted, displayed, broadcast or otherwise
exploited in any manner without the express prior written permission of Khronos
Group. The receipt or possession of this code does not convey any rights to
reproduce, disclose, or distribute its contents, or to manufacture, use, or sell
anything that it may describe, in whole or in part other than under the terms of
the Khronos Adopters Agreement or Khronos Conformance Test Source License
Agreement as executed between Khronos and the recipient.
******************************************************************/
//
// Copyright (c) 2020-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 "testBase.h"

View File

@@ -1,15 +1,18 @@
/******************************************************************
Copyright (c) 2016 The Khronos Group Inc. All Rights Reserved.
This code is protected by copyright laws and contains material proprietary to the Khronos Group, Inc.
This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed h_in whole or h_in part to
third parties, and may not be reproduced, republished, distributed, transmitted, displayed,
broadcast or otherwise exploited h_in any manner without the express prior written permission
of Khronos Group. The receipt or possession of this code does not convey any rights to reproduce,
disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe,
h_in whole or h_in part other than under the terms of the Khronos Adopters Agreement
or Khronos Conformance Test Source License Agreement as executed between Khronos and the recipient.
******************************************************************/
//
// Copyright (c) 2016-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 "testBase.h"
#include "types.hpp"
@@ -141,3 +144,96 @@ TEST_SPIRV_FUNC(linkage_import_function_link)
return 0;
}
static int test_linkonce_odr_helper(cl_device_id deviceID, cl_context context,
cl_command_queue queue,
const char *main_module_filename)
{
cl_int err = 0;
clProgramWrapper prog_obj;
err = test_linkage_compile(deviceID, context, queue,
"linkage_linkonce_odr_obj", prog_obj);
SPIRV_CHECK_ERROR(err, "Failed to compile export program");
clProgramWrapper prog_main;
err = test_linkage_compile(deviceID, context, queue, main_module_filename,
prog_main);
SPIRV_CHECK_ERROR(err, "Failed to compile import program");
cl_program progs[] = { prog_obj, prog_main };
clProgramWrapper prog =
clLinkProgram(context, 1, &deviceID, NULL, 2, progs, NULL, NULL, &err);
SPIRV_CHECK_ERROR(err, "Failed to link programs");
clKernelWrapper kernel = clCreateKernel(prog, "test_linkonce_odr", &err);
SPIRV_CHECK_ERROR(err, "Failed to create spv kernel");
const int num = 256;
std::vector<cl_int> h_in(num);
RandomSeed seed(gRandomSeed);
for (int i = 0; i < num; i++)
{
h_in[i] = genrand<cl_int>(seed) % 2048;
}
size_t bytes = sizeof(cl_int) * num;
clMemWrapper in =
clCreateBuffer(context, CL_MEM_READ_WRITE, bytes, NULL, &err);
SPIRV_CHECK_ERROR(err, "Failed to create in buffer");
err = clEnqueueWriteBuffer(queue, in, CL_TRUE, 0, bytes, &h_in[0], 0, NULL,
NULL);
SPIRV_CHECK_ERROR(err, "Failed to copy to in buffer");
err = clSetKernelArg(kernel, 0, sizeof(cl_mem), &in);
SPIRV_CHECK_ERROR(err, "Failed to set arg 1");
size_t global = num;
err = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &global, NULL, 0, NULL,
NULL);
SPIRV_CHECK_ERROR(err, "Failed to enqueue cl kernel");
std::vector<cl_int> h_out(num);
err = clEnqueueReadBuffer(queue, in, CL_TRUE, 0, bytes, &h_out[0], 0, NULL,
NULL);
SPIRV_CHECK_ERROR(err, "Failed to read to output");
for (int i = 0; i < num; i++)
{
if (h_out[i] != 5)
{
log_error("Incorrect values at location %d\n", i);
return TEST_FAIL;
}
}
return TEST_PASS;
}
TEST_SPIRV_FUNC(linkage_linkonce_odr)
{
if (!is_extension_available(deviceID, "cl_khr_spirv_linkonce_odr"))
{
log_info("Extension cl_khr_spirv_linkonce_odr not supported; skipping "
"tests.\n");
return TEST_SKIPPED_ITSELF;
}
int result = TEST_PASS;
// For this test, use the default main module, which has an "a" function
// with the linkonce_odr linkage type. This ensures that having two "a"
// functions with linkonce_odr works properly.
result |= test_linkonce_odr_helper(deviceID, context, queue,
"linkage_linkonce_odr_main");
// For this test, use a main module without the "a" function. This ensures
// that the "a" function is properly exported with the linkonce_odr linkage
// type.
result |= test_linkonce_odr_helper(deviceID, context, queue,
"linkage_linkonce_odr_noa_main");
return result;
}

View File

@@ -1,15 +1,18 @@
/******************************************************************
Copyright (c) 2016 The Khronos Group Inc. All Rights Reserved.
This code is protected by copyright laws and contains material proprietary to the Khronos Group, Inc.
This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed in whole or in part to
third parties, and may not be reproduced, republished, distributed, transmitted, displayed,
broadcast or otherwise exploited in any manner without the express prior written permission
of Khronos Group. The receipt or possession of this code does not convey any rights to reproduce,
disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe,
in whole or in part other than under the terms of the Khronos Adopters Agreement
or Khronos Conformance Test Source License Agreement as executed between Khronos and the recipient.
******************************************************************/
//
// Copyright (c) 2016-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 "testBase.h"
#include "types.hpp"

View File

@@ -1,15 +1,18 @@
/******************************************************************
Copyright (c) 2016 The Khronos Group Inc. All Rights Reserved.
This code is protected by copyright laws and contains material proprietary to the Khronos Group, Inc.
This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed in whole or in part to
third parties, and may not be reproduced, republished, distributed, transmitted, displayed,
broadcast or otherwise exploited in any manner without the express prior written permission
of Khronos Group. The receipt or possession of this code does not convey any rights to reproduce,
disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe,
in whole or in part other than under the terms of the Khronos Adopters Agreement
or Khronos Conformance Test Source License Agreement as executed between Khronos and the recipient.
******************************************************************/
//
// Copyright (c) 2016-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 "testBase.h"
#include "types.hpp"

View File

@@ -1,15 +1,18 @@
/******************************************************************
Copyright (c) 2016 The Khronos Group Inc. All Rights Reserved.
This code is protected by copyright laws and contains material proprietary to the Khronos Group, Inc.
This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed in whole or in part to
third parties, and may not be reproduced, republished, distributed, transmitted, displayed,
broadcast or otherwise exploited in any manner without the express prior written permission
of Khronos Group. The receipt or possession of this code does not convey any rights to reproduce,
disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe,
in whole or in part other than under the terms of the Khronos Adopters Agreement
or Khronos Conformance Test Source License Agreement as executed between Khronos and the recipient.
******************************************************************/
//
// Copyright (c) 2016-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 "testBase.h"
#include "types.hpp"

View File

@@ -1,15 +1,18 @@
/******************************************************************
Copyright (c) 2016 The Khronos Group Inc. All Rights Reserved.
This code is protected by copyright laws and contains material proprietary to the Khronos Group, Inc.
This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed in whole or in part to
third parties, and may not be reproduced, republished, distributed, transmitted, displayed,
broadcast or otherwise exploited in any manner without the express prior written permission
of Khronos Group. The receipt or possession of this code does not convey any rights to reproduce,
disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe,
in whole or in part other than under the terms of the Khronos Adopters Agreement
or Khronos Conformance Test Source License Agreement as executed between Khronos and the recipient.
******************************************************************/
//
// Copyright (c) 2016-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 "testBase.h"
#include "types.hpp"

View File

@@ -1,15 +1,18 @@
/******************************************************************
Copyright (c) 2016 The Khronos Group Inc. All Rights Reserved.
This code is protected by copyright laws and contains material proprietary to the Khronos Group, Inc.
This is UNPUBLISHED PROPRIETARY SOURCE CODE that may not be disclosed in whole or in part to
third parties, and may not be reproduced, republished, distributed, transmitted, displayed,
broadcast or otherwise exploited in any manner without the express prior written permission
of Khronos Group. The receipt or possession of this code does not convey any rights to reproduce,
disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe,
in whole or in part other than under the terms of the Khronos Adopters Agreement
or Khronos Conformance Test Source License Agreement as executed between Khronos and the recipient.
******************************************************************/
//
// Copyright (c) 2016-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 "testBase.h"
#include "types.hpp"

Some files were not shown because too many files have changed in this diff Show More