Skip to content

Commit

Permalink
Merge branch 'main' into semaphore_device_handle_list_complement
Browse files Browse the repository at this point in the history
test_conformance/extensions/cl_khr_semaphore/test_semaphores.cpp
  • Loading branch information
shajder committed Sep 4, 2024
2 parents 222fd8e + 9116bb7 commit b8d6253
Show file tree
Hide file tree
Showing 20 changed files with 304 additions and 276 deletions.
7 changes: 5 additions & 2 deletions test_conformance/api/test_api_consistency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include <cinttypes>

#include "testBase.h"
#include "harness/testHarness.h"
#include "harness/deviceInfo.h"
Expand Down Expand Up @@ -158,8 +160,9 @@ static int check_atomic_capabilities(cl_device_atomic_capabilities atomicCaps,
{
if ((atomicCaps & requiredCaps) != requiredCaps)
{
log_error("Atomic capabilities %llx is missing support for at least "
"one required capability %llx!\n",
log_error("Atomic capabilities %" PRIx64
" is missing support for at least "
"one required capability %" PRIx64 "!\n",
atomicCaps, requiredCaps);
return TEST_FAIL;
}
Expand Down
107 changes: 57 additions & 50 deletions test_conformance/api/test_api_min_max.cpp

Large diffs are not rendered by default.

49 changes: 29 additions & 20 deletions test_conformance/api/test_mem_object_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@
#include "harness/testHarness.h"


#define TEST_MEM_OBJECT_PARAM( mem, paramName, val, expected, name, type, cast ) \
error = clGetMemObjectInfo( mem, paramName, sizeof( val ), &val, &size ); \
test_error( error, "Unable to get mem object " name ); \
if( val != expected ) \
{ \
log_error( "ERROR: Mem object " name " did not validate! (expected " type ", got " type " from %s:%d)\n", \
expected, (cast)val, __FILE__, __LINE__ ); \
return -1; \
} \
if( size != sizeof( val ) ) \
{ \
log_error( "ERROR: Returned size of mem object " name " does not validate! (expected %d, got %d from %s:%d)\n", \
(int)sizeof( val ), (int)size , __FILE__, __LINE__ ); \
return -1; \
}
#define TEST_MEM_OBJECT_PARAM(mem, paramName, val, expected, name, type, cast) \
error = clGetMemObjectInfo(mem, paramName, sizeof(val), &val, &size); \
test_error(error, "Unable to get mem object " name); \
if (val != expected) \
{ \
log_error("ERROR: Mem object " name \
" did not validate! (expected " type ", got " type \
" from %s:%d)\n", \
(cast)expected, (cast)val, __FILE__, __LINE__); \
return -1; \
} \
if (size != sizeof(val)) \
{ \
log_error("ERROR: Returned size of mem object " name \
" does not validate! (expected %d, got %d from %s:%d)\n", \
(int)sizeof(val), (int)size, __FILE__, __LINE__); \
return -1; \
}

static void CL_CALLBACK mem_obj_destructor_callback( cl_mem, void * data )
{
Expand Down Expand Up @@ -236,7 +239,8 @@ int test_get_buffer_info( cl_device_id deviceID, cl_context context, cl_command_
TEST_MEM_OBJECT_PARAM( bufferObject, CL_MEM_FLAGS, flags, (unsigned int)bufferFlags[ i ], "flags", "%d", unsigned int )

size_t sz;
TEST_MEM_OBJECT_PARAM( bufferObject, CL_MEM_SIZE, sz, (size_t)( addressAlign * 4 ), "size", "%ld", size_t )
TEST_MEM_OBJECT_PARAM(bufferObject, CL_MEM_SIZE, sz,
(size_t)(addressAlign * 4), "size", "%zu", size_t)

cl_uint mapCount;
error = clGetMemObjectInfo( bufferObject, CL_MEM_MAP_COUNT, sizeof( mapCount ), &mapCount, &size );
Expand Down Expand Up @@ -265,7 +269,8 @@ int test_get_buffer_info( cl_device_id deviceID, cl_context context, cl_command_
TEST_MEM_OBJECT_PARAM( bufferObject, CL_MEM_ASSOCIATED_MEMOBJECT, origObj, (void *)NULL, "associated mem object", "%p", void * )

size_t offset;
TEST_MEM_OBJECT_PARAM( bufferObject, CL_MEM_OFFSET, offset, 0L, "offset", "%ld", size_t )
TEST_MEM_OBJECT_PARAM(bufferObject, CL_MEM_OFFSET, offset, size_t(0),
"offset", "%zu", size_t)

cl_buffer_region region;
region.origin = addressAlign;
Expand Down Expand Up @@ -321,7 +326,8 @@ int test_get_buffer_info( cl_device_id deviceID, cl_context context, cl_command_
}
TEST_MEM_OBJECT_PARAM( subBufferObject, CL_MEM_FLAGS, flags, (unsigned int)inheritedFlags, "flags", "%d", unsigned int )

TEST_MEM_OBJECT_PARAM( subBufferObject, CL_MEM_SIZE, sz, (size_t)( addressAlign ), "size", "%ld", size_t )
TEST_MEM_OBJECT_PARAM(subBufferObject, CL_MEM_SIZE, sz,
(size_t)(addressAlign), "size", "%zu", size_t)

if ( bufferFlags[ i ] & CL_MEM_USE_HOST_PTR )
{
Expand Down Expand Up @@ -356,7 +362,9 @@ int test_get_buffer_info( cl_device_id deviceID, cl_context context, cl_command_

TEST_MEM_OBJECT_PARAM( subBufferObject, CL_MEM_ASSOCIATED_MEMOBJECT, origObj, (cl_mem)bufferObject, "associated mem object", "%p", void * )

TEST_MEM_OBJECT_PARAM( subBufferObject, CL_MEM_OFFSET, offset, (size_t)( addressAlign ), "offset", "%ld", size_t )
TEST_MEM_OBJECT_PARAM(subBufferObject, CL_MEM_OFFSET, offset,
(size_t)(addressAlign), "offset", "%zu",
size_t)
}
}

Expand Down Expand Up @@ -405,7 +413,8 @@ int test_get_imageObject_info( cl_mem * image, cl_mem_flags objectFlags, cl_imag

TEST_MEM_OBJECT_PARAM( *image, CL_MEM_CONTEXT, otherCtx, context, "context", "%p", cl_context )

TEST_MEM_OBJECT_PARAM( *image, CL_MEM_OFFSET, offset, 0L, "offset", "%ld", size_t )
TEST_MEM_OBJECT_PARAM(*image, CL_MEM_OFFSET, offset, size_t(0), "offset",
"%zu", size_t)

return CL_SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static int create_object_and_check_properties(cl_context context,
}
if (set_size != test_case.properties.size() * sizeof(cl_mem_properties))
{
log_error("ERROR: CL_MEM_PROPERTIES size is %d, expected %d.\n",
log_error("ERROR: CL_MEM_PROPERTIES size is %zu, expected %zu.\n",
set_size,
test_case.properties.size() * sizeof(cl_queue_properties));
return TEST_FAIL;
Expand Down
2 changes: 1 addition & 1 deletion test_conformance/api/test_pipe_properties_queries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static int create_pipe_and_check_array_properties(
}
if (set_size != test_case.properties.size() * sizeof(cl_pipe_properties))
{
log_error("ERROR: CL_PIPE_PROPERTIES size is %d, expected %d.\n",
log_error("ERROR: CL_PIPE_PROPERTIES size is %zu, expected %zu.\n",
set_size,
test_case.properties.size() * sizeof(cl_pipe_properties));
return TEST_FAIL;
Expand Down
36 changes: 23 additions & 13 deletions test_conformance/api/test_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,44 +189,54 @@ int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_
test_error(err, "clGetPlatformInfo for CL_PLATFORM_PROFILE failed");
log_info("\tCL_PLATFORM_PROFILE: %s\n", string_returned);
if (strlen(string_returned)+1 != size) {
log_error("Returned string length %ld does not equal reported one %ld.\n", strlen(string_returned)+1, size);
total_errors++;
log_error(
"Returned string length %zu does not equal reported one %zu.\n",
strlen(string_returned) + 1, size);
total_errors++;
}

memset(string_returned, 0, 8192);
err = clGetPlatformInfo(platforms[p], CL_PLATFORM_VERSION, 8192, string_returned, &size);
test_error(err, "clGetPlatformInfo for CL_PLATFORM_VERSION failed");
log_info("\tCL_PLATFORM_VERSION: %s\n", string_returned);
if (strlen(string_returned)+1 != size) {
log_error("Returned string length %ld does not equal reported one %ld.\n", strlen(string_returned)+1, size);
total_errors++;
log_error(
"Returned string length %zu does not equal reported one %zu.\n",
strlen(string_returned) + 1, size);
total_errors++;
}

memset(string_returned, 0, 8192);
err = clGetPlatformInfo(platforms[p], CL_PLATFORM_NAME, 8192, string_returned, &size);
test_error(err, "clGetPlatformInfo for CL_PLATFORM_NAME failed");
log_info("\tCL_PLATFORM_NAME: %s\n", string_returned);
if (strlen(string_returned)+1 != size) {
log_error("Returned string length %ld does not equal reported one %ld.\n", strlen(string_returned)+1, size);
total_errors++;
log_error(
"Returned string length %zu does not equal reported one %zu.\n",
strlen(string_returned) + 1, size);
total_errors++;
}

memset(string_returned, 0, 8192);
err = clGetPlatformInfo(platforms[p], CL_PLATFORM_VENDOR, 8192, string_returned, &size);
test_error(err, "clGetPlatformInfo for CL_PLATFORM_VENDOR failed");
log_info("\tCL_PLATFORM_VENDOR: %s\n", string_returned);
if (strlen(string_returned)+1 != size) {
log_error("Returned string length %ld does not equal reported one %ld.\n", strlen(string_returned)+1, size);
total_errors++;
log_error(
"Returned string length %zu does not equal reported one %zu.\n",
strlen(string_returned) + 1, size);
total_errors++;
}

memset(string_returned, 0, 8192);
err = clGetPlatformInfo(platforms[p], CL_PLATFORM_EXTENSIONS, 8192, string_returned, &size);
test_error(err, "clGetPlatformInfo for CL_PLATFORM_EXTENSIONS failed");
log_info("\tCL_PLATFORM_EXTENSIONS: %s\n", string_returned);
if (strlen(string_returned)+1 != size) {
log_error("Returned string length %ld does not equal reported one %ld.\n", strlen(string_returned)+1, size);
total_errors++;
log_error(
"Returned string length %zu does not equal reported one %zu.\n",
strlen(string_returned) + 1, size);
total_errors++;
}

err = clGetDeviceIDs(platforms[p], CL_DEVICE_TYPE_ALL, 0, NULL, &num_devices);
Expand Down Expand Up @@ -258,8 +268,8 @@ int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_
test_error(err, "clGetDeviceInfo failed for CL_DEVICE_PLATFORM\n");
if (returned_size != sizeof(cl_platform_id))
{
log_error("Reported return size (%ld) does not match expected size "
"(%ld).\n",
log_error("Reported return size (%zu) does not match expected size "
"(%zu).\n",
returned_size, sizeof(cl_platform_id));
total_errors++;
}
Expand Down Expand Up @@ -288,7 +298,7 @@ int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_
if (returned_size != sizeof(cl_context_properties) * 3)
{
log_error("Invalid size returned from clGetContextInfo for "
"CL_CONTEXT_PROPERTIES. Got %ld, expected %ld.\n",
"CL_CONTEXT_PROPERTIES. Got %zu, expected %zu.\n",
returned_size, sizeof(cl_context_properties) * 3);
total_errors++;
}
Expand Down
10 changes: 6 additions & 4 deletions test_conformance/api/test_queries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <algorithm>
#include <cinttypes>
#include <vector>

int test_get_platform_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
Expand Down Expand Up @@ -237,7 +238,7 @@ int test_sampler_params(cl_device_id deviceID, cl_context context,
if (set_size != 0)
{
log_error(
"ERROR: CL_SAMPLER_PROPERTIES size is %d, expected 0\n",
"ERROR: CL_SAMPLER_PROPERTIES size is %zu, expected 0\n",
set_size);
return TEST_FAIL;
}
Expand All @@ -248,7 +249,7 @@ int test_sampler_params(cl_device_id deviceID, cl_context context,
!= test_properties.size() * sizeof(cl_sampler_properties))
{
log_error(
"ERROR: CL_SAMPLER_PROPERTIES size is %d, expected %d.\n",
"ERROR: CL_SAMPLER_PROPERTIES size is %zu, expected %zu.\n",
set_size,
test_properties.size() * sizeof(cl_sampler_properties));
return TEST_FAIL;
Expand Down Expand Up @@ -380,7 +381,8 @@ int check_get_command_queue_info_params(cl_device_id deviceID,
clGetDeviceInfo(deviceID, host_queue_query, sizeof(host_queue_props),
&host_queue_props, NULL);
test_error(error, "clGetDeviceInfo failed");
log_info("CL_DEVICE_QUEUE_ON_HOST_PROPERTIES is %d\n", host_queue_props);
log_info("CL_DEVICE_QUEUE_ON_HOST_PROPERTIES is %" PRIu64 "\n",
host_queue_props);

cl_queue_properties device_queue_props = 0;
if (version >= Version(2, 0))
Expand All @@ -389,7 +391,7 @@ int check_get_command_queue_info_params(cl_device_id deviceID,
sizeof(device_queue_props), &device_queue_props,
NULL);
test_error(error, "clGetDeviceInfo failed");
log_info("CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES is %d\n",
log_info("CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES is %" PRIu64 "\n",
device_queue_props);
}

Expand Down
7 changes: 4 additions & 3 deletions test_conformance/api/test_queue_properties_queries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ static int create_queue_and_check_array_properties(
}
if (set_size != test_case.properties.size() * sizeof(cl_queue_properties))
{
log_error("ERROR: CL_QUEUE_PROPERTIES_ARRAY size is %d, expected %d.\n",
set_size,
test_case.properties.size() * sizeof(cl_queue_properties));
log_error(
"ERROR: CL_QUEUE_PROPERTIES_ARRAY size is %zu, expected %zu.\n",
set_size,
test_case.properties.size() * sizeof(cl_queue_properties));
return TEST_FAIL;
}

Expand Down
Loading

0 comments on commit b8d6253

Please sign in to comment.