ILGPU icon indicating copy to clipboard operation
ILGPU copied to clipboard

[BUG]: Radix sort - too many resources requested for launch

Open dellamonica opened this issue 1 year ago • 0 comments

Describe the bug

Calling the method returned by CreateRadixSort is throwing CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES.

Environment

  • ILGPU version: 1.5.1
  • .NET version: .NET 8
  • Operating system: Windows 11
  • Hardware (if GPU-related): NVIDIA GeForce GTX 1060

Steps to reproduce

using SortOp = RadixSortPairsOperation<float, int, DescendingFloat>;
...
var sort = accel.CreateRadixSort<RadixSortPair<float, int>, Stride1D.Dense, SortOp>();
int tempSize = accel.ComputeRadixSortTempStorageSize<RadixSortPair<float, int>, SortOp>(buffer.IntLength);
using var tmpBuffer = accel.Allocate1D<int>(tempSize);
sort(accel.DefaultStream, buffer, tmpBuffer.View);

The buffer above is an ArrayView<RadixSortPair<float, int>> buffer = Extent = {(10340985)}, Length = 10340985 tempSize = 20762773

Also tried with smaller sized buffers (fewer than 1M) but the problem persisted.

Expected behavior

Launch should succeed and properly execute the sort.

Additional context

The code is running under a unit test. A couple of hours after filing this issue, I noticed that the error only occurs when the debugger is running. If the test is run without a debugger attached, it all works!

dellamonica avatar Jul 26 '24 15:07 dellamonica