upgraded generic cuda kernel (Peter Messmer)