The issue is that the line:
b[:-1] = b[1:]

reads and writes overlapping elements of b. There’s a similar issue in the original snippet, which @bgobbi mentions in the original post.
You can fix this by writing:
b[:-1] = b[1:].clone()

At some point in the future, I’d like to add overlap detection to kernels so that the copy automatically buffers the right-hand-side when necessary, but you have to watch out for these for now.