Skip to content

Commit

Permalink
Merge branch 'main' into negative_command_buffer_barrier
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-goras-mobica committed Apr 18, 2024
2 parents c43b118 + 7dc9593 commit 0909fda
Show file tree
Hide file tree
Showing 46 changed files with 2,327 additions and 263 deletions.
38 changes: 0 additions & 38 deletions test_common/autotest/autotest.hpp

This file was deleted.

63 changes: 0 additions & 63 deletions test_common/autotest/test_suite.hpp

This file was deleted.

15 changes: 14 additions & 1 deletion test_common/harness/imageHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,10 +769,14 @@ void get_max_sizes(

(*numberOfSizes) = 0;

if (image_type == CL_MEM_OBJECT_IMAGE1D)
if (image_type == CL_MEM_OBJECT_IMAGE1D
|| image_type == CL_MEM_OBJECT_IMAGE1D_BUFFER)
{

size_t M = maximum_sizes[0];
size_t A = max_pixels;

M = static_cast<size_t>(fmax(1, fmin(A / M, M)));

// Store the size
sizes[(*numberOfSizes)][0] = M;
Expand Down Expand Up @@ -860,6 +864,7 @@ void get_max_sizes(
{
switch (image_type)
{
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
log_info(" size[%d] = [%zu] (%g MB image)\n", j, sizes[j][0],
raw_pixel_size * sizes[j][0] * sizes[j][1]
Expand Down Expand Up @@ -1080,6 +1085,7 @@ cl_ulong get_image_size(image_descriptor const *imageInfo)
{
switch (imageInfo->type)
{
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D: imageSize = imageInfo->rowPitch; break;
case CL_MEM_OBJECT_IMAGE2D:
imageSize = imageInfo->height * imageInfo->rowPitch;
Expand Down Expand Up @@ -2317,6 +2323,7 @@ int debug_find_vector_in_image(void *imagePtr, image_descriptor *imageInfo,

switch (imageInfo->type)
{
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
width = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1;
height = 1;
Expand Down Expand Up @@ -3513,6 +3520,7 @@ void copy_image_data(image_descriptor *srcImageInfo,

switch (srcImageInfo->type)
{
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
src_lod = sourcePos[1];
sourcePos_lod[1] = sourcePos_lod[2] = 0;
Expand Down Expand Up @@ -3558,6 +3566,7 @@ void copy_image_data(image_descriptor *srcImageInfo,
size_t dst_height_lod = 1 /*dstImageInfo->height*/;
switch (dstImageInfo->type)
{
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
dst_lod = destPos[1];
destPos_lod[1] = destPos_lod[2] = 0;
Expand Down Expand Up @@ -4022,6 +4031,7 @@ cl_ulong compute_mipmapped_image_size(image_descriptor imageInfo)
retSize += (cl_ulong)curr_width * curr_height
* get_pixel_size(imageInfo.format);
break;
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
retSize +=
(cl_ulong)curr_width * get_pixel_size(imageInfo.format);
Expand All @@ -4043,6 +4053,7 @@ cl_ulong compute_mipmapped_image_size(image_descriptor imageInfo)
case CL_MEM_OBJECT_IMAGE2D:
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
curr_height = curr_height >> 1 ? curr_height >> 1 : 1;
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
curr_width = curr_width >> 1 ? curr_width >> 1 : 1;
Expand Down Expand Up @@ -4080,6 +4091,7 @@ size_t compute_mip_level_offset(image_descriptor *imageInfo, size_t lod)
retOffset +=
(size_t)width * height * get_pixel_size(imageInfo->format);
break;
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D:
retOffset += (size_t)width * get_pixel_size(imageInfo->format);
break;
Expand All @@ -4092,6 +4104,7 @@ size_t compute_mip_level_offset(image_descriptor *imageInfo, size_t lod)
case CL_MEM_OBJECT_IMAGE2D:
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
height = (height >> 1) ? (height >> 1) : 1;
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
case CL_MEM_OBJECT_IMAGE1D: width = (width >> 1) ? (width >> 1) : 1;
}
Expand Down
1 change: 1 addition & 0 deletions test_conformance/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ set(${MODULE_NAME}_SOURCES
test_mem_object_properties_queries.cpp
test_queue_properties_queries.cpp
test_pipe_properties_queries.cpp
test_wg_suggested_local_work_size.cpp
)

include(../CMakeCommon.txt)
4 changes: 4 additions & 0 deletions test_conformance/api/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ test_definition test_list[] = {
ADD_TEST(min_image_formats),
ADD_TEST(negative_get_platform_info),
ADD_TEST(negative_get_platform_ids),

ADD_TEST(work_group_suggested_local_size_1D),
ADD_TEST(work_group_suggested_local_size_2D),
ADD_TEST(work_group_suggested_local_size_3D),
};

const int test_num = ARRAY_SIZE(test_list);
Expand Down
15 changes: 14 additions & 1 deletion test_conformance/api/procs.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Copyright (c) 2017 The Khronos Group Inc.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down Expand Up @@ -204,3 +204,16 @@ extern int test_negative_get_platform_ids(cl_device_id deviceID,
int num_elements);
extern int test_kernel_attributes(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements);

extern int test_work_group_suggested_local_size_1D(cl_device_id device,
cl_context context,
cl_command_queue queue,
int n_elems);
extern int test_work_group_suggested_local_size_2D(cl_device_id device,
cl_context context,
cl_command_queue queue,
int n_elems);
extern int test_work_group_suggested_local_size_3D(cl_device_id device,
cl_context context,
cl_command_queue queue,
int n_elems);
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const char* wg_scan_local_work_group_size = R"(
global uint *output)
{
__local char c[LOCAL_MEM_SIZE];
if(!is_zero_linear_id()) return;
for (uint i = 0; i < 3; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ clExternalImportableSemaphore::~clExternalImportableSemaphore()
cl_int err = clReleaseSemaphoreKHRptr(m_externalSemaphore);
if (err != CL_SUCCESS)
{
throw std::runtime_error("clReleaseSemaphoreKHR failed!");
log_error("clReleaseSemaphoreKHR failed with %d\n", err);
}
}

Expand Down Expand Up @@ -935,7 +935,7 @@ clExternalExportableSemaphore::~clExternalExportableSemaphore()
cl_int err = clReleaseSemaphoreKHRptr(m_externalSemaphore);
if (err != CL_SUCCESS)
{
throw std::runtime_error("clReleaseSemaphoreKHR failed!");
log_error("clReleaseSemaphoreKHR failed with %d\n", err);
}
}

Expand Down Expand Up @@ -1052,4 +1052,4 @@ VulkanImageTiling vkClExternalMemoryHandleTilingAssumption(
}

return mode;
}
}
8 changes: 0 additions & 8 deletions test_conformance/conversions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ if("${CLConform_TARGET_ARCH}" STREQUAL "ARM" OR "${CLConform_TARGET_ARCH}" STREQ
list(APPEND ${MODULE_NAME}_SOURCES fplib.cpp)
endif()

if(NOT CMAKE_CL_64 AND NOT MSVC AND NOT ANDROID)
# -march is needed for CPU atomics, default arch on gcc is i386
# that does not support atomics.
set_source_files_properties(
${MODULE_NAME}_SOURCES
COMPILE_FLAGS -march=i686)
endif(NOT CMAKE_CL_64 AND NOT MSVC AND NOT ANDROID)

set_gnulike_module_compile_flags("-Wno-sign-compare")

include(../CMakeCommon.txt)
7 changes: 5 additions & 2 deletions test_conformance/device_execution/enqueue_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,9 @@ int test_enqueue_block(cl_device_id device, cl_context context, cl_command_queue
if (!gKernelName.empty() && gKernelName != sources_enqueue_block[i].kernel_name)
continue;

log_info("Running '%s' kernel (%d of %d) ...\n", sources_enqueue_block[i].kernel_name, i + 1, num_kernels_enqueue_block);
log_info("Running '%s' kernel (%d of %zu) ...\n",
sources_enqueue_block[i].kernel_name, i + 1,
num_kernels_enqueue_block);
err_ret = run_n_kernel_args(context, queue, sources_enqueue_block[i].lines, sources_enqueue_block[i].num_lines, sources_enqueue_block[i].kernel_name, local_size, global_size, kernel_results, sizeof(kernel_results), 0, NULL);
if(check_error(err_ret, "'%s' kernel execution failed", sources_enqueue_block[i].kernel_name)) { ++failCnt; res = -1; }
else if((n = check_kernel_results(kernel_results, arr_size(kernel_results))) >= 0 && check_error(-1, "'%s' kernel results validation failed: [%d] returned %d expected 0", sources_enqueue_block[i].kernel_name, n, kernel_results[n])) res = -1;
Expand All @@ -650,7 +652,8 @@ int test_enqueue_block(cl_device_id device, cl_context context, cl_command_queue

if (failCnt > 0)
{
log_error("ERROR: %d of %d kernels failed.\n", failCnt, num_kernels_enqueue_block);
log_error("ERROR: %zu of %zu kernels failed.\n", failCnt,
num_kernels_enqueue_block);
}

return res;
Expand Down
7 changes: 5 additions & 2 deletions test_conformance/device_execution/enqueue_flags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,9 @@ int test_enqueue_flags(cl_device_id device, cl_context context, cl_command_queue
if (!gKernelName.empty() && gKernelName != sources_enqueue_block_flags[i].kernel_name)
continue;

log_info("Running '%s' kernel (%d of %d) ...\n", sources_enqueue_block_flags[i].kernel_name, i + 1, num_enqueue_block_flags);
log_info("Running '%s' kernel (%d of %zu) ...\n",
sources_enqueue_block_flags[i].kernel_name, i + 1,
num_enqueue_block_flags);

clMemWrapper mem = clCreateBuffer(context, CL_MEM_READ_WRITE|CL_MEM_COPY_HOST_PTR, global_size * BITS_DEPTH * sizeof(cl_int), buff, &err_ret);
test_error(err_ret, "clCreateBuffer() failed");
Expand Down Expand Up @@ -749,7 +751,8 @@ int test_enqueue_flags(cl_device_id device, cl_context context, cl_command_queue

if (failCnt > 0)
{
log_error("ERROR: %d of %d kernels failed.\n", failCnt, num_enqueue_block_flags);
log_error("ERROR: %zu of %zu kernels failed.\n", failCnt,
num_enqueue_block_flags);
}

return res;
Expand Down
7 changes: 5 additions & 2 deletions test_conformance/device_execution/enqueue_ndrange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,9 @@ int test_enqueue_ndrange(cl_device_id device, cl_context context, cl_command_que
{ sizeof(cl_mem), &mem4 },
};

log_info("Running '%s' kernel (%d of %d) ...\n", sources_ndrange_Xd[i].src.kernel_name, i + 1, num_kernels_ndrange_Xd);
log_info("Running '%s' kernel (%d of %zu) ...\n",
sources_ndrange_Xd[i].src.kernel_name, i + 1,
num_kernels_ndrange_Xd);
err_ret = run_single_kernel_args(context, queue, sources_ndrange_Xd[i].src.lines, sources_ndrange_Xd[i].src.num_lines, sources_ndrange_Xd[i].src.kernel_name, kernel_results, sizeof(kernel_results), arr_size(args), args);

cl_int *ptr = (cl_int *)clEnqueueMapBuffer(queue, mem3, CL_TRUE, CL_MAP_READ, 0, glob_results.size() * sizeof(cl_int), 0, 0, 0, &err_ret);
Expand All @@ -718,7 +720,8 @@ int test_enqueue_ndrange(cl_device_id device, cl_context context, cl_command_que

if (failCnt > 0)
{
log_error("ERROR: %d of %d kernels failed.\n", failCnt, num_kernels_ndrange_Xd);
log_error("ERROR: %zu of %zu kernels failed.\n", failCnt,
num_kernels_ndrange_Xd);
}

return res;
Expand Down
Loading

0 comments on commit 0909fda

Please sign in to comment.