only works for threadsperblock = 512