Re-enabling narrowing errors (#1144)

Fixes narrowing conversion build errors in test_common

Removing disable of narrowing errors in main CMakeLists.txt
and moving it down to specific test_conformance suite's 
CMakeLists.txt where there are many more build errors revealed
from this fix. 

Fixes a few simple issues under test_conformance in the process.

Contributes #787

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

---------

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
This commit is contained in:
ellnor01
2024-10-08 17:54:32 +01:00
committed by GitHub
parent 7d86714c10
commit 617e7cb233
26 changed files with 100 additions and 60 deletions

View File

@@ -104,7 +104,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang"
# Enable more warnings if not doing a release build.
add_cxx_flag_if_supported(-Wall)
endif()
add_cxx_flag_if_supported(-Wno-narrowing)
add_cxx_flag_if_supported(-Wno-format)
add_cxx_flag_if_supported(-Wno-error=cpp) # Allow #warning directive
add_cxx_flag_if_supported(-Wno-unknown-pragmas) # Issue #785

View File

@@ -1624,7 +1624,7 @@ Version get_device_cl_c_version(cl_device_id device)
&opencl_c_version_size_in_bytes);
test_error_ret(error,
"clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_VERSION\n",
(Version{ -1, 0 }));
(Version{ 0, 0 }));
std::string opencl_c_version(opencl_c_version_size_in_bytes, '\0');
error =
@@ -1633,13 +1633,13 @@ Version get_device_cl_c_version(cl_device_id device)
test_error_ret(error,
"clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_VERSION\n",
(Version{ -1, 0 }));
(Version{ 0, 0 }));
// Scrape out the major, minor pair from the string.
auto major = opencl_c_version[opencl_c_version.find('.') - 1];
auto minor = opencl_c_version[opencl_c_version.find('.') + 1];
return Version{ major - '0', minor - '0' };
return Version{ (cl_uint)(major - '0'), (cl_uint)(minor - '0') };
}
Version get_device_latest_cl_c_version(cl_device_id device)
@@ -1657,7 +1657,7 @@ Version get_device_latest_cl_c_version(cl_device_id device)
&opencl_c_all_versions_size_in_bytes);
test_error_ret(
error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_ALL_VERSIONS",
(Version{ -1, 0 }));
(Version{ 0, 0 }));
std::vector<cl_name_version> name_versions(
opencl_c_all_versions_size_in_bytes / sizeof(cl_name_version));
error = clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_ALL_VERSIONS,
@@ -1665,14 +1665,14 @@ Version get_device_latest_cl_c_version(cl_device_id device)
name_versions.data(), nullptr);
test_error_ret(
error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_ALL_VERSIONS",
(Version{ -1, 0 }));
(Version{ 0, 0 }));
Version max_supported_cl_c_version{};
for (const auto &name_version : name_versions)
{
Version current_version{
static_cast<int>(CL_VERSION_MAJOR(name_version.version)),
static_cast<int>(CL_VERSION_MINOR(name_version.version))
static_cast<cl_uint>(CL_VERSION_MAJOR(name_version.version)),
static_cast<cl_uint>(CL_VERSION_MINOR(name_version.version))
};
max_supported_cl_c_version =
(current_version > max_supported_cl_c_version)
@@ -1693,7 +1693,7 @@ Version get_max_OpenCL_C_for_context(cl_context context)
auto error = clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, nullptr,
&devices_size_in_bytes);
test_error_ret(error, "clGetDeviceInfo failed for CL_CONTEXT_DEVICES",
(Version{ -1, 0 }));
(Version{ 0, 0 }));
std::vector<cl_device_id> devices(devices_size_in_bytes
/ sizeof(cl_device_id));
error = clGetContextInfo(context, CL_CONTEXT_DEVICES, devices_size_in_bytes,
@@ -1757,8 +1757,8 @@ bool device_supports_cl_c_version(cl_device_id device, Version version)
for (const auto &name_version : name_versions)
{
Version current_version{
static_cast<int>(CL_VERSION_MAJOR(name_version.version)),
static_cast<int>(CL_VERSION_MINOR(name_version.version))
static_cast<cl_uint>(CL_VERSION_MAJOR(name_version.version)),
static_cast<cl_uint>(CL_VERSION_MINOR(name_version.version))
};
if (current_version == version)
{

View File

@@ -240,7 +240,7 @@ void UnFlushToZero(void *p)
#if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER)
union {
void *p;
int i;
unsigned int i;
} u = { p };
_mm_setcsr(u.i);
#elif defined(__arm__) || defined(__aarch64__)

View File

@@ -25,22 +25,28 @@
class Version {
public:
Version(): m_major(0), m_minor(0) {}
Version(int major, int minor): m_major(major), m_minor(minor) {}
bool operator>(const Version &rhs) const { return to_int() > rhs.to_int(); }
bool operator<(const Version &rhs) const { return to_int() < rhs.to_int(); }
Version(cl_uint major, cl_uint minor): m_major(major), m_minor(minor) {}
bool operator>(const Version &rhs) const
{
return to_uint() > rhs.to_uint();
}
bool operator<(const Version &rhs) const
{
return to_uint() < rhs.to_uint();
}
bool operator<=(const Version &rhs) const
{
return to_int() <= rhs.to_int();
return to_uint() <= rhs.to_uint();
}
bool operator>=(const Version &rhs) const
{
return to_int() >= rhs.to_int();
return to_uint() >= rhs.to_uint();
}
bool operator==(const Version &rhs) const
{
return to_int() == rhs.to_int();
return to_uint() == rhs.to_uint();
}
int to_int() const { return m_major * 10 + m_minor; }
cl_uint to_uint() const { return m_major * 10 + m_minor; }
std::string to_string() const
{
std::stringstream ss;
@@ -49,8 +55,8 @@ public:
}
private:
int m_major;
int m_minor;
cl_uint m_major;
cl_uint m_minor;
};
Version get_device_cl_version(cl_device_id device);

View File

@@ -154,7 +154,7 @@ int sampler_param_test(cl_sampler sampler, cl_sampler_info param_name,
return 0;
}
static cl_int normalized_coord_values[] = { CL_TRUE, CL_FALSE };
static cl_bool normalized_coord_values[] = { CL_TRUE, CL_FALSE };
static cl_addressing_mode addressing_mode_values[] = {
CL_ADDRESS_NONE, CL_ADDRESS_CLAMP_TO_EDGE, CL_ADDRESS_CLAMP,
CL_ADDRESS_REPEAT, CL_ADDRESS_MIRRORED_REPEAT

View File

@@ -1292,8 +1292,8 @@ cl_long test_atomic_and_result_long(size_t size, cl_long *startRefValues,
int test_atomic_and(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
{
TestFns set = { 0xffffffff,
0xffffffffffffffffLL,
TestFns set = { (cl_int)0xffffffff,
(cl_long)0xffffffffffffffffLL,
test_bitwise_num_results,
test_atomic_and_result_int,
NULL,

View File

@@ -1,5 +1,9 @@
set(MODULE_NAME BASIC)
if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang")
add_cxx_flag_if_supported(-Wno-narrowing)
endif()
set(${MODULE_NAME}_SOURCES
main.cpp
test_fpmath.cpp

View File

@@ -217,7 +217,7 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c
// The OpenCL version reported by the macro reports the feature level supported by the compiler. Since
// this doesn't directly match any property we can query, we just check to see if it's a sane value
auto device_cl_version = get_device_cl_version(deviceID);
int device_cl_version_int = device_cl_version.to_int() * 10;
int device_cl_version_int = device_cl_version.to_uint() * 10;
if ((results[2] < 100) || (results[2] > device_cl_version_int))
{
log_error("ERROR: Kernel preprocessor __OPENCL_VERSION__ does not make "
@@ -241,14 +241,16 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c
int cl_c_minor_version = (results[3] / 10) % 10;
if ((results[3] < 100)
|| (!device_supports_cl_c_version(
deviceID, Version{ cl_c_major_version, cl_c_minor_version })))
deviceID,
Version{ (cl_uint)cl_c_major_version,
(cl_uint)cl_c_minor_version })))
{
auto device_version = get_device_cl_c_version(deviceID);
log_error(
"ERROR: Kernel preprocessor __OPENCL_C_VERSION__ does not make "
"sense w.r.t. device's version string! "
"(preprocessor states %d, CL_DEVICE_OPENCL_C_VERSION is %d (%s))\n",
results[3], device_version.to_int() * 10,
results[3], device_version.to_uint() * 10,
device_version.to_string().c_str());
log_error("This means that CL_DEVICE_OPENCL_C_VERSION < "
"__OPENCL_C_VERSION__");

View File

@@ -89,7 +89,7 @@ int test_preprocessor_define_udef(cl_device_id deviceID, cl_context context, cl_
error = clEnqueueWriteBuffer(queue, buffer[0], CL_TRUE, 0, num_elements*sizeof(cl_int), srcData, 0, NULL, NULL);
test_error(error, "clEnqueueWriteBuffer failed");
size_t threads[3] = {num_elements, 0, 0};
size_t threads[3] = { (size_t)num_elements, 0, 0 };
error = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, threads, NULL, 0, NULL, NULL);
test_error(error, "clEnqueueNDRangeKernel failed");
@@ -175,7 +175,7 @@ int test_preprocessor_include(cl_device_id deviceID, cl_context context, cl_comm
error = clSetKernelArg(kernel, 1, sizeof(buffer[1]), &buffer[1]);
test_error(error, "clSetKernelArg failed");
size_t threads[3] = {num_elements, 0, 0};
size_t threads[3] = { (size_t)num_elements, 0, 0 };
error = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, threads, NULL, 0, NULL, NULL);
test_error(error, "clEnqueueNDRangeKernel failed");
@@ -272,7 +272,7 @@ int test_preprocessor_line_error(cl_device_id deviceID, cl_context context, cl_c
error = clSetKernelArg(kernel, 0, sizeof(buffer[0]), &buffer[0]);
test_error(error, "clSetKernelArg failed");
size_t threads[3] = {num_elements, 0, 0};
size_t threads[3] = { (size_t)num_elements, 0, 0 };
error = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, threads, NULL, 0, NULL, NULL);
test_error(error, "clEnqueueNDRangeKernel failed");
@@ -313,7 +313,7 @@ int test_preprocessor_pragma(cl_device_id deviceID, cl_context context, cl_comma
error = clSetKernelArg(kernel, 0, sizeof(buffer[0]), &buffer[0]);
test_error(error, "clSetKernelArg failed");
size_t threads[3] = {num_elements, 0, 0};
size_t threads[3] = { (size_t)num_elements, 0, 0 };
error = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, threads, NULL, 0, NULL, NULL);
test_error(error, "clEnqueueNDRangeKernel failed");

View File

@@ -35,11 +35,11 @@ typedef struct
} device_info;
device_info device_infos[] = {
{ CL_DEVICE_TYPE_DEFAULT, "CL_DEVICE_TYPE_DEFAULT", -1, NULL },
{ CL_DEVICE_TYPE_CPU, "CL_DEVICE_TYPE_CPU", -1, NULL },
{ CL_DEVICE_TYPE_GPU, "CL_DEVICE_TYPE_GPU", -1, NULL },
{ CL_DEVICE_TYPE_ACCELERATOR, "CL_DEVICE_TYPE_ACCELERATOR", -1, NULL },
{ CL_DEVICE_TYPE_ALL, "CL_DEVICE_TYPE_ALL", -1, NULL },
{ CL_DEVICE_TYPE_DEFAULT, "CL_DEVICE_TYPE_DEFAULT", 0, NULL },
{ CL_DEVICE_TYPE_CPU, "CL_DEVICE_TYPE_CPU", 0, NULL },
{ CL_DEVICE_TYPE_GPU, "CL_DEVICE_TYPE_GPU", 0, NULL },
{ CL_DEVICE_TYPE_ACCELERATOR, "CL_DEVICE_TYPE_ACCELERATOR", 0, NULL },
{ CL_DEVICE_TYPE_ALL, "CL_DEVICE_TYPE_ALL", 0, NULL },
};
// config types

View File

@@ -1,5 +1,9 @@
set(MODULE_NAME CONVERSIONS)
if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang")
add_cxx_flag_if_supported(-Wno-narrowing)
endif()
set (${MODULE_NAME}_SOURCES
Sleep.cpp test_conversions.cpp basic_test_conversions.cpp
)

View File

@@ -1016,7 +1016,7 @@ int test_execute_block(cl_device_id device, cl_context context, cl_command_queue
size_t ret_len;
cl_int n, err_ret, res = 0;
clCommandQueueWrapper dev_queue;
cl_int kernel_results[MAX_GWS] = {0xDEADBEEF};
cl_int kernel_results[MAX_GWS] = { (cl_int)0xDEADBEEF };
size_t max_local_size = 1;
err_ret = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(max_local_size), &max_local_size, &ret_len);

View File

@@ -353,7 +353,8 @@ int test_device_set(size_t deviceCount, size_t queueCount, cl_device_id *devices
}
int init_device_partition_test(cl_device_id parentDevice, cl_uint &maxComputeUnits, cl_uint &maxSubDevices)
int init_device_partition_test(cl_device_id parentDevice,
cl_uint &maxComputeUnits, cl_uint &maxSubDevices)
{
int err = clGetDeviceInfo(parentDevice, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(maxComputeUnits), &maxComputeUnits, NULL);
test_error( err, "Unable to get maximal number of compute units" );
@@ -449,14 +450,21 @@ int test_partition_of_device(cl_device_id deviceID, cl_context context, cl_comma
#define PROPERTY_TYPES 8
cl_device_partition_property partitionProp[PROPERTY_TYPES][5] = {
{ CL_DEVICE_PARTITION_EQUALLY, maxComputeUnits / 2, 0, 0, 0 } ,
{ CL_DEVICE_PARTITION_BY_COUNTS, 1, maxComputeUnits - 1, CL_DEVICE_PARTITION_BY_COUNTS_LIST_END, 0 } ,
{ CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_NUMA, 0, 0, 0 } ,
{ CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE, 0, 0, 0 } ,
{ CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE, 0, 0, 0 } ,
{ CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE, 0, 0, 0 } ,
{ CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE, 0, 0, 0 } ,
{ CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE, 0, 0, 0 }
{ CL_DEVICE_PARTITION_EQUALLY, (cl_int)maxComputeUnits / 2, 0, 0, 0 },
{ CL_DEVICE_PARTITION_BY_COUNTS, 1, (cl_int)maxComputeUnits - 1,
CL_DEVICE_PARTITION_BY_COUNTS_LIST_END, 0 },
{ CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN,
CL_DEVICE_AFFINITY_DOMAIN_NUMA, 0, 0, 0 },
{ CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN,
CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE, 0, 0, 0 },
{ CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN,
CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE, 0, 0, 0 },
{ CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN,
CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE, 0, 0, 0 },
{ CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN,
CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE, 0, 0, 0 },
{ CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN,
CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE, 0, 0, 0 }
};
// loop thru each type, creating sub-devices for each type

View File

@@ -175,7 +175,7 @@ struct CommandBufferPrintfTest : public BasicCommandBufferTest
nullptr, &error);
test_error(error, "clCreateBuffer failed");
cl_int offset[] = { 0, max_pattern_length };
cl_uint offset[] = { 0, max_pattern_length };
off_mem =
clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
sizeof(offset), offset, &error);
@@ -274,7 +274,9 @@ struct CommandBufferPrintfTest : public BasicCommandBufferTest
&pattern[0], 0, nullptr, nullptr);
test_error(error, "clEnqueueWriteBuffer failed");
cl_int offset[] = { 0, pattern.size() - 1 };
test_assert_error(pattern.size() - 1 <= CL_UINT_MAX,
"pattern.size() - 1 does not fit in a cl_uint");
cl_uint offset[] = { 0, static_cast<cl_uint>(pattern.size() - 1) };
error = clEnqueueWriteBuffer(queue, off_mem, CL_TRUE, 0, sizeof(offset),
offset, 0, nullptr, nullptr);
test_error(error, "clEnqueueWriteBuffer failed");

View File

@@ -115,7 +115,7 @@ struct CreateCommandBufferRepeatedProperties : public BasicCommandBufferTest
TEST_FAIL);
cl_command_buffer_properties_khr invalid_properties[3] = {
CL_COMMAND_BUFFER_FLAGS_KHR, CL_INVALID_PROPERTY, 0
CL_COMMAND_BUFFER_FLAGS_KHR, (cl_command_buffer_properties_khr)-1, 0
};
command_buffer =

View File

@@ -165,7 +165,8 @@ struct CreateInvalidMultiDeviceProperty : public SemaphoreTestBase
test_error(err, "Unable to get maximal number of compute units");
cl_device_partition_property partitionProp[] = {
CL_DEVICE_PARTITION_EQUALLY, maxComputeUnits / 2, 0
CL_DEVICE_PARTITION_EQUALLY,
static_cast<cl_device_partition_property>(maxComputeUnits / 2), 0
};
cl_uint deviceCount = 0;
@@ -238,7 +239,8 @@ struct CreateInvalidDevice : public SemaphoreTestBase
test_error(err, "Unable to get maximal number of compute units");
cl_device_partition_property partitionProp[] = {
CL_DEVICE_PARTITION_EQUALLY, maxComputeUnits / 2, 0
CL_DEVICE_PARTITION_EQUALLY,
static_cast<cl_device_partition_property>(maxComputeUnits / 2), 0
};
cl_uint deviceCount = 0;

View File

@@ -1,5 +1,9 @@
set(MODULE_NAME INTEGER_OPS)
if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang")
add_cxx_flag_if_supported(-Wno-narrowing)
endif()
set(${MODULE_NAME}_SOURCES
main.cpp
test_int_basic_ops.cpp

View File

@@ -1,5 +1,9 @@
set(MODULE_NAME NON_UNIFORM_WORK_GROUP)
if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang")
add_cxx_flag_if_supported(-Wno-narrowing)
endif()
set(${MODULE_NAME}_SOURCES
main.cpp
test_advanced_2d.cpp

View File

@@ -314,7 +314,7 @@ static int kernelFilter( cl_device_id device, cl_context context, cl_command_que
// read output image
size_t origin[3] = { 0, 0, 0 };
size_t region[3] = { w, h, 1 };
size_t region[3] = { (size_t)w, (size_t)h, 1 };
err = clEnqueueReadImage( queue, memobjs[1], true, origin, region, 0, 0, outptr, 0, NULL, NULL);
if( err != CL_SUCCESS ){
print_error( err, "clReadImage failed\n" );

View File

@@ -233,7 +233,7 @@ int read_image( cl_device_id device, cl_context context, cl_command_queue queue,
}
size_t origin[3] = { 0, 0, 0 };
size_t region[3] = { w, h, 1 };
size_t region[3] = { (size_t)w, (size_t)h, 1 };
err = clEnqueueReadImage( queue, memobjs[0], false, origin, region, 0, 0, dst, 0, NULL, &readEvent );
if( err != CL_SUCCESS ){
print_error( err, "clReadImage2D failed" );

View File

@@ -472,7 +472,7 @@ int write_image( cl_device_id device, cl_context context, cl_command_queue queue
}
size_t origin[3] = { 0, 0, 0 };
size_t region[3] = { w, h, 1 };
size_t region[3] = { (size_t)w, (size_t)h, 1 };
err = clEnqueueWriteImage( queue, memobjs[0], false, origin, region, 0, 0, inptr, 0, NULL, &writeEvent );
if( err != CL_SUCCESS ){
clReleaseMemObject(memobjs[0]);

View File

@@ -155,7 +155,8 @@ static void get_spir_version(cl_device_id device,
{
auto major = v[v.find('.') - 1];
auto minor = v[v.find('.') + 1];
versions.push_back(Version{ major - '0', minor - '0' });
versions.push_back(
Version{ (cl_uint)(major - '0'), (cl_uint)(minor - '0') });
}
}

View File

@@ -34,6 +34,10 @@ set(TEST_HARNESS_SOURCES
../../test_conformance/math_brute_force/utility.cpp
)
if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang")
add_cxx_flag_if_supported(-Wno-narrowing)
endif()
set(${MODULE_NAME}_SOURCES ${SPIRV_NEW_SOURCES} ${TEST_HARNESS_SOURCES})
include(../CMakeCommon.txt)

View File

@@ -68,7 +68,7 @@ TEST_SPIRV_FUNC(op_composite_construct_struct)
typedef AbstractStruct2<int, char> CustomType1;
typedef AbstractStruct2<cl_int2, CustomType1> CustomType2;
CustomType1 value1 = {2100483600, 128};
CustomType1 value1 = { 2100483600, (char)128 };
cl_int2 intvals = { { 2100480000, 2100480000 } };
CustomType2 value2 = {intvals, value1};

View File

@@ -122,7 +122,7 @@ TEST_SPIRV_FUNC(op_constant_struct_int_float_simple)
TEST_SPIRV_FUNC(op_constant_struct_int_char_simple)
{
AbstractStruct2<int, char> value = {2100483600, 128};
AbstractStruct2<int, char> value = { 2100483600, (char)128 };
std::vector<AbstractStruct2<int, char> > results(256, value);
return test_constant(deviceID, context, queue, "constant_struct_int_char_simple", results);
}
@@ -132,7 +132,7 @@ TEST_SPIRV_FUNC(op_constant_struct_struct_simple)
typedef AbstractStruct2<int, char> CustomType1;
typedef AbstractStruct2<cl_int2, CustomType1> CustomType2;
CustomType1 value1 = {2100483600, 128};
CustomType1 value1 = { 2100483600, (char)128 };
cl_int2 intvals = { { 2100480000, 2100480000 } };
CustomType2 value2 = {intvals, value1};

View File

@@ -118,7 +118,7 @@ TEST_SPIRV_FUNC(op_copy_struct_int_float_simple)
TEST_SPIRV_FUNC(op_copy_struct_int_char_simple)
{
AbstractStruct2<int, char> value = {2100483600, 128};
AbstractStruct2<int, char> value = { 2100483600, (char)128 };
std::vector<AbstractStruct2<int, char> > results(256, value);
return test_copy(deviceID, context, queue, "copy_struct_int_char_simple", results);
}
@@ -128,7 +128,7 @@ TEST_SPIRV_FUNC(op_copy_struct_struct_simple)
typedef AbstractStruct2<int, char> CustomType1;
typedef AbstractStruct2<cl_int2, CustomType1> CustomType2;
CustomType1 value1 = {2100483600, 128};
CustomType1 value1 = { 2100483600, (char)128 };
cl_int2 intvals = { { 2100480000, 2100480000 } };
CustomType2 value2 = {intvals, value1};