m4rs-mt / ILGPU.Algorithms

The new standard algorithms library for ILGPU

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Delete i th Element of ArrayView

xman236 opened this issue · comments

Hi @m4rs-mt ,

I am wondering whether there is a way to delete an i_th Element of ArrayView. For instance, my method scale() converts the captured data frame information to the meter. However, the returned value also can be (0,0,0). In this case, I want to delete the i_th element so that this zero information is not forwarded to CPU. I couldn't find a delete function. Is there any work around?

`private static void ApplyKernel(
            Index index, /* The global thread index (1D in this case) */
            ArrayView<CameraSpacePoint> pixelArray, /* A view to a chunk of memory (1D in this case)*/
            ArrayView<Point3d> pixelArray_pt /* A view to a chunk of memory (1D in this case)*/
            )
        {
            Point3d tmp = scale(pixelArray[index]);
            if (XMath.Abs(tmp.X) > 0.0001 || XMath.Abs(tmp.Y) > 0.0001 || XMath.Abs(tmp.Z) > 0.0001)
            {
                pixelArray_pt[index] = tmp;
            }
            else
            {
                _pixelArray_pt.delete(index);_
            }
     
        }`

@xman236
I have also thought about such a feature in the past. If you (conceptually) delete only some elements of the underlying ArrayView, this will result in multiple copy operations, often degrading performance. Alternatively, it also takes some time to detect which parts to copy and which parts to skip. Currently, there is no built-in way to perform such a task.

Perhaps we can add an additional data structure that implements such a concept on top of the existing ILGPU functionality?

I will transfer this issue to the ILGPU.Algorithms library because the requested functionality requires a high-level data structure that can be built on ILGPU.

commented

Hey I am currently working on this topic and I will provide an implementation in the next weeks.

@xman236 I am not sure if this issue has been fixed. Since we are moving the ILGPU.Algorithms implementation to the ILGPU project repository in the next weeks, please open a new issue in the ILGPU project.