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.
Add custom commands and targets to automatically assemble and validate
the SPIR-V shaders used by the test.
Automatic assembly depends on finding `python3`, `spirv-as` and
`spirv-val`. `SPIRV_TOOLS_DIR` can be defined by the user during
configuration to provide an override path. Default behaviour assumes
that the binaries exist in `PATH`.
---------
Signed-off-by: Ahmed Hesham <ahmed.hesham@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>
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>
fixes#2145
As suggested by @svenvh reciprocal has different precision requirements
than divide. This PR introduces special path for reciprocal for
binar_float_operator to test reciprocal with relaxed math. If this PR
will get approvals, invalidate PR #2162
The buffer size input to the test function clEnqueueReadBuffer was
incorrect, which cause segmentation fault. And it didn't match the size
for the host allocation outptr
In the half-precision `fdim` test, the original code used `CL_HALF_RTE`
to convert the float result back to half, causing a mismatch in
computation results when the hardware uses RTZ. Some of the examples:
```
fdim(0x365f, 0xdc63) = fdim( 0.398193f, -280.75f) = 281.148193f (RTE=0x5c65, RTZ=0x5c64)
fdim(0xa4a3, 0xf0e9) = fdim(-0.018112f, 10056.0f) = 10055.981445f (RTE=0x70e9, RTZ=0x70e8)
fdim(0x1904, 0x9ab7) = fdim( 0.002449f, -0.003279f) = 0.005728f (RTE=0x1dde, RTZ=0x1ddd)
```
Fixed this by using the hardware's default rounding mode when converting
the result back to half.
This fixes three problems in `test_vulkan`:
1. One negative test is violating the OpenCL specification. A call to
`clEnqueue{Wait,Signal}SemaphoresKHR` with an invalid semaphore should
return `CL_INVALID_SEMAPHORE_KHR` and not `CL_INVALID_VALUE`.
>
[CL_INVALID_SEMAPHORE_KHR](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#CL_INVALID_SEMAPHORE_KHR)
if any of the semaphore objects specified by sema_objects is not valid.
2. When populating the list of supported external memory handle types
for Vulkan, the types are unconditionally added to the list, without
checking if the device supports it or not, this fix is namely for
`VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD`.
3. If a device does not support an optional extension (that is required
for a test), the test should skip, not throw an exception and fail. A
test failure should be reserved for the cases where a device claims
support for an extension but then fails to execute the test correctly.
---------
Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
- generate spv files into VULKAN_TEST_RESOURCES directory
- works with change that generates spv at build time
Co-authored-by: dcrawley <dcrawley@qti.qualcomm.com>
Avoid a
```
‘%zu’ directive writing between 1 and 20 bytes into a region of size 16
```
warning by using `std::string` for `generate_shuffle_mask`.
As this fixes the last remaining Wformat warning in the relationals
suite, drop the local `-Wno-format` compiler option.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
It was noticed during another PR review
https://github.com/KhronosGroup/OpenCL-CTS/pull/2207/files#r1903921283
that there
was a case where the return value of a `Skip()` check was ignored, this
is fixed in this PR.
I've also tracking down occurrences of derived class overriding the
`Skip()` test fixture method, but not calling the parents class `Skip()`
check inside of the method. I believe omitting this parent skip check
wasn't intentional, it's clearer to explicitly respect the parent
classes skip conditions, even if we've got away with not needing too due
to the way the derived class skip conditions have been defined.
As described in Issue
https://github.com/KhronosGroup/OpenCL-CTS/issues/2152 we currently
check the provisional extension version supported by a vendor is the
same or older than a test specified version. However, it was discussed
in the WG that this should be a check for equality to avoid hitting
issues when a implementation tests against an older version of the CTS
using a lower extension version, with API breaking changes having
occurred since.
The tests for the command-buffer family of extensions are the only
provisional KHR tests using this versioning check, so this PR updates
all those cases to equality.
fixes#2140
Adds testing for SPIR-V 1.5 features:
* Adds a test for bitcasts between pointers and vectors of integers.
Note, SPIR-V 1.5 only supports bitcasts to vectors of two 32-bit
integers. Therefore, the SPIR-V 1.5 behavior will only be exercised on
devices with 64-bit pointers. The test will run on devices with 32-bit
pointers, but will instead bitcast to scalars.
* Adds a test for OpGroupNonUniformBroadcast with a dynamic index. Note,
this is not an exhaustive test, and only unsigned integer types are
tested, to avoid duplicating testing for cl_khr_subgroup_ballot.
The `svm_pointer_passing` test has unflushed buffer unmap commands
queued, which a runtime might process after the `clSVMFree` calls at the
end of the test (through implicit flushing when destroying the queues at
e.g. program exit handlers).
This is only an issue when running the test with multiple devices.
However I think this was caused by a simple typo given the `clFinish`
was simply in the wrong block.
Use `add_custom_command` and `add_custom_target` instead of
`execute_process` so the generation of the Vulkan shader is done at
build time and not configuration time.
Use `configure_file` instead of string replacement.
Fixes#2179
Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
Move the global `-Wno-format` compiler option to the individual tests
that still trigger Wformat warnings. The majority of the tests now
compile cleanly with `-Wformat` enabled.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
- to be able to have deterministic results it is useful to have a
mechanism
to force the same count of workers
- this commit doesn't change the default settings but expands
functionality
Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This fixes occurrences where the previous wrong specifier appears to
work in a typical 64-bit build, but causes a Wformat warning in 32-bit
builds.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This change fixes the following issues when running `clCopyImage` test
with `use_pitches` flag for 1D buffer images.
1. Query device CL version using `get_device_cl_version` rather than
using `CL_DEVICE_VERSION`. Previously, using `char` may not be enough to
store the return value.
2. Pass `host_ptr` to `clCreateBuffer` when creating the buffer for the
1D image. `host_ptr` may not be `nullptr` if use_pitches flag is used.
Also, `buffer_flags` will contain `CL_MEM_USE_HOST_PTR` which requires a
host pointer to be passed.
3. Conditionally use the `host_ptr` when calling `clCreateImage`, it
will not be used with 1D image buffer. This is made to align with the
spec, in which if `mem_flags` has `CL_MEM_USE_HOST_PTR` a host pointer
must be present, but if the memory flag is not present, host pointer
must be `nullptr`.
4. Use the correct free function `free` and `align_free` based on the
allocation function that was used.
Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
This change addresses a free function mis-match issue where `delete` is
used to free memory allocated via `malloc` within `create_random_data`
and in the test function.
The change involves the following tests:
1. arrayimagecopy
2. arrayimagecopy3d
3. imagearraycopy
4. imagearraycopy3d
This should address #2173
Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
The code base uses a mix of 'device' and 'deviceID'. I suggest we
standardise on 'device' which is shorter and slightly more prevalent.
Contributes to #2181
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
Printing of a `size_t` requires the `%zu` specifier.
This fixes occurrences where the previous wrong specifier appears to
work in a typical 64-bit build, but causes a Wformat warning in 32-bit
builds.
---------
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Switches the SVM tests to the new test registration framework.
The first commit is the best to review and contains the actual changes.
The second commit purely has formatting changes.
Note that several of these changes were a bit more than mechanical
because many of the SVM tests create a new context vs. using the context
provided by the harness and passed to each test function. The previous
code named the context provided by the harness differently, and hence
could use the name "context" in each test function, but with the new
test registration framework this is no longer possible. Instead, I am
creating the new context using the name "contextWrapper" and then
assigning it to the "context" passed to the test function, which seems
like the best way to avoid using the wrong context unintentionally. I am
open to suggestions to do this differently.
I have verified that the same calls are made before and after these
changes, and specifically that there are no context leaks.
Support building for Android on Arm and AArch64 platforms.
Modify the build matrix to add to new variations. Both variants
download, extract and setup the Android Native Development Kit (NDK) on
a Linux runner. Each variant specifies a `android_arch_abi`, which is
passed to CMake during configuration as its `CMAKE_ANDROID_ARCH_ABI`
option.
The CMake toolchain file provided by the NDK is used when building for
Android. The NDK version used is r27c, which is the latest Long-Term
Support (LTS) version. `ANDROID_PLATFORM` is intentionally not set, so
the NDK can default to the minimum supported version, which is 21. The
compiler (Clang) version used by this NDK is 18.0.3.
The NDK ships with its own sysroot, which has the Linux kernel headers
of version 6.8.0, or `LINUX_VERSION_CODE 395264`.
CMake
https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#id23https://cmake.org/cmake/help/latest/variable/CMAKE_ANDROID_ARCH_ABI.html
NDK
https://developer.android.com/ndk/downloads
On Ubuntu, use the system's package manager, `apt`, to download and
install the cross-compilers for Arm and AArch64. This replaces
downloading the compilers as tarballs.
To ensure that the correct version of the compiler is used when calling
one without the version suffix, e.g. `aarch64-linux-gnu-gcc`, use
`update-alternatives`.
On Linux, the compilers for `x86_64`, `arm`, and `aarch64` will now
correctly use the filesystem root as their sysroots, i.e. `/usr/include`
will be used when searching for headers, instead of each compiler
providing its own.
The following tests under `spirv_new`:
* `op_branch_conditional`
* `op_phi`
* `op_selection_merge`
were using randomly generated `cl_int` values, and storing the
difference between them as a `cl_int`. If one of the generated values is
negative and large enough, while the other is positive and large enough,
the difference then becomes a larger value that cannot be represented
using `cl_int`.
Switch the tests to use `cl_uint` instead, and update the relevant
spvasm{32,64} files to use `OpULessThan` instead of `OpSLessThan`.
Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>