I started unwinding some loops and then I figured out this problem with separating __device function__ declaration from definitions across files