We noticed such issue
expected: ^(K{C, -30304.8, -22634.574219, 24476.882812, E4929EC2,
1467582223, 96vL.+
got: ^(K{C, -30304.8, -22634.574219, 24476.882813, E4929EC2, 1467582223,
96vL.+
The input value is 24476.882812 and cannot be precisely represented as a
single-floating point, so compilers are allowed to round it to the
nearest representable value. In this case, the closest representable
value to 24476.882812 is 24476.8828125, which rounds to 24476.882813.
Even some versions of MSVC prints that value as 24476.882813 and some
24476.882812 : https://godbolt.org/z/5GhEf8KPT
The proposal is to set precisely how many number should be displayed to
avoid rounding.
%a or %A with printf on MSVC platforms have a default precision of 13,
which is in contrast to OpenCL C specification for printf which only
allows for exact digits required if precision is not specified.
1. In vector test, prepare RTZ answer for RTZ rounding.
2. In mixed_format_random test, for a given float 'arg', the test
previously used 'arg' directly to generate ref_str:
```
ref_str << str_sprintf(format, arg);
```
This approach incorrectly assumes:
```
(float) arg == to_fp(to_str(arg));
```
However, this assumption fails under RTZ rounding. For example:
```
arg = 0xC642549C
to_str(arg) = -12437.152343f
to_fp_rtz(-12437.152343f) = 0xC642549B (-0X1.84A936P+13)
to_fp_rte(-12437.152343f) = 0xC642549C (-0X1.84A938P+13)
```
To address this, the reference result is now computed based on the
literal float string rather than the original 'arg' value.
This commit links to issue (#2234).
When cross-compiling for AArch64, using gcc 13.3, you encounter three
warnings types that turn into errors:
- maybe-uninitialized
- stringop-truncation
- strict-aliasing
This commit fixes all the warnings found, in regards to the first two
rules. To resolve the warnigns due to strict-aliasing, I am editing the
CMake build system.
Signed-off-by: Antonios Christidis <a-christidis@ti.com>
This will ensure consistent output on any conforming implementation.
Note that the specification does not define the output style when
precision is missing.
---------
Signed-off-by: Cui, Dele <dele.cui@intel.com>
Since GCC 13 some headers are no longer included transitively through
C++ Standard Library headers.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
According to work plan from issue #1058
Added new case `TYPE_MIXED_FORMAT_RANDOM` which focus on three factors:
-data before conversion flags - this is randomly generated ascii string
-randomly generated conversion flags - integer or floating point, for
each flag specific argument is generated
-data after conversion flags - this is randomly generated ascii string
Moreover, due to fact in case of `TYPE_MIXED_FORMAT_RANDOM` test is
generated on the fly, logging of negative result was extended.
We've had a couple of bugs inside mesa/rusticl processing %% correctly.
I've added those cases locally to make sure all corner cases are
properly handled.
According to work plan from issue #1058
Corrections to general test:
-removed duplication of separate tests for each element of
`PrintfTestType` vector, instead `doTest` procedure would iterate over
vector related to specific `PrintfTestType` automaticaly
-fixed procedure to assemble kernel source so it can accept only one
parameter of the function ( eg. `printf("%%");` )
-incorporated important modifications from #1940 to avoid expected
conflicts
-warnings fixes, minor corrections, clang format
Extension for string testing:
-special symbols
-nested symbols
-all ascii characters
-added new type of test `TYPE_FORMAT_STRING` to verify format string
only (according to request from the issue)
* Added cl_khr_fp16 support for test_relationals (issue #142, relationals)
* Added cl_khr_fp16 support for any and bitselect test cases (issue #142, relationals)
* correction related to automated travis build for macOS (issue #142, relationals)
* more corrections related to automated travis build for macOS (issue #142, relationals)
* Added few cosmetic corrections (issue #142, test_relationals)
* Added missing clang format
* Added corrections related to order of initialization
* Added corrections due to code review (issue #142, relationals)
* Correction for prev commit
* Added subnormals related condition for test verification (issue #142, relationals)
* Added indexing correction due to code review
* Replaced hardcoded iteration limit (issue #142, relationals)
* Added support to test half floats with printf calls (issue #142, printf)
* Added corrections related to rounding and casting halfs (issue #142, printf)
* Reusing similar function (issue #142, printf)
* Corrected path without cl_khr_fp16 support (issue #142, printf)
* Cosmetic fix for order of vector tests (issue #142, printf)
* Added correction related to vendor test review (issue #142, printf)
`CMAKE_CXX_STANDARD` is already set in the top-level CMakeLists.txt
file, so there is no need to have it repeated for individual modules.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Remove unused variables throughout the code base and enable the
`-Wunused-variable` warning flag globally to prevent new unused
variable issues being introduced in the future.
This is mostly a non-functional change, with one exception:
- In `test_conformance/api/test_kernel_arg_info.cpp`, an error check
of the clGetDeviceInfo return value was added.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* Using helper functions for clCreateKernel
Uses of clCreateKernel following create program helper
functions, have been incorporated into
create_single_kernel_helper when suitable.
Contributes #31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Skip tests using clCompileProgram in offline mode
Contributes #31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Using type wrappers when using kernel helper functions
Also includes fix for windows build
Fixes#31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Remove clReleaseKernel for wrapped kernel
Fixes#31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Moved float tests that expect limits into their own sub-test.
These are harder to test generically on the CPU so have them be their own test which will retain hard-coded reference results.
* Remove unused variable.
* Switched reference result type from (char**) to (vector::const char*)
* printf: generate reference results where possible #673#675
The reference results had two issues:
- They did not take into account the rounding mode of the device.
- Scientific notation results did not have trailing zero's, meaning that the exponent could be a single digit, despite the requirement being at least two digits.
This change introduces runtime generated reference results for types with numerical representations (float, int, hex, etc) where a direct mapping to standard C99 (sn)printf is possible to execute on the CPU.
* Trim leading zeroes from the exponent when verifying result #675.
There is no limit on how many leading zeros may be in the exponent, so strip them all.
* Switched to using get_default_rounding_mode.
(Patch2)
A number of tests have got their own code for checking the presence of
extensions. This change replaces that code with is_extension_available
function.
Contributes to #627
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
Change-Id: I17e007e5ad009e522c5006c42537bf1170550a6f
Also changed the test so that any implementation supporting < 1.2 can skip the test.
Uses format that @gwawiork has recently used to verify device version.
Moved all duplicate 'PrintArch' functions to testHarness.c
Replaced sysctl system call used in 'PrintArch' function with uname
system call
Signed-off-by: bhargavdas <bhargav_das@mentor.com>
Update testHarness.c
In all these cases, the new entrypoint is not necessary. These
changes enable the tests to work or are a necessary step to get
the tests to work on an OpenCL 1.2 implementation.
While this may not be the final approach we want to solve this
specific compatibility issue, it also has the nice property of
reducing the diff with cl12_trunk until we merge.
Signed-off-by: Kévin Petit <kpet@free.fr>
The cl_arm_printf extension uses a call-back to tell the user-code
that some printf output has appeared from the execution of the CL
kernel.
The extsiting Printf tests assume output to stdout.
This change adds code to detect the cl_arm_printf extension, and an
implementation of the callback code to write to stdout.
Also fix a couple of formatting errors and don't "poll" when waiting
for events.
Signed-off-by: Mats Petersson <mats.petersson@arm.com>
Parallel printf tests fail because they use the same file /tmp/tmpfile
to capture OpenCL kernel outputs. This patch solves this problem by
using a unique file for each process.
Some of the setup functionality is already there in the test harness, so
use that and remove the duplicated code from within the suite.
Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>