Skip to content

Commit

Permalink
only use --dopt when available
Browse files Browse the repository at this point in the history
  • Loading branch information
skallweitNV committed Jan 14, 2025
1 parent 9d3f99c commit caf3a90
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions source/compiler-core/slang-nvrtc-compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,9 @@ SlangResult NVRTCDownstreamCompiler::compile(

CommandLine cmdLine;

// --dopt option is only available in CUDA 11.7 and later
bool hasDoptOption = m_desc.version >= SemanticVersion(11, 7);

switch (options.debugInfoType)
{
case DebugInfoType::None:
Expand All @@ -952,14 +955,20 @@ SlangResult NVRTCDownstreamCompiler::compile(
default:
{
cmdLine.addArg("--device-debug");
cmdLine.addArg("--dopt=on");
if (hasDoptOption)
{
cmdLine.addArg("--dopt=on");
}
break;
}
case DebugInfoType::Maximal:
{
cmdLine.addArg("--device-debug");
cmdLine.addArg("--generate-line-info");
cmdLine.addArg("--dopt=on");
if (hasDoptOption)
{
cmdLine.addArg("--dopt=on");
}
break;
}
}
Expand Down

0 comments on commit caf3a90

Please sign in to comment.