r/sycl • u/krypto1198 • Nov 30 '25
SYCL (AdaptiveCpp) Kernel hangs indefinitely with large kernel sizes (601x601)
Hi everyone,
I am working on a university project implementing a Non-Separable Gaussian Blur (the assignment explicitly requires a non-separable implementation, so I cannot switch to a separable approach) using SYCL. I am running on a Linux headless server using AdaptiveCpp as my compiler. The GPU is an Intel Arc A770.
I have implemented a standard brute-force 2D convolution kernel.
When I run the program with small or medium kernels (e.g., 31x31), the code works perfectly and produces the correct image.
However, when I test it with a large kernel size (specifically 601x601, which is required for a stress test assignment), the application hangs indefinitely at q.wait(). It never returns, no error is thrown, and I have to kill the process manually.
My Question: I haven't changed the logic or the memory management, only the kernel size variable.
Does anyone know what could be causing this hang only when the kernel size is large? And most importantly, does anyone know how to resolve this to make the kernel finish execution successfully?
Code Snippet:
// ... buffer setup ...
q.submit([&](handler& h) {
// ... accessors ...
h.parallel_for(range<2>(height, width), [=](id<2> idx) {
int y = idx[0];
int x = idx[1];
// ... clamping logic ...
for (int c = 0; c < channels; c++) {
float sum = 0.f;
// The heavy loop: 601 * 601 iterations
for (int ky = -radius; ky <= radius; ky++) {
for (int kx = -radius; kx <= radius; kx++) {
// ... index calculation ...
sum += acc_in[...] * acc_kernel[...];
}
}
acc_out[...] = sum;
}
});
});
q.wait(); // <--- THE PROGRAM HANGS HEREThanks in advance for your help!
View all comments
Show parent comment
2
u/illuhad Dec 02 '25
Grazie! :)
I gave it a try and observed the following:
dmesgshows what's going on:So: kernel driver encounters a timeout because the GPU is busy, then triggers a GPU reset. It's quite possible that a GPU reset also breaks assumptions in the userspace software layer (e.g. ROCm/HIP runtime), so things not ending gracefully (but e.g. just hanging) are definitely possible. Looks like the kernel indeed is just running too long.
printfinto the kernel to see what it's doing. There we can see that it's still chugging along, it's just way too much work, so it takes forever :)I don't have a discrete Intel GPU in the system I'm on at the moment to test.
int idx_in = (ny * width + nx) * channels + c;causes strided memory access patterns due to the way channels are handled, which is going to further degrade performance, especially on GPU. One clean solution could e.g. be to change data layout so that you have one contiguous memory region per channel.