Need help profiling an optix application

I have been trying to profile an optix application using nsight compute but have been facing some issues. I have compiled my optix code using the -g -lineinfo -use_fast_math --keep and -rdc options.
In order to profile the application I first generated a system trace and identified the kernel __raygen_renderFrame as the kernel I want to profile. I right clicked on the kernel and selected profile. I launched the profiler and then stopped it but nsight warned me that no kernels had been profiled.
I then tried to use the interactive profiler and profiled the optixLaunch kernel but when I tried to view the source information in the source tab I couldnt find any information. I was also not able to spot __raygen_renderFrame in the interactive profiler and assumed that it was being called by optixLaunch.
I need source and other profiling information about __raygen_renderFrame. I am new to optix and nsight compute and would really appreciate any help.

Have you set the OptixModuleCompileOptions to OPTIX_COMPILE_DEBUG_LEVEL_MODERATE?
https://raytracing-docs.nvidia.com/optix7/guide/index.html#program_pipeline_creation#7017
If not, try with that first.

If that doesn’t fix it, please try setting the environment variable OPTIX_FORCE_DEPRECATED_LAUNCHER only while profiling.
https://forums.developer.nvidia.com/t/optix-pipelines-do-not-show-up-in-nsight-compute/254831/2
Note that Shader Execution Reordering (SER) is switched off while that environment variable is set.

I set the two flags that you mentioned and launched nsight compute from visual studio, which I ran as admin, and it worked. But I only get sass in the source view. I have set the source lookup directories to my source directories for the project but nsight compute is unable to import source from them. The nsight compute displays the message - unable to import source - default, .

What’s your Nsight Compute version?
If it’s not the newest 2023.2, could you try with that?

Are you compiling to PTX or OptiX-IR input target code?

I would expect this to work with PTX. I normally do not compile my OptiX device code with any debug flags (-g, -G) though because that doesn’t make sense for profiling anyway.
Having the -lineinfo should be enough to get the source code connections. The line infos should appear interleaved inside the PTX code and the CUDA source files are listed at the bottom of the PTX file.

Also in case we need to reproduce this, what is your system configuration?
OS version, installed GPU(s), VRAM amount, display driver version, OptiX major.minor.micro version, CUDA toolkit version used to generate the input PTX, host compiler version.

I am using the nsight compute 2023.2.2. I am compiling to PTX and using bin2c to convert it to an embeddable file. There were three runs for which source was somehow correctly imported but I have not been able to reproduce it even though I am following the same steps. I tried adding the source directories to Source Lookup after I started getting the import error. Is there some way I can compare the configuration of these two reports, maybe by opening it as plain text file and comparing the two?

OS: Windows Version 22H2 (OS Build 19045.3324)
GPU: NVIDIA RTX A5000
VRAM: 24 GB
Driver: NVIDIA RTX / Quadro Desktop and Notebook Driver release 535 (Version 537.13)
Optix Version: 7.5.0
Cuda toolkit version: 11.7

Does host compiler refer to my host code compiler that is the compiler used by visual studio?

Yes, I’m asking for the host compiler version because not all combinations of CUDA Toolkit and MSVS versions are compatible.

Your configuration looks fine. There might be issues when using an Nsight Version which is older than the OptiX SDK/Display Driver combination but you’re already on the newest ones.

I don’t start Nsight Compute from inside the MSVS IDE, so that would be one thing to try, running Nsight Compute as administrator as standalone application.

Other than that, since you’re running the most recent driver release for your graphics board, you could also upgrade your OptiX SDK version, even to the newest available 8.0.0 release.

(OptiX SDK 7.5.0 had a small issue under Linux with the error reporting which is fixed in newer versions:
https://forums.developer.nvidia.com/t/earlier-feedback-for-syntax-errors-in-shaders/230343/4 )

I also skipped CUDA 11.7 and used 11.8 without issues for quite some time and I’m currently using CUDA 12.1 for my OptiX work.

I really don’t know what else could be responsible for not finding the CUDA source code.
If the PTX code contains the right CUDA source file information from the lineinfo, then that should be known to Nsight Compute because that is part of the OptiX input source code and if you say that you explicitly set the CUDA source code locations inside Nsight Compute and that didn’t find them, then I don’t know.

I would need to check with the same drivers and Nsight Compute version if that works on my system.

I cannot reproduce that problem on my Windows 10 system, running official 537.13 drivers, RTX 6000 Ada, the Nsight Compute 2023.2.2.0 release from https://developer.nvidia.com/nsight-compute as standalone program as administrator and OPTIX_FORCE_DEPRECATED_LAUNCHER=1 inside the environment field, and my OptiX_Apps examples build with CUDA 12.1 and OptiX SDK 8.0.0.

When changing the OptixModuleCompileOptions.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_MODERATE and compiling either to OptiX-IR or PTX targets with unchanged NVCC command line options, I can resolve the source code view inside Nsight Compute to show both CUDA and SASS code.