Bad TLOG files generation triggers false up-to-date project

Hello,

I was struggling a couple of days trying to find out why sometimes mi VS 2019 projects compiles my .cu files after editing them, and sometimes not, forcing me to clean+build (not even rebuild) my projects to get my ptx files updated.
Finally, I found out what is happening: the “CUDA 11.2.targets” file provided by CUDA visual studio integration doesn’t meet the MS requirement that the read/write .tlog files must have full paths:

The not-full-path entries I get are two:

  1. CudaCompile.read.1u.tlog
    MYPROJECTNAME.VCXPROJ
  2. CudaCompile.write.1u.tlog
    MYPROJECTNAME.DIR\DEBUG\MYKERNELNAME.PTX

If I fix both entries by hand all works like charm, but of course it is not a valid solution since I have several projects and the .tlog files can be rewritten by visual studio in some cases (clean project, for example).

Anyway, I managed to fix the “CudaCompile.read.1u.tlog” tlog file replacing this:

            <_CudaCompileReadTlog
                Condition="'%(CudaCompile.ExcludedFromBuild)' != 'true' AND '%(CudaCompile.CompileOut)' != ''"
                Include="^%(CudaCompile.FullPath);%(CudaCompile.AdditionalDependencies);%(CudaCompile.ProjectDeps);%(CudaCompile.Deps)" />

by this:

            <_CudaCompileReadTlog
                Condition="'%(CudaCompile.ExcludedFromBuild)' != 'true' AND '%(CudaCompile.CompileOut)' != ''"
                Include="^%(CudaCompile.FullPath);%(CudaCompile.AdditionalDependencies);$(MSBuildProjectDirectory)\%(CudaCompile.ProjectDeps);%(CudaCompile.Deps)" />

and I fix the “CudaCompile.write.1u.tlog” replacing this:

            <_CudaCompileWriteTlog
                Condition="'%(CudaCompile.ExcludedFromBuild)' != 'true' AND '%(CudaCompile.CompileOut)' != ''"
                Include="^%(CudaCompile.FullPath);%(CudaCompile.CompileOut)" />

by this:

            <_CudaCompileWriteTlog
                Condition="'%(CudaCompile.ExcludedFromBuild)' != 'true' AND '%(CudaCompile.CompileOut)' != ''"
                Include="^%(CudaCompile.FullPath);$(MSBuildProjectDirectory)\%(CudaCompile.CompileOut)" />

This works for me, but maybe this is not the more generic solution. Or maybe I am missing something on this subject and the “CUDA 11.2.targets” file is fine, I am not an expert on this. In case I am right, please fix this soon, it is a very annoying and productivity stopper issue for VS users.

cheers