share inline methods between cuda and cpu impl