## Summary
I've encountered a deadlock in the Mali-G52 OpenCL driver when creating circular event dependencies between two command queues. The `clFinish()` call hangs indefinitely.
## Environment
- **Device**: Radxa Rock 5 Model B- **GPU**: Mali-G52- **Driver**: ARM Mali OpenCL driver (latest available)- **OS**: Linux (ARM64)
## Reproducer
The following minimal C program demonstrates the issue:
```
#define CL_TARGET_OPENCL_VERSION 120#include <CL/cl.h>#include <stdio.h>#include <stdlib.h>
int main() { cl_platform_id platform; cl_device_id device; cl_context context; cl_command_queue q1, q2; cl_event e1, e2; cl_int err;
// Get platform and GPU device (code omitted for brevity) // ... standard OpenCL initialization ...
context = clCreateContext(NULL, 1, &device, NULL, NULL, &err); q1 = clCreateCommandQueue(context, device, 0, &err); q2 = clCreateCommandQueue(context, device, 0, &err);
for (int i = 0; i < 500; i++) { printf("Test %d\n", i); fflush(stdout);
// Create circular dependency err = clEnqueueMarkerWithWaitList(q1, 0, NULL, &e1); err = clEnqueueMarkerWithWaitList(q2, 1, &e1, NULL); // q2 waits for e1 err = clEnqueueMarkerWithWaitList(q2, 0, NULL, &e2); err = clEnqueueMarkerWithWaitList(q1, 1, &e2, NULL); // q1 waits for e2 clReleaseEvent(e1); clReleaseEvent(e2);
err = clEnqueueMarkerWithWaitList(q1, 0, NULL, &e1);
clFinish(q1); // <-- HANGS HERE on Mali-G52 clReleaseEvent(e1); }
// cleanup... printf("PASSED\n"); return 0;}