From 657456f7dfdffec2ae6f9f5c9f821adce3c45053 Mon Sep 17 00:00:00 2001 From: Chetan Mistry <70694498+chemis01@users.noreply.github.com> Date: Mon, 9 Nov 2020 11:07:59 +0000 Subject: [PATCH] Implement test for CL_KERNEL_PRIVATE_MEM_SIZE (#459) (#1013) Implement a test to ensure that the CL_KERNEL_PRIVATE_MEM_SIZE flag for clGetKernelWorkGroupInfo passes. Change-Id: Ibd6d64d185c00ddbd23467692717c534498bb901 Signed-off-by: Chetankumar Mistry --- .../api/test_kernel_private_memory_size.cpp | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 test_conformance/api/test_kernel_private_memory_size.cpp diff --git a/test_conformance/api/test_kernel_private_memory_size.cpp b/test_conformance/api/test_kernel_private_memory_size.cpp new file mode 100644 index 00000000..e0652714 --- /dev/null +++ b/test_conformance/api/test_kernel_private_memory_size.cpp @@ -0,0 +1,42 @@ +// +// Copyright (c) 2020 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 "harness/errorHelpers.h" +#include "harness/typeWrappers.h" +#include +#include "procs.h" + +int test_kernel_private_memory_size(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements) +{ + const char* TEST_KERNEL = + R"(__kernel void private_memory( __global ulong *buffer ){ + volatile __private ulong x[1]; + buffer[0] = x[0]; + })"; + + clProgramWrapper program; + clKernelWrapper kernel; + cl_int err = create_single_kernel_helper(context, &program, &kernel, 1, + &kernels[i], "private_memory"); + test_error(err, "create_single_kernel_helper"); + cl_ulong size = CL_ULONG_MAX; + err = clGetKernelWorkGroupInfo(kernel, deviceID, CL_KERNEL_PRIVATE_MEM_SIZE, + sizeof(cl_ulong), &size, nullptr); + + test_error(err, "clGetKernelWorkGroupInfo"); + + return TEST_PASS; +}