23 Commits

Author SHA1 Message Date
Marcin Hajder
02a3c7e609 Replaced test values for hexfloat and printf to avoid ambiguity (#2425)
Fixes #1335 according to the issue description. 

@alycm replaced with straightforward values in terms of hex float
representation
2026-01-13 10:44:39 -07:00
Marcin Hajder
0c064ac017 Added a test case for printing an empty string (#2590)
Fixes #2364 according to issue description
2025-12-02 08:41:36 -08:00
Ahmed
4c54ecbd1f Fix printf vector for RTZ devices (#2459)
The failure is :

7)testing printf("%.1v4hla",(0.25f,0.5f,1.f,1.5f))
verifyOutputBuffer failed with kernel:
__kernel void test14(void)
{
float4 tmp = (float4)(0.25f,0.5f,1.f,1.5f); printf("%.1v4hla\n",tmp);}
 expected: 0x1p-2,0x1p-1,0x1p+0,0x1.8p+0
 got: 0x1.0p-2,0x1.0p-1,0x1.0p+0,0x1.8p+0

%.1 requires 1 decimal.
2025-08-05 09:19:37 -07:00
Grzegorz Wawiorko
42b4bca510 Fix test_printf - any nan format is allowed by OpenCL C spec (#2298)
OpenCL C says that printing nan is implementation-defined for
floating-point numbers -
https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_C.html#printf-format-string
2025-04-01 13:44:39 -07:00
Chuang-Yu Cheng
54afc2e7a5 printf: Fix floating-point rounding consistency for RTZ devices (#2202)
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.
2025-02-11 08:46:23 -08:00
Marcin Hajder
d339fd4356 Extended printf test to verify length sub-specifiers (#2083)
According to work plan for issue #1058
2024-10-08 08:38:18 -07:00
Marcin Hajder
0395a1efef Correction for printing long type variables in 32-bit system (#2094)
Due to change request from #2037
2024-10-01 08:45:39 -07:00
Marcin Hajder
661a7b08ae Added printf test for long type cases (#2037)
according to work plan for issue
https://github.com/KhronosGroup/OpenCL-CTS/issues/1058
2024-09-24 08:42:49 -07:00
Cui, Dele
9f88b0b229 Specify precision in the format flag for float4 hexadecimal output (#2064)
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>
2024-09-19 09:30:10 +02:00
Sven van Haastregt
c0db608eac printf: add missing vector length modifiers (#2044)
The length modifier is required with a vector specifier.

Fixes https://github.com/KhronosGroup/OpenCL-CTS/issues/2039

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-08-29 14:45:15 +02:00
Marcin Hajder
0a00a1f5b0 Added printf test for double type cases (#2022)
according to work plan for issue
https://github.com/KhronosGroup/OpenCL-CTS/issues/1058
2024-08-27 08:41:05 -07:00
Marcin Hajder
aa49f3bb53 Added few missing format cases for zero and blank space padding (#2016)
according to work plan for issue #1058
2024-08-13 09:50:07 -07:00
Marcin Hajder
19cb042985 Extended printf test to support more vector cases (#2019)
according to work plan for issue
https://github.com/KhronosGroup/OpenCL-CTS/issues/1058
2024-08-06 08:45:58 -07:00
David Neto
0be82dce5e [printf] Test empty format string, and empty arg string (#2018)
Issue: #1058
2024-07-23 20:11:34 +01:00
David Neto
5b5e43e1fb [printf]: input value should be exactly representable as 32-bit float (#2015)
Fixed: #2009
2024-07-18 14:08:43 -07:00
Marcin Hajder
8cd2b7d799 Extended printf test with new mixed format cases (#1988)
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.
2024-07-09 08:47:31 -07:00
Karol Herbst
89923f8004 Extend printf tests with more %% corner cases (#1986)
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.
2024-07-02 09:30:03 -07:00
Marcin Hajder
582fea57dc Extended printf test with new strings cases (#1951)
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)
2024-06-18 08:44:18 -07:00
Marcin Hajder
88a707dd13 Corrections for printf test with floating point limits arguments (#1940)
According to work plan from issue #1058
2024-05-21 08:38:04 -07:00
Marcin Hajder
20ab003053 Added cl_half support for test_printf (#1622)
* 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)
2023-03-28 08:57:03 -07:00
Sven van Haastregt
6554c49018 [NFCI] Remove unused variables and enable -Wunused-variable (#1483)
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>
2022-09-08 12:54:36 +01:00
Jeremy Kemp
ce39ffdda7 Printf fixes for reference results #673 #675 (#680)
* 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.
2020-04-15 14:30:29 +01:00
James Price
40f50d77a3 Rename test .c sources to .cpp where necessary (#604)
Remove hacks to force language from CMake files.

Closes KhronosGroup/OpenCL-CTS#25
2020-02-21 17:34:31 +00:00