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>
Fix whitespace issues and remove superfluous parens in the
run_conformance.py script. This addresses 288 out of the 415
issues reported by pylint.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Use size_t instead of cl_int
Memory is allocated for cl_int,
but mapped as size_t.
Use size_t instead of cl_int during
allocation and mapping for consistency.
* Use size_t instead of cl_int
Memory is allocated for cl_int,
but mapped as size_t.
Use size_t instead of cl_int during
allocation and mapping for consistency.
* Use size_t instead of cl_int
Memory is allocated for cl_int,
but mapped as size_t.
Use size_t instead of cl_int during
allocation and mapping for consistency.
* Remove test_half changes.
Remove test_half changes from other fix
that got included in this commit.
* Final formatting fix.
test_error returns the err given as the first argument. As the
run_test function returns a bool, we end up returning true (meaning
pass) when an api function fails.
Instead return explicitly false (meaning fail).
* Initial command-buffer tests
Introduce some basic testing of the
[cl_khr_command_buffer](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_Ext.html#cl_khr_command_buffer)
extension. This is intended as a starting point from which we can iteratively build up tests
for the extension collaboratively.
* Move tests into derived classes
* Move tests from methods into derived classes implementing
a `Run()` interface.
* Fix memory leak when command_buffer isn't freed when a test
is skipped.
* Print correct error code for
`CL_DEVICE_COMMAND_BUFFER_CAPABILITIES_KHR`
* Pass `nullptr` for queue parameter to command recording entry-points
* Define command-buffer type wrapper
Other OpenCL object have a wrapper to reference count their use
and free the wrapped object. The command-buffer object can't use
the generic type wrappers which are templated on the appropriate
release/retain function, as the release/retain functions are
queried at runtime.
Instead, define our own command-buffer wrapper class where a base
object is passed on construction which contains function pointers
to the release/retain functions that can be used in the wrapper.
* Use create_single_kernel_helper_create_program
Use `create_single_kernel_helper_create_program` rather than
hardcoding `clCreateProgramWithSource` to allow for other types
of program input.
Also fix bug using wrong enum for passing properties on command-buffer
creation, should be `CL_COMMAND_BUFFER_FLAGS_KHR`
* Add out-of-order command-buffer test
Introduce a basic test for checking sync-point use
with out-of-order command-buffers.
This also includes better checking of required queue properties.
Commit 9666ca3c ("[NFC] Fix sign-compare warnings in math_brute_force
(#1467)", 2022-08-23) inadvertently changed the semantics of the if
condition. The `i > gEndTestNumber` comparison was relying on
`gEndTestNumber` being promoted to unsigned. When casting `i` to
`int32_t`, this promotion no longer happens and as a result any tests
given on the command line were being skipped.
Use an unsigned type for `gStartTestNumber` and `gEndTestNumber` to
eliminate the casts and any implicit conversions between signed and
unsigned types.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Simplify code by avoiding manual resource management.
This commit only modifies tests that use one queue per thread. The
other unmodified tests are single-threaded and use the global
`gQueue`.
Original patch by Marco Antognini.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Fixes a missing-field-initializers warning. The original intent was
most likely to initialize both fields (similar to other functions in
this file), but a `,` was missed.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
When verification of the computed result fails, the test would still
report as "passed". This is because `s_test_fail` is only written to
and never read.
Fix the immediate issue by returning a failure value and incrementing
`gFailCount` if any error was detected. The error handling can be
improved further, but I'm leaving that out of the scope of this fix.
Fixes https://github.com/KhronosGroup/OpenCL-CTS/issues/1445
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>
* Update cl_khr_extended_async_copies tests to the latest version of the extension
Update the 2D and 3D extended async copies tests. Previously they were based on
an older provisional version of the extension.
Also update the variable names to only use 'stride' to refer to the actual
stride values. Previously the tests used 'stride' to refer to the end of one
line or plane and the start of the next. This is not the commonly understood
meaning.
* Address cl_khr_extended_async_copies PR feedback
* Remove unnecessary parenthesis in kernel code
* Make variables `const` and rearrange so that we can reuse
variables, rather than repeating expressions.
* Add in missing vector size of 3 for 2D tests
* Use C++ String literals for kernel code
Rather than C strings use C++11 string literals to define the
kernel code in the extended async-copy tests. Doing this makes
the kernel code more readable.
Co-authored-by: Ewan Crawford <ewan@codeplay.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
* Initial CTS for external sharing extensions
Initial set of tests for below extensions
with Vulkan as producer
1. cl_khr_external_memory
2. cl_khr_external_memory_win32
3. cl_khr_external_memory_opaque_fd
4. cl_khr_external_semaphore
5. cl_khr_external_semaphore_win32
6. cl_khr_external_semaphore_opaque_fd
* Updates to external sharing CTS
Updates to external sharing CTS
1. Fix some build issues to remove unnecessary, non-existent files
2. Add new tests for platform and device queries.
3. Some added checks for VK Support.
* Update CTS build script for Vulkan Headers
Update CTS build to clone Vulkan Headers
repo and pass it to CTS build
in preparation for external memory
and semaphore tests
* Fix Vulkan header path
Fix Vulkan header include path.
* Add Vulkan loader dependency
Vulkan loader is required to build
test_vulkan of OpenCL-CTS.
Clone and build Vulkan loader as prerequisite
to OpenCL-CTS.
* Fix Vulkan loader path in test_vulkan
Remove arch/os suffix in Vulkan loader path
to match vulkan loader repo build.
* Fix warnings around getHandle API.
Return type of getHandle is defined
differently based on win or linux builds.
Use appropriate guards when using API
at other places.
While at it remove duplicate definition
of ARRAY_SIZE.
* Use ARRAY_SIZE in harness.
Use already defined ARRAY_SIZE macro
from test_harness.
* Fix build issues for test_vulkan
Fix build issues for test_vulkan
1. Add cl_ext.h in common files
2. Replace cl_mem_properties_khr with cl_mem_properties
3. Replace cl_external_mem_handle_type_khr with
cl_external_memory_handle_type_khr
4. Type-cast malloc as required.
* Fix code formatting.
Fix code formatting to
get CTS CI builds clean.
* Fix formatting fixes part-2
Another set of formatting fixes.
* Fix code formatting part-3
Some more code formatting fixes.
* Fix code formatting issues part-4
More code formatting fixes.
* Formatting fixes part-5
Some more formatting fixes
* Fix formatting part-6
More formatting fixes continued.
* Code formatting fixes part-7
Code formatting fixes for image
* Code formatting fixes part-8
Fixes for platform and device query tests.
* Code formatting fixes part-9
More formatting fixes for vulkan_wrapper
* Code formatting fixes part-10
More fixes to wrapper header
* Code formatting fixes part-11
Formatting fixes for api_list
* Code formatting fixes part-12
Formatting fixes for api_list_map.
* Code formatting changes part-13
Code formatting changes for utility.
* Code formatting fixes part-15
Formatting fixes for wrapper.
* Misc Code formatting fixes
Some more misc code formatting fixes.
* Fix build breaks due to code formatting
Fix build issues arised with recent
code formatting issues.
* Fix presubmit script after merge
Fix presubmit script after merge conflicts.
* Fix Vulkan loader build in presubmit script.
Use cmake ninja and appropriate toolchain
for Vulkan loader dependency to fix
linking issue on arm/aarch64.
* Use static array sizes
Use static array sizes to fix
windows builds.
* Some left-out formatting fixes.
Fix remaining formatting issues.
* Fix harness header path
Fix harness header path
While at it, remove Misc and test pragma.
* Add/Fix license information
Add Khronos License info for test_vulkan.
Replace Apple license with Khronos
as applicable.
* Fix headers for Mac OSX builds.
Use appropriate headers for
Mac OSX builds
* Fix Mac OSX builds.
Use appropriate headers for
Mac OSX builds.
Also, fix some build issues
due to type-casting.
* Fix new code formatting issues
Fix new code formatting issues
with recent MacOS fixes.
* Add back missing case statement
Add back missing case statement
that was accidentally removed.
* Disable USE_GAS for Vulkan Loader build.
Disable USE_GAS for Vulkan Loader build
to fix aarch64 build.
* Update Copyright Year.
Update Copyright Year to 2022
for external memory sharing tests.
* Android specific fixes
Android specific fixes to
external sharing tests.
Workitems in the last workgroup calls async_work_group_copy with
different argument values depending on 'adjust'. According to spec,
this results in undefined values.
* Added integer_dot_product_input_4x8bit and integer_dot_product_input_4x8bit_packed tests to feature_macro_test
* clang formatting
* Now the test checks whether the array of optional features returned by clGetDeviceInfo contains the standard optional features we are testing.
* Update test_conformance/compiler/test_feature_macro.cpp
Added printing the missing standard feature it it is not found inside the optional features array returned by clGetDeviceInfo.
Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com>
Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com>
* Fix local memory out of bounds in atomic_fence
In the error condition, the atomic_fence kernel can illegally access local memory addresses.
In this snippet, localValues is in the local address space and provided as a kernel argument. Its size is effectively get_local_size(0) * sizeof(int). The stores to localValues lead to OoB accesses.
size_t myId = get_local_id(0);
...
if(hisAtomicValue != hisValue)
{ // fail
atomic_store(&destMemory[myId], myValue-1);
hisId = (hisId+get_local_size(0)-1)%get_local_size(0);
if(myValue+1 < 1)
localValues[myId*1+myValue+1] = hisId;
if(myValue+2 < 1)
localValues[myId*1+myValue+2] = hisAtomicValue;
if(myValue+3 < 1)
localValues[myId*1+myValue+3] = hisValue;
}
* Fix formatting
* Fix formatting again
* Formatting
GCC 11.2.0 warns about a possible string overflow (when
num_not_supported_extensions+num_of_supported_extensions == 0)
since no space would be allocated for the terminating
null byte that string manipulation fns expect to find.
This unconditionally adds an extra byte to the allocation to silence
the warning and fix building with -Werror.
The slice pitch/padding calculation assumed that the 'height' variable contained the pixel height of the image, which it doesn't for IMAGE1D_ARRAY.
Fixes#1257
Fill in the placeholder readme with some basic information on building and
running the project. Information on the conformance submission process and
contributing are also included.
Should help close a few issues referenced in
https://github.com/KhronosGroup/OpenCL-CTS/issues/1096
I don't think this is all the information we want, but is a starting point
from which we can progress. For example, adding the android build instructions
from https://github.com/KhronosGroup/OpenCL-CTS/pull/1021
* images: Stop checking gDeviceType != CL_DEVICE_TYPE_GPU
If the device type also advertises CL_DEVICE_TYPE_DEFAULT (which should
be valid), this causes it to be considered a CPU device and the tests
enforce different precision and rounding expectations.
* Fix clang-format
* Drop redundant NORM_OFFSET checks
- Add one Windows build to Github Actions
- Remove Appveyor config
- Move a few build steps out of the script
- Use Ninja as the generator (makes for more readable logs)
- Add build cache (except on Windows where it seems to break)
Change-Id: Ida90ee1842af98aff86e5144ab7b9766480378c9
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
* Change memory order and scope for atomics that gate final results being stored.
memory_order_acq_rel with memory_scope_device is now used to guarantee that the correct memory consistency is observed before final results are stored.
Previously it was possible for kernels to be generated that all used relaxed memory ordering, which could lead to false-positive failures.
Fixes#1370
* Disable atomics tests with global, in-program atomics.
If the device does not support `memory_order_relaxed` or `memory_scope_device`, disable atomics tests that declare their atomics in-program with global memory.
There is now an implicit requirement to support `memory_order_relaxed` and `memory_scope_device` for these tests.
* Fix misplaced parentheses.
* Change memory scope for atomic fetch and load calls in kernel
Change the memory scope from memory_scope_work_group to
memory_scope_device so the ordering applies across all work items
Co-authored-by: Sreelakshmi Haridas <sharidas@quicinc.com>
* imageHelpers: add CL_UNORM_SHORT_{555, 565} in get_max_absolute_error
Working on a device supporting CL_UNORM_SHORT_565 image data type, I
noticed that the max absolute error authorized was not the right one
for such image data type.
Also because of normalization, there is always an absolute error
authorized whatever the filtering of the sampler.
Ref #1140
* put back if statement on filter_mode
* Fix clang 10 build errors
Lossy casts due to inexact float representation of CL_INT_MAX
* Fix clang format
* Remove implicit-const-int-float-conversion flag
* updated reduce test
* switched all reduce tests to new framework
* switch over scans to new framework
* remove old files
* minor fixes
* add type type name to the kernel name
* fix Windows build and warnings
* address review comments
As per the OpenCL Extension Specification § 38.6 Ballots:
If no bits representing predicate values from all work items in
the subgroup are set in the bitfield value then the return value
is undefined.
The case with no bits set is still worth testing, as it does not result
in undefined behavior, but only an undefined return value.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
Test cases where the index/mask/delta is greater than or equal to the
maximum subgroup size. These are cases that return undefined results
but are not undefined behavior.
The index/mask/delta values now include values less than twice the
subgroup size, and 0xffffffff.
Testing for sub_group_shuffle_xor() already allowed inputs that were
greater or equal to the subgroup size for the last subgroup in a
workgroup, but did not properly account for this in the verification
function, potentially resulting in out of bounds accesses.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>