Commit Graph

84 Commits

Author SHA1 Message Date
Sergiu Bogdan Popescu
d63cc8ce5d Modified kernel code to correspond to the Image declared format (CL_UNSIGNED_INT8) (#2512)
**For mutable_dispatch_image_1d_arguments &
mutable_dispatch_image_2d_arguments:**
As the images are created using CL_UNSIGNED_INT8, the kernel does not
use correct instructions, as they are designed for signed variable. This
fix consists of modifying the kernel code to use unsigned instructions
and auxiliary variables .
2025-10-28 09:01:42 -07:00
Ahmed
1a4862e84e Use a more genuine kernel for the command buffer device enqueue negative test (#2532)
The current one has no arguments and does not enqueue any work.
2025-10-28 08:50:08 -07:00
Ewan Crawford
bfa96c77d8 CTS updates for reworked simultaneous use (#2477)
Actions test plan from
https://github.com/KhronosGroup/OpenCL-CTS/issues/2473 to update CTS
tests to reflect changes from cl_khr_command_buffer PR
https://github.com/KhronosGroup/OpenCL-Docs/pull/1411

* Adds new test in`command_buffer_pipelined_enqueue.cpp` for multiple
enqueues without blocking in-between, but serialized execution.
* Removed test for `CL_COMMAND_BUFFER_STATE_PENDING_KHR` state query.
* Remove negative test for `clEnqueueCommandBuffer` pending state error.
* Simplify `cl_khr_command_buffer` tests that stress simultaneous-use by
testing multiple serialized enqueues of the same command-buffer, which
doesn't now require the device imultaneous-use capability
* Remove simultaneous-use command-buffer creation in base class to off,
and require tests do it themselves if they require it.
* Rewrite mutable dispatch simultaneous test to test updating both
pipelined enqueues, and updating the new definition of simultaneous-use

---------

Co-authored-by: Ewan Crawford <ewan@codeplay.com>
2025-10-14 09:15:20 -07:00
Yilong Guo
3f6dd3c333 Fix buffer overflow in MutableDispatchWorkDim test (#2511)
The test had critical buffer overflow issues:

1. Buffer size was calculated incorrectly: used update_elements (4)
instead
   of total work items. For 3D kernels, this meant allocating 16 bytes
   when 64*4=256 bytes were needed for the updated 4x4x4 grid.

2. Original 2x2x2 grid writes 8 elements (32 bytes) but buffer was only
   16 bytes, causing overflow on first execution.

3. Updated 4x4x4 grid writes 64 elements (256 bytes) with massive
   overflow into adjacent memory.

4. Verify function only checked one dimension instead of total elements
   in the 3D grid.

Fixed by:
- Calculating total work items as product of all dimensions
- Using update_total_elements (64) for buffer allocation
- Updating Verify calls to check correct number of elements
- Adding constants for original_total_elements and update_total_elements
2025-09-09 08:53:13 -07:00
Ewan Crawford
096a227afd Extra mutable dispatch coverage (#2499)
Adds tests to cover points 2 & 3 from the questions asked about
cl_khr_command_buffer_mutable_dispatch in
https://github.com/KhronosGroup/OpenCL-Docs/issues/1437

* New test for point 2 from issue, `mutable_dispatch_updates_persist`,
testing multiple enqueues of a command-buffer after update, and that the
updated argument persists for all of them.
* New test for point 3 pseudocode from issue in test
`mutable_dispatch_set_kernel_arg`
2025-09-02 09:45:54 -07:00
Ben Ashbaugh
e936977934 remove checks for the command-buffer pending state (#2504)
This is a very small subset of the changes in #2477 to get things
building again, since the command-buffer pending state is no longer in
the spec or headers.
2025-08-27 11:43:29 +01:00
Romaric Jodin
0633af21c1 mutable_command_info: remove unnecessary Skip function (#2498)
The check implementated by that Skip function is already implemented in
'InfoMutableCommandBufferTest::Skip()'.

Also this is trying to get the extension_version before checking whether
the extension is supported, leading to false negative for device not
supporting the extension.
2025-08-20 11:21:46 -07:00
Ewan Crawford
9809cc931a Test for mutable-dispatch original work-dim (#2438)
New test following on from OpenCL-Docs Issues discussion
https://github.com/KhronosGroup/OpenCL-Docs/issues/1390#issuecomment-3023818903

Noting that we have no test coverage for using the original value of
`work_dim` during command-buffer update. All of our current CTS testing
uses `0` for the `work_dim` to signify no update from the original
value, however this test explicitly uses the original value.
2025-08-05 09:15:04 -07:00
Yilong Guo
466049474c Fix buffer size for mutable dispatch command buffer test (#2437) 2025-08-05 09:14:35 -07:00
Yilong Guo
e7e753f1a9 Fix data race in mutable command buffer simultaneous execution test (#2434)
Prior to this change, both `clEnqueueReadBuffer` calls before and after
updating the command buffer were writing to the same `output_buffer`,
causing a data race condition and the first call's result to be
overwritten. This commit introduces separate destination vectors
(`output_buffer` and `updated_output_buffer`) for these operations and
verifies both results independently to ensure test integrity.
2025-08-05 09:13:05 -07:00
Yilong Guo
dacb944cf3 Retain output memory objects for simultaneous command buffer tests (#2429)
Memory objects created in `EnqueueSimultaneousPass()` are used by
kernels
that don't execute until the user event is signaled. Without retaining
these objects, they would be destroyed before the deferred kernel
execution occurs.
2025-08-05 09:12:25 -07:00
Ewan Crawford
5997a00b2f Test releasing a command-buffer after submission but before execution has finished (#2414)
Add cl_khr_command_buffer test that is it valid to release a
command-buffer after it has been enqueued but before execution is
finished.

This stresses the semantics from
[clReleaseCommandBufferKHR](https://registry.khronos.org/OpenCL/sdk/3.0/docs/man/html/clReleaseCommandBufferKHR.html#_description)
that: "After the command_buffer reference count becomes zero **and has
finished execution**, the command-buffer is deleted"
2025-07-07 16:35:20 -07:00
Michael Rizkalla
8701acfa90 Add tests for cl_ext_immutable_memory_objects (#2286)
This change provides partial test coverage for
KhronosGroup/OpenCL-Docs#1280

Adding CTS tests for:
1. clEnqueueMapBuffer, clEnqueueMapImage.
2. Command buffer negative tests.
3. clSetKernelArgs negative tests.

The bulk of the tests is to make sure that the CL driver does not allow
writing to a memory object that is created with `CL_MEM_IMMUTABLE_EXT`
flag when used with the above APIs.

---------

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2025-06-17 10:19:11 -07:00
Ahmed Hesham
90524879e4 Migrate extensions suites to the new test registration framework (#2334)
This covers:
* cl_ext_cxx_for_opencl
* cl_khr_command_buffer
* cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch
* cl_khr_dx9_media_sharing
* cl_khr_external_semaphore
* cl_khr_kernel_clock
* cl_khr_semaphore

Contributes to #2181.

---------

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-04-16 11:14:34 +01:00
Ben Ashbaugh
d7cb6b006b fix negative_create_command_buffer_not_supported_properties test (#2248)
fixes #2247 

* For the `negative_create_command_buffer_not_supported_properties`
test, the only property we can check for is simultaneous use. All other
properties are part of other extensions and hence will generate
`CL_INVALID_VALUE`, not `CL_INVALID_PROPERTY`.
* Checks whether the `cl_khr_command_buffer_multi_device` extension is
supported when using `CL_COMMAND_BUFFER_DEVICE_SIDE_SYNC_KHR`, instead
of `device_side_enqueue_support`.
* If the `cl_khr_command_buffer_multi_device` extension is NOT supported
and the `CL_COMMAND_BUFFER_DEVICE_SIDE_SYNC_KHR` command buffer creation
flag is used, the expected error code is `CL_INVALID_VALUE`, not
`CL_INVALID_PROPERTY`.
2025-02-11 08:52:53 -08:00
Ewan Crawford
044ec98f66 Command-buffer queue compatibility test update (#2230)
Update cl_khr_command_buffer tests to reflect changes from
https://github.com/KhronosGroup/OpenCL-Docs/pull/1292

* Moves negative test for
`CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR` from
command-buffer creation to enqueue.
* Moves negative test for
`CL_DEVICE_COMMAND_BUFFER_REQUIRED_QUEUE_PROPERTIES_KHR` from
command-buffer creation to enqueue.
* Introduces a negative test for `CL_INVALID_DEVICE` on command-buffer
enqueue for new error condition in spec. Although it requires a context
to be contain more than 1 device, which I'm not sure if possible in
current test framework.
* Introduces a new test that created a command-buffer using a queue
without the profiling property set, then enqueues the command-buffer to
a queue with the profiling property set.
* Introduces a new test that creates a command-buffer with an in-order
queue, enqueued on an out-of-order queue.
* Introduces a new test that creates a command-buffer with an
out-of-order queue, enqueued on an in-order queue.
2025-02-11 08:47:15 -08:00
Ewan Crawford
2ff5cdaf7d Command-buffer query for supported queue properties (#2101)
CTS test update to match OpenCL-Doc & OpenCL-Header PRs:
* https://github.com/KhronosGroup/OpenCL-Headers/pull/265
* https://github.com/KhronosGroup/OpenCL-Docs/pull/850

Tested with https://github.com/bashbaug/SimpleOpenCLSamples/pull/126
locally using a checkout of the linked OpenCL-Headers branch
2025-01-14 12:37:38 -08:00
Ewan Crawford
bc5b0215ee Fix derived command-buffer Skip() checks (#2217)
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.
2025-01-14 09:07:41 -08:00
Ewan Crawford
98d52d0d56 Check command-buffer extension version for equality (#2215)
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.
2025-01-14 09:06:30 -08:00
Romaric Jodin
86e0c236a1 fix negative_create_command_buffer_device_does_not_support_out_of_ord… (#2207)
…er_queue

Test should be skipped if device does not support out of order queue or
if device supports out of order command buffer.

Fix #2204
2025-01-07 09:33:29 -08:00
Romaric Jodin
435db66a3a fix negative_command_buffer_enqueue_with_different_context (#2206)
negative_command_buffer_enqueue_with_different_context does not need to
use CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE

Fix #2205
2025-01-07 09:32:36 -08:00
gorazd-sumkovski-arm
96e3d7e669 Command buffer test adjustments (#2141)
Signed-off-by: Gorazd Sumkovski <gorazd.sumkovski@arm.com>
Co-authored-by: Ewan Crawford <ewan.cr@gmail.com>
2024-11-26 09:26:04 -08:00
xinjin01
e211470035 Fix CTS mutable_dispatch memory leak (#2129)
Current class wrapper of the CTS test framework allows getting the
pointer of the private member object. This puts the object at risk of
losing its original value if the pointer gets reassigned, causing a
memory leak and potentially other problems.

This happens to the "clMemWrapper kernel" used by
mutable_command_work_groups tests, where the "clMemWrapper kernel" gets
initialised by the default basic setup function and then it gets
reassigned by the build_program_create_kernel_helper() helper function
through pointer.

This patch fixes this issue by updating mutable_command_work_groups
tests: instead of calling basic setup function and then initialise the
"clMemWrapper kernel" object again in the helper function, it now
overrides the basic setup function to make sure the "clMemWrapper
kernel" will be assigned only once.

Signed-off-by: Xin Jin <xin.jin@arm.com>
2024-11-05 08:53:55 -08:00
gorazd-sumkovski-arm
6a2c0b1cff Fix bug in mutable_command_full_dispatch (#2082)
This test did not pass the `-cl-std=` flag when building the program. As
a result, for an OpenCL 3.0 device, the program will be "compiled using
the highest OpenCL C 1.x language version supported" by the device.
However this will force uniform work-group sizes which leads to a
`CL_INVALID_WORK_GROUP_SIZE` error.

To fix this, use the `create_single_kernel_helper()` helper function
which will automatically get the device version and pass that to
`-cl-std=` when building the program.

---------

Signed-off-by: Gorazd Sumkovski <gorazd.sumkovski@arm.com>
2024-10-22 09:51:46 -07:00
gorazd-sumkovski-arm
1a17853e75 Command buffer testing fixes (#2081)
Signed-off-by: Gorazd Sumkovski <gorazd.sumkovski@arm.com>
2024-10-22 09:50:20 -07:00
xinjin01
63ce937aac Fix bug in mutable_command_full_dispatch (#2118)
The test is missing clFinish after clEnqueueSVMUnmap. Add clFinish after
clEnqueueSVMUnmap.

Signed-off-by: Xin Jin <xin.jin@arm.com>
2024-10-17 07:39:38 -07:00
Michal Babej
c40c8d56f6 a few fixes (thread safety & cl_khr_command_buffer UB) (#1840)
some fixes we've been carrying in our CTS fork:

* fix UB in `command_buffer_event_sync.cpp`: enqueue of two commands in
two separate queues, with both using the same buffer argument, and no
synchronization between the commands.
* fix UB in `command_buffer_test_barrier.cpp`: missing synchronization
between zeroing command and command-buffer using two separate queues
* make `test_thread_dimensions.cpp` thread-safe to avoid spurious
errors.
2024-10-08 09:55:21 -07:00
ellnor01
617e7cb233 Re-enabling narrowing errors (#1144)
Fixes narrowing conversion build errors in test_common

Removing disable of narrowing errors in main CMakeLists.txt
and moving it down to specific test_conformance suite's 
CMakeLists.txt where there are many more build errors revealed
from this fix. 

Fixes a few simple issues under test_conformance in the process.

Contributes #787

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

---------

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2024-10-08 09:54:32 -07:00
Michal Babej
2be73b2be1 fix generic_address_space, command_buffer_event_sync, test_compiler and images/test_1D_buffer (#2062)
fixes several issues:

* `generic_address_space` test: add check for program scope variables.
The test uses both generic AS and program-scope variables, however it
only checked the generic-AS presence in `clGetDeviceInfo`.
* `compiler/test_compiler_defines_for_extensions.cpp`: add
`cl_khr_command_buffer_multi_device` to the list of recognized
extensions
* `command_buffer_event_sync.cpp`: add delays for testing
`clSetEventCallback` - according to specification, these can be executed
asynchronously (in a separate thread) by the OpenCL implementation,
hence the event callback is not quaranteed to be called before
`clFinish()` returns. Existing test `events/test_callbacks.cpp` also
waits for callback with loops of usleep.
* `images/kernel_image_methods/test_1D_buffer.cpp`: fix allocation size
being too small for the 1D buffer backing the image

---------

Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com>
2024-10-01 09:26:39 -07:00
Ben Ashbaugh
dd2117f5fc fix a few array-based mutable command buffer issues (#2074)
fixes a few minor issues introduced by #1984.

edit: Tested with the updated command buffer emulation layer on a device
that supports out-of-order queues and SVM and all of the
`test_cl_khr_mutable_dispatch` tests pass.
2024-09-17 09:34:17 -07:00
Sven van Haastregt
c32a76786c cl_khr_mutable_dispatch: fix -Wformat warnings (#2071)
Printing of a `size_t` requires the `%zu` specifier.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-09-06 15:48:19 -07:00
Ben Ashbaugh
b57f90eeab Add properties parameter to all command-buffer commands (update) (#2072)
This is an update to #2050, with updates from the main branch.

---------

Co-authored-by: Ewan Crawford <ewan@codeplay.com>
2024-09-06 08:22:37 -07:00
Ewan Crawford
0bdc5d082f Array based clUpdateMutableCommandsKHR changes (#1984)
CTS changes to reflect the spec changes merged in
https://github.com/KhronosGroup/OpenCL-Docs/pull/1045 and requires
header updates from
https://github.com/KhronosGroup/OpenCL-Headers/pull/245

Tested using OCK implementation from
https://github.com/codeplaysoftware/oneapi-construction-kit/pull/501
2024-09-06 07:36:17 -07:00
banan328
89a720d3f7 Added new tests for CL_MUTABLE_DISPATCH_ASSERT_NO_ADDITIONAL_WORK_GROUPS_KHR flag with mutable dispatch (#1991)
Added new tests for
CL_MUTABLE_DISPATCH_ASSERT_NO_ADDITIONAL_WORK_GROUPS_KHR with mutable
dispatch according to this test plan
https://github.com/KhronosGroup/OpenCL-CTS/issues/1897

Co-authored-by: Banan Ashkar <banan.ashkar@mobileye.com>
2024-08-06 09:19:49 -07:00
Julia Jiang
6b4d57d85c Fix cts build error on mariner OS (#1872) 2024-07-02 09:40:42 -07:00
Michal Babej
769984b023 fix bugs in negative command_buffer tests (#1969)
- when calling command buffer APIs, test with `command_queue != NULL`
should return `CL_INVALID_VALUE` only if the device doesn't support
`cl_khr_command_buffer_multi_device` (added `Skip`)

- some tests enqueued commands with multiple invalid arguments, e.g.
`clCommandCopyImageToBufferKHR` with two images and invalid sync points.
AFAIK the order of argument checking is not defined, so implementation
can return any valid error value for such API calls, but the tests
assumed only one particular error would be returned. Fix the API calls
to be unambiguous.
2024-07-02 09:32:12 -07:00
Kamil-Goras-Mobica
d379b58ab6 Added negative tests for clCommandCopy[Buffer, BufferRect, BufferToImage]KHR (#1941)
According to description
https://github.com/KhronosGroup/OpenCL-CTS/issues/1668
2024-06-11 08:42:29 -07:00
Kamil-Goras-Mobica
d53d7bc559 Added negative tests for clCommandFill[Buffer, Image]KHR (#1944)
According to description
https://github.com/KhronosGroup/OpenCL-CTS/issues/1668
2024-05-28 08:39:01 -07:00
Kamil-Goras-Mobica
d3e3bdabaa Negative tests clCommandSvmMem[cpy, Fill]KHR (#1956)
According to description
https://github.com/KhronosGroup/OpenCL-CTS/issues/1668
2024-05-22 09:18:36 +01:00
Kamil-Goras-Mobica
9500c30492 Negative tests for commandCopyImage[ToBuffer]KHR (#1943)
According to description
https://github.com/KhronosGroup/OpenCL-CTS/issues/1668
2024-05-21 08:40:08 -07:00
Kamil-Goras-Mobica
e6fec7417f Added negative tests for clCommandBarrierWithWaitListKHR (#1937)
According to description
https://github.com/KhronosGroup/OpenCL-CTS/issues/1668
2024-05-14 08:43:23 -07:00
Kamil-Goras-Mobica
5093ce5be5 Added negative test commandNDRangeKernel (#1936)
According to description
https://github.com/KhronosGroup/OpenCL-CTS/issues/1668
2024-05-14 08:42:46 -07:00
Kamil-Goras-Mobica
4c085dec4a Added negative tests for clEnqueueCommandBufferKHR (#1931)
* Added negative tests for clEnqueueCommandBufferKHR

* Added blocking the clEnqueueCommandBufferKHR call on a user event

* Added finalizing buffer before enqueuing
2024-04-21 23:45:33 -07:00
Kamil-Goras-Mobica
308fa6e78c Added negative tests for clRetainCommandBufferKHR, clReleaseCommandBu… (#1928)
* Added negative tests for clRetainCommandBufferKHR, clReleaseCommandBufferKHR, clFinalizeCommandBufferKHR

* Added blocking the clEnqueueCommandBufferKHR call on a user event

* Changed cl_event to clEventWrapper
2024-04-19 14:01:38 -07:00
Kamil-Goras-Mobica
7fa567c7a5 Corrections for negative tests for function CreateCommandBufferKHR (#1915) 2024-04-16 08:40:44 -07:00
Kamil-Goras-Mobica
d0300d176f Added negative tests for clGetCommandBufferInfoKHR (#1929)
* Added negative tests for clGetCommandBufferInfo

* Replaced param_value_size values from 0 to sizeof() - 1
2024-04-09 08:54:44 -07:00
Marcin Hajder
f2a30737b6 Corrections for mutable arguments tests (#1921)
* Corrections to mutable arguments tests

-added verification of device capabilities against mutable arguments
-corrected fail of 2 tests with Construction Kit
-general cleanup

* cleanup corrections

* restored relaxed version of mutable arguments tests

* corrections to strengthen the test around SVM arguments
2024-04-09 08:50:03 -07:00
Marcin Hajder
96361171ed Added test to cover iterative mutable argument update (#1925)
* Added test to cover iterative mutable argument update

According to issue description #1481

* cosmetic correction

* clang format fix

* Corrections due to code review
2024-03-26 08:39:18 -07:00
Marcin Hajder
349427e4aa Added test to cover overwritten update of mutable parameters (#1922)
* Added test to cover overwritten update of mutable parameters

According to issue description #1481

* cosmetic corrections

* Corrections due to code review
2024-03-26 08:38:38 -07:00
Marcin Hajder
da4a30d394 Added new test to cover multiple commands dispatch in one enqueued update (#1919)
* Added new test to cover multiple comands dispatch in one enqueued update

According to issue description #1481

* clang format correction

* Few minor corrections

* cosmetic corrections
2024-03-19 08:42:42 -07:00