Half way to fixing cuda direct loop code generation