Files
OpenCL-CTS/test_conformance/extensions/cl_khr_external_semaphore
Ahmed Hesham c3d9c85743 Fix sync_fd imported semaphore undefined behaviour (#2616)
The following tests create an OpenCL semaphore using (fd == -1) then
call `clEnqueueSignalSemaphoresKHR` on that semaphore. (fd == -1) refers
to an object that has already signaled and enqueueing a signal command
on it will lead to undefined behavior.

Quoting OpenCL specification:
```
The special value -1 for fd is treated like a valid sync file descriptor
referring to an object that has already signaled.
```
And
```
Signaling the same binary semaphore twice without an interleaving wait
may lead to undefined behavior.
```

- external_semaphores_simple_1
- external_semaphores_reuse
- external_semaphores_cross_queues_ooo
- external_semaphores_cross_queues_io
- external_semaphores_cross_queues_io2

This commit changes the tests to avoid signaling an already signaled
semaphore and correctly re-import the semaphore's fd after enqueueing a
wait successfully.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
Co-authored-by: Michael Rizkalla <michael.rizkalla@arm.com>
2026-03-03 09:55:32 -08:00
..