You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[next] gtfn: fails to compile negative shifts on cartesian unit-stride dimension with static strides #3071
#3063 derives static unit strides from the backend allocator layout and, unlike main, applies them to programs on Cartesian grids too: with the default allocators, the first horizontal dimension (e.g. IDim in (IDim, JDim, KDim)) gets a static stride of 1 in the GTFN bindings.
With that change and GT4PY_USE_BACKEND_ALLOCATOR_LAYOUT=1, the GTFN backend fails to compile Cartesian programs that apply a negative shift on the unit-stride dimension (e.g. IDim - 1). The compiler reports no matching function for call to 'shift' in gridtools/fn/cartesian.hpp, with a narrowing error on a non-type template argument.
main is not affected: there, the static unit stride is only applied to unstructured programs, which do not shift by negative offsets on the horizontal dimension.
Cause
GridTools' nanobind_adapter.hpp represents static strides as integral_constant<std::size_t, ...>, so the offset computation for a negative shift is unsigned and does not fit int_t.
Present in gridtools-cpp 2.3.9 and on GridTools master.
Represent static strides with a signed type (e.g. std::ptrdiff_t) in GridTools' nanobind_adapter.hpp, then bump gridtools-cpp in gt4py. Not yet tested.
Until then, GT4PY_USE_BACKEND_ALLOCATOR_LAYOUT stays off by default; it can be enabled by default once the fix is available.
changed the title [-]GTFN fails to compile negative shifts on cartesian unit-stride dimension with static strides[/-][+]next[gtfn]: fails to compile negative shifts on cartesian unit-stride dimension with static strides[/+]on Dec 2, 2026
changed the title [-]next[gtfn]: fails to compile negative shifts on cartesian unit-stride dimension with static strides[/-][+][next] gtfn: fails to compile negative shifts on cartesian unit-stride dimension with static strides[/+]on Dec 2, 2026
Activity
[-]GTFN fails to compile negative shifts on cartesian unit-stride dimension with static strides[/-][+]next[gtfn]: fails to compile negative shifts on cartesian unit-stride dimension with static strides[/+][-]next[gtfn]: fails to compile negative shifts on cartesian unit-stride dimension with static strides[/-][+][next] gtfn: fails to compile negative shifts on cartesian unit-stride dimension with static strides[/+]