Call `getAllowedUlpError` to obtain the allowed ULP error for all of the
double type (fp64) tests. The aim is to standardise obtaining the
desired ULP requirement and pave the way for adding the Embedded Profile
ULP errors.
Contributes to https://github.com/KhronosGroup/OpenCL-CTS/issues/867
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
`LogBuildError` was only ever called after `clSetKernelArg`, but setting
a kernel argument has no impact on the program build log. Printing of
the actual build log in case of a build failure is already handled via
`create_single_kernel_helper`.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
The math_brute_force test has a link-check-only mode to quickly test if
all math functions are present.
In link-check-only mode, most tests return immediately after kernel
compilation, but some tests also run the kernel and read back the result
data before returning. Running the kernels takes a lot more time,
defeating the purpose of the `-l` mode.
Break out at the start of the main `for` loops in link-check-only mode
instead of returning directly, so that each test can still log its
trailing message (in most cases just a `\n`).
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Replace occurrences of `BuildKernelInfo2` with `BuildKernelInfo`.
This aligns the kernel creation code of the non-threaded tests to
the kernel creation code of the threaded tests.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Simplify code by returning directly instead of using goto statements.
Although intended as an NFC commit, this changes the behaviour around
clFlush calls. Before this commit, failure of the third clFlush call
would print "clFlush 3 failed" and return the clFlush error code.
This behaviour is inconsistent with the other clFlush calls in
math_brute_force, which are not fatal. The lack of a `goto exit`
makes me suspect that this 3rd clFlush call was intended to be
non-fatal too. As such, this commit makes all clFlush calls non-fatal
by returning `CL_SUCCESS` even when the third clFlush call fails.
Original patch by Marco Antognini.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* grab latest from upstream OpenCL
* Use clEnqueueFillBuffer rather than memset4 in all test files
* Cleanup leftover code from memset_pattern4
* Remove unnecessary map, unmap, writeBuffer from math_brute_force tests
* Remove extraneous build system change
* Appease clang-format
* Add option to perform buffer fills on the host
Co-authored-by: Taeten Prettyman <taeten.j@gmail.com>
Co-authored-by: taetenp <taet@holochip.com>
Co-authored-by: Chip Davis <chip@holochip.com>
Simplify code by relying on RAII to free resources.
This commit only affects tests that use `BuildKernelInfo2`, which are
the single-threaded tests.
Original patch by Marco Antognini.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Use a common function to create the kernel source code for testing
3-argument math builtins. This reduces code duplication. 1-argument
and 2-argument math kernel construction will be factored out in future
work.
Change the kernels to use preprocessor defines for argument types and
undef values, to make the CTS code easier to read.
Co-authored-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Co-authored-by: Marco Antognini <marco.antognini@arm.com>
* math_brute_force: Fix -Wformat warnings
The main sources of warnings were:
* Printing of 64-bit types, which is now done using the `PRI*64`
macros from <cinttypes> to ensure portability across 32 and 64-bit
builds.
* Printing of `size_t` types that lacked a `z` length modifier.
* Printing of values with a `z` length modifier that weren't a
`size_t` type.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* [NFC] math_brute_force: clang-format after -Wformat changes
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Remove the `offset` field from both structures, because it was always
set to the global `gMinVectorSizeIndex`.
Improve documentation and rename some variables:
- `i` becomes `vectorSize`;
- `kernel_count` becomes `threadCount`.
Original patch by Marco Antognini.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Move the main `BuildKernelInfo` definition into `common.h` to reduce
code duplication.
Some tests (e.g. `i_unary_double.cpp`) use a different struct; rename
those structs to `BuildKernelInfo2` for now to avoid ambiguity.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Simplify code by avoiding manual resource management.
This allows removing clReleaseProgram from `MakeKernels` to reduce
behavioral differences between `MakeKernels` and `MakeKernel`.
Original patch by Marco Antognini.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* Fix math tests to allow ftz in relaxed mode.
In recent spec clarification, it is agreed that ftz is
a valid optimization in case of cl-fast-math-relaxed
and doesn't require cl-denorms-are-zero to be passed
explicitly to enforce ftz behavior for implementations
that already support this.
GitHub Spec Issue OpenCL-Docs#579
GitHub Spec Issue OpenCL-Docs#597
GitHub CTS Issue OpenCL-CTS#1267
A program having a type (such as ThreadInfo) defined differently in
multiple translation units exhibits undefined behaviour.
This commit fixes such issues in the math_brute_force component by
ensuring most types are local to their translation unit with the help of
anonymous namespaces. Later refactoring will be able to extract common
definitions to a single place.
This patch also removes unnecessary static and typedef keywords.
Otherwise, code is only moved around with no change.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Make variables local to loops, with appropriate types. These variables
are not read after the loop without being reset first, so this patch
doesn't change behaviour.
These variables should now be used for one purpose only, making it
easier to reason about the code. This will make future refactoring
easier.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
gWimpyBufferSize is never modified and is actually not used to modify
the number of tests -- gWimpyReductionFactor is used for that purpose by
some tests, but not all.
This patch removes this unnecessary global variable to simplify the
codebase, and reduce differences between tests.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
* Remove code for runtime measurement
The GetTime() and associated functions are not fully implemented on
Linux. This functionality is assumed to be untested, or unused at best.
Reduce differences between tests by removing this unnecessary feature.
It can be (re-)implemented later, if desired, once the math_brute_force
component is in better shape.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
* Coalesce if-statements
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
* Keep else branch
Address comments.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Improve format.
The binary_operator tests are left untouched by this commit as they
require some non-automatic changes.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
* Split math_brute_force files
Split each file into two: one covering float and the other covering
double. The goal is to make it possible to diff files to identify bugs
more easily, reduce differences between code for float and double, and
ultimately reduce code duplication in all math_brute_force.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
* Address clang-format issues
In be936303 (Remove dead code in math_brute_force (#1117), 2021-01-20)
the code was reformatted using git-clang-format, which apparently is less
reliable than clang-format itself when changes occur in large files.
With the previous split of large files, git-clang-format complains about
the format of code originating from binary_two_results_i.cpp.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>