mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-21 14:59:02 +00:00
* Enable fp16 in math bruteforce * Added modernization of remaining half tests for consistency (issue #142, bruteforce) * Added kernel types related corrections * Added more fixes and general cleanup * Corrected ULP values for half tests (issue #142, bruteforce) * Corrected presubmit check for clang format * Added support for ternary, unary_two_result and unary_two_result_i tests for cl_half (issue #142, bruteforce) * Added missing condition due to vendor's review * code format correction * Added check for lack of support for denormals in binary_half scenario * Corrected procedure to compute nextafter cl_half for flush-to-zero mode * Added correction for external check of reference value for nextafter test * Added correction due to code review request * Changed quantity of tests performed for half in unary and macro_unary procedures from basic * Added corrections related to code review: -added binary_operator_half.cpp and binary_two_results_i_half.cpp -address sanitizer errors fixed -extending list of special half values -removed unnecessary relaxed math references in half tests -corrected conditions to verify ulp narrowing of computation results -several refactoring and cosmetics corrections * Print format correction due to failed CI check * Corrected bug found in code review (fp16 bruteforce) * Corrections related to code review (cl_khr_fp16 support according to #142) -gHostFill missing support added -special half values array extended -cosmetics and unifying * clang format applied * consistency correction * more consistency corrections for cl_fp16_khr supported tests * Corrections related to code review (bureforce #142) * Correction for i_unary_half test capacity * Corrections related to capacity of cl_khr_fp16 tests in bruteforce (#142) --------- Co-authored-by: Wawiorko, Grzegorz <grzegorz.wawiorko@intel.com>
99 lines
3.4 KiB
C++
99 lines
3.4 KiB
C++
//
|
|
// Copyright (c) 2021 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 COMMON_H
|
|
#define COMMON_H
|
|
|
|
#include "harness/typeWrappers.h"
|
|
#include "utility.h"
|
|
|
|
#include <array>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
// Array of thread-specific kernels for each vector size.
|
|
using KernelMatrix =
|
|
std::array<std::vector<clKernelWrapper>, VECTOR_SIZE_COUNT>;
|
|
|
|
// Array of programs for each vector size.
|
|
using Programs = std::array<clProgramWrapper, VECTOR_SIZE_COUNT>;
|
|
|
|
// Array of buffers for each vector size.
|
|
using Buffers = std::array<clMemWrapper, VECTOR_SIZE_COUNT>;
|
|
|
|
// Types supported for kernel code generation.
|
|
enum class ParameterType
|
|
{
|
|
Half,
|
|
Float,
|
|
Double,
|
|
Short,
|
|
UShort,
|
|
Int,
|
|
UInt,
|
|
Long,
|
|
ULong,
|
|
};
|
|
|
|
// Return kernel name suffixed with vector size.
|
|
std::string GetKernelName(int vector_size_index);
|
|
|
|
// Generate kernel code for the given builtin function/operator.
|
|
std::string GetUnaryKernel(const std::string &kernel_name, const char *builtin,
|
|
ParameterType retType, ParameterType type1,
|
|
int vector_size_index);
|
|
std::string GetUnaryKernel(const std::string &kernel_name, const char *builtin,
|
|
ParameterType retType1, ParameterType retType2,
|
|
ParameterType type1, int vector_size_index);
|
|
std::string GetBinaryKernel(const std::string &kernel_name, const char *builtin,
|
|
ParameterType retType, ParameterType type1,
|
|
ParameterType type2, int vector_size_index);
|
|
std::string GetBinaryKernel(const std::string &kernel_name, const char *builtin,
|
|
ParameterType retType1, ParameterType retType2,
|
|
ParameterType type1, ParameterType type2,
|
|
int vector_size_index);
|
|
std::string GetTernaryKernel(const std::string &kernel_name,
|
|
const char *builtin, ParameterType retType,
|
|
ParameterType type1, ParameterType type2,
|
|
ParameterType type3, int vector_size_index);
|
|
|
|
// Information to generate OpenCL kernels.
|
|
struct BuildKernelInfo
|
|
{
|
|
// Number of kernels to build, one for each thread to avoid data races.
|
|
cl_uint threadCount;
|
|
|
|
KernelMatrix &kernels;
|
|
|
|
Programs &programs;
|
|
|
|
// Function, macro or symbol tested by the kernel.
|
|
const char *nameInCode;
|
|
|
|
// Whether to build with -cl-fast-relaxed-math.
|
|
bool relaxedMode;
|
|
};
|
|
|
|
using SourceGenerator = std::string (*)(const std::string &kernel_name,
|
|
const char *builtin,
|
|
cl_uint vector_size_index);
|
|
|
|
/// Build kernels for all threads in "info" for the given job_id.
|
|
cl_int BuildKernels(BuildKernelInfo &info, cl_uint job_id,
|
|
SourceGenerator generator);
|
|
|
|
|
|
#endif /* COMMON_H */
|