cuda::experimental::places::checked_grid_index#

inline size_t cuda::experimental::places::checked_grid_index(
const dim4 &grid_dims,
const pos4 &p
)#

Linear grid index of an owner position, validated per dimension.

dim4::get_index only asserts its bounds, so in release builds an owner position that overflows a fast dimension while remaining inside the grid’s total size (e.g. (2, 0) on a 2x2 grid, aliasing (0, 1)) would silently misattribute placement to another grid position. Owner positions come from user-provided mappers (possibly through a foreign ABI), so they are validated here — the one place every accounting path funnels through — and rejected with a defined error instead.