How to compile to real architecture only (No PTX) via Visual Studio 2022


I am trying to compile without PTX format and the attached screenshot is my current setting. However, when compiling, it keeps indicating -gencode=arch=compute_86,code="sm_86,compute_86" which of course includes the PTX. Please can you help me?



are there inherited values? Show a picture of the entire dialog box

Yes ! compute_52,sm_52. You can the capture below

Need a picture of the entire dialog box for Device, the one you originally showed only a portion of.

Now paste the full output from console from running a project build for this project.

I am only allowed to paste the non-sensitive parts of the console output as the part of intellectual property protection.

…-gencode=arch=compute_86,code="sm_86,compute_86" --use-local-env -ccbin “C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX64\x64” -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include" …

…-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include" -lineinfo --keep-dir x64\Debug -use_fast_math -maxrregcount=0 --machine 64 --compile -cudart static -g -DWNT -DWNT_WINDOW -DProj_MPHSMOD_EXPORTS -Xcompiler "/EHsc /W3 /nologo /Od /Fdx64\Debug\vc143.pdb /FS /Zi /MDd " -o…

@Robert_Crovella are there something missing?

Update : What I remark is the PTX is enabled only when running debugging via Nsight Debugging (Next-Gen). In standard debugging via Start on Visual Studio, it’s disabled.

When i am using compute_86,compute_86, i got runtime error message : PTX JIT compilation was disabled. I am using GeForce RTX3070 Laptop

I had to check with some colleagues. But it was staring us in the face:

Set the “enable virtual arch in fatbin” option to No:

It seems bad IDE design to provide two options to specify the same thing: (1) add a virtual architecture under “code generation” (2) boolean flag “enable virtual arch in fatbin”. Does (2) override (1) in case of conflicts?

I set this option to No but it still giving the same gencode output.

In the past (2 years ago), i was compiling my program fine without PTX under the same code generation format. Somehow, throughout the updates, something changes in such way that it is now unable to compile to the right code generation.

As far as I am concerned MSVS IDE and CMake are both to be avoided. I always suggest command line tools and classical Makefiles.

Under the hood MSVS and CMake use these as well, but now programmers have the additional task of trying to figure out how to tell them to generate the command line options they know they need. Hours can be spent of trying to figure that out, a very frustrating experience. Been there, done that, got the T-shirt.

@njuffa @Robert_Crovella Just to let you know that i was able to edit the right gencode into the Additional command line section (Screenshot 2) by leaving the Code Generation to blank (Screenshot 1). Also, I used cuobjdump and it seems that it’s no longer giving ptx output (Screenshot 3).

However, on the NSight Compute side, when profiling one kernel, i am still able to see the litterature of my code as shown on Screenshot 4. Do you know if there is another setting i might miss? Should i get rid of -lineinfo?


it may be a settings inheritance issue. Once you change the option to “No”, you would want to take another look at the actual command line in the console output from the project build. If the switches haven’t changed appropriately then you have modified settings for a different file, different hierarchy level, or different project.

  • make sure you are editing project settings for the correct project and type (x64/debug/release). Make sure the project type you are building matches the project type whose setting you are editing
  • there are settings at the project level and at the file level. If necessary, check both settings.

Yes ! I admit that VS IDE is a nightmare especially when it comes to configure add-on such as Cuda. Anyway I turned off -lineinfo and everything is fine now :). Thanks for your help !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.