Why can scatter accept invalid indices?

I just noticed that scatter can accept invalid index arguments. Say, for a 2x3 matrix, scatter would accept [2, 3] where 3 is actually invalid. I’m just curious about the reason of keeping this configuration.

According to my experience, this may cause CUDA unspecified launch failure error.

Hi,

On CPU this will raise an error as expected.
On CUDA, checking each index is problematic because of the async nature of the kernels and because it’s expensive. So the cuda kernel assumes correct indices.

1 Like

Wow, I see. Thanks very much!