» 1. Introduction v13.0 | PDF | Archive nvrtc The User guide for the NVRTC library. 1. Introduction NVRTC is a runtime compilation library for CUDA C++. It accepts CUDA C++ source code in character string form and creates handles that can be used to obtain the PTX. The PTX string generated by NVRTC can be loaded by cuModuleLoadData and cuModuleLoadDataEx, and linked with other modules by using the nvJitLink library or using cuLinkAddData of the CUDA Driver API. This facility can often provide optimizations and performance not possible in a purely offline static compilation. In the absence of NVRTC (or any runtime compilation support in CUDA), users needed to spawn a separate process to execute nvcc at runtime if they wished to implement runtime compilation in their applications or libraries, and, unfortunately, this approach has the following drawbacks: The compilation overhead tends to be higher than necessary. End users are required to install nvcc and related tools which make it complicated to distribute applications that use runtime compilation. NVRTC addresses these issues by providing a library interface that eliminates overhead associated with spawning separate processes, disk I/O,and so on, while keeping application deployment simple. 2. Getting Started 2.1. System Requirements NVRTC is supported on the following platforms: Linux x86\_64, Linux ppc64le, Linux aarch64, Windows x86\_64. Note: NVRTC does not depend on any other libraries or headers from the CUDA toolkit, and can be run on a system without a GPU. 2.2. Installation NVRTC is part of the CUDA Toolkit release and the components are organized as follows in the CUDA toolkit installation directory: On Windows: include\\nvrtc.h bin\\nvrtc64\_Major Release Version\_0.dll bin\\nvrtc-builtins64\_Major Release VersionMinor Release Version.dll lib\\x64\\nvrtc.lib lib\\x64\\nvrtc\_static.lib lib\\x64\\nvrtc-builtins\_static.lib doc\\pdf\\NVRTC\_User\_Guide.pdf On Linux: include/nvrtc.h lib64/libnvrtc.so lib64/libnvrtc.so.Major Release Version lib64/libnvrtc.so.Major Release Version.Minor Release Version.lib64/libnvrtc-builtins.so lib64/libnvrtc-builtins.so.Major Release Version.Minor Release Version lib64/libnvrtc-builtins.so.Major Release Version.Minor Release Version.lib64/libnvrtc\_static.a lib64/libnvrtc-builtins\_static.a doc/pdf/NVRTC\_User\_Guide.pdf 3. User Interface This chapter presents the API of NVRTC. Basic usage of the API is explained in Basic Usage. Error Handling General Information Query Compilation Supported Compile Options Precompiled header (PCH) (CUDA 12.8+) Host Helper 3.1. Error Handling NVRTC defines the following enumeration type and function for API call error handling. Enumerations nvrtcResult The enumerated type nvrtcResult defines API call result codes. Functions const char \* nvrtcGetErrorString(nvrtcResult result) nvrtcGetErrorString is a helper function that returns a string describing the given nvrtcResult code, e.g., NVRTC\_SUCCESS to "NVRTC\_SUCCESS". 3.1.1. Enumerations enum nvrtcResult The enumerated type nvrtcResult defines API call result codes. NVRTC API functions return nvrtcResult to indicate the call result. Values: enumerator NVRTC\_SUCCESS enumerator NVRTC\_ERROR\_OUT\_OF\_MEMORY enumerator NVRTC\_ERROR\_PROGRAM\_CREATION\_FAILURE enumerator NVRTC\_ERROR\_INVALID\_INPUT enumerator NVRTC\_ERROR\_INVALID\_PROGRAM enumerator NVRTC\_ERROR\_INVALID\_OPTION enumerator NVRTC\_ERROR\_COMPILATION enumerator NVRTC\_ERROR\_BUILTIN\_OPERATION\_FAILURE enumerator NVRTC\_ERROR\_NO\_NAME\_EXPRESSIONS\_AFTER\_COMPILATION enumerator NVRTC\_ERROR\_NO\_LOWERED\_NAMES\_BEFORE\_COMPILATION enumerator NVRTC\_ERROR\_NAME\_EXPRESSION\_NOT\_VALID enumerator NVRTC\_ERROR\_INTERNAL\_ERROR enumerator NVRTC\_ERROR\_TIME\_FILE\_WRITE\_FAILED enumerator NVRTC\_ERROR\_NO\_PCH\_CREATE\_ATTEMPTED enumerator NVRTC\_ERROR\_PCH\_CREATE\_HEAP\_EXHAUSTED enumerator NVRTC\_ERROR\_PCH\_CREATE enumerator NVRTC\_ERROR\_CANCELLED enumerator NVRTC\_ERROR\_TIME\_TRACE\_FILE\_WRITE\_FAILED 3.1.2. Functions const char \*nvrtcGetErrorString(nvrtcResult result) nvrtcGetErrorString is a helper function that returns a string describing the given nvrtcResult code, e.g., NVRTC\_SUCCESS to "NVRTC\_SUCCESS". For unrecognized enumeration values, it returns "NVRTC\_ERROR unknown". Parameters result – \[in\] CUDA Runtime Compilation API result code. Returns Message string for the given nvrtcResult code. 3.2. General Information Query NVRTC defines the following function for general information query. Functions nvrtcResult nvrtcGetNumSupportedArchs(int \*numArchs) nvrtcGetNumSupportedArchs sets the output parameter numArchs with the number of architectures supported by NVRTC. nvrtcResult nvrtcGetSupportedArchs(int \*supportedArchs) nvrtcGetSupportedArchs populates the array passed via the output parameter supportedArchs with the architectures supported by NVRTC. nvrtcResult nvrtcVersion(int \*major, int \*minor) nvrtcVersion sets the output parameters major and minor with the CUDA Runtime Compilation version number. 3.2.1. Functions nvrtcResult nvrtcGetNumSupportedArchs(int \*numArchs) nvrtcGetNumSupportedArchs sets the output parameter numArchs with the number of architectures supported by NVRTC. This can then be used to pass an array to nvrtcGetSupportedArchs to get the supported architectures. see nvrtcGetSupportedArchs Parameters numArchs – \[out\] number of supported architectures. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_INPUT nvrtcResult nvrtcGetSupportedArchs(int \*supportedArchs) nvrtcGetSupportedArchs populates the array passed via the output parameter supportedArchs with the architectures supported by NVRTC. The array is sorted in the ascending order. The size of the array to be passed can be determined using nvrtcGetNumSupportedArchs. see nvrtcGetNumSupportedArchs Parameters supportedArchs – \[out\] sorted array of supported architectures. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_INPUT nvrtcResult nvrtcVersion(int \*major, int \*minor) nvrtcVersion sets the output parameters major and minor with the CUDA Runtime Compilation version number. Parameters major – \[out\] CUDA Runtime Compilation major version number. minor – \[out\] CUDA Runtime Compilation minor version number. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_INPUT 3.3. Compilation NVRTC defines the following type and functions for actual compilation. Functions nvrtcResult nvrtcAddNameExpression(nvrtcProgram prog, const char \*const name\_expression) nvrtcAddNameExpression notes the given name expression denoting the address of a global function or device /\_\_constant\_\_ variable. nvrtcResult nvrtcCompileProgram(nvrtcProgram prog, int numOptions, const char \*const \*options) nvrtcCompileProgram compiles the given program. nvrtcResult nvrtcCreateProgram(nvrtcProgram \*prog, const char \*src, const char \*name, int numHeaders, const char \*const \*headers, const char \*const \*includeNames) nvrtcCreateProgram creates an instance of nvrtcProgram with the given input parameters, and sets the output parameter prog with it. nvrtcResult nvrtcDestroyProgram(nvrtcProgram \*prog) nvrtcDestroyProgram destroys the given program. nvrtcResult nvrtcGetCUBIN(nvrtcProgram prog, char \*cubin) nvrtcGetCUBIN stores the cubin generated by the previous compilation of prog in the memory pointed by cubin. nvrtcResult nvrtcGetCUBINSize(nvrtcProgram prog, size\_t \*cubinSizeRet) nvrtcGetCUBINSize sets the value of cubinSizeRet with the size of the cubin generated by the previous compilation of prog. nvrtcResult nvrtcGetLTOIR(nvrtcProgram prog, char \*LTOIR) nvrtcGetLTOIR stores the LTO IR generated by the previous compilation of prog in the memory pointed by LTOIR. nvrtcResult nvrtcGetLTOIRSize(nvrtcProgram prog, size\_t \*LTOIRSizeRet) nvrtcGetLTOIRSize sets the value of LTOIRSizeRet with the size of the LTO IR generated by the previous compilation of prog. nvrtcResult nvrtcGetLoweredName(nvrtcProgram prog, const char \*const name\_expression, const char \*\*lowered\_name) nvrtcGetLoweredName extracts the lowered (mangled) name for a global function or device /\_\_constant\_\_ variable, and updates \*lowered\_name to point to it. nvrtcResult nvrtcGetOptiXIR(nvrtcProgram prog, char \*optixir) nvrtcGetOptiXIR stores the OptiX IR generated by the previous compilation of prog in the memory pointed by optixir. nvrtcResult nvrtcGetOptiXIRSize(nvrtcProgram prog, size\_t \*optixirSizeRet) nvrtcGetOptiXIRSize sets the value of optixirSizeRet with the size of the OptiX IR generated by the previous compilation of prog. nvrtcResult nvrtcGetPTX(nvrtcProgram prog, char \*ptx) nvrtcGetPTX stores the PTX generated by the previous compilation of prog in the memory pointed by ptx. nvrtcResult nvrtcGetPTXSize(nvrtcProgram prog, size\_t \*ptxSizeRet) nvrtcGetPTXSize sets the value of ptxSizeRet with the size of the PTX generated by the previous compilation of prog (including the trailing NULL ). nvrtcResult nvrtcGetProgramLog(nvrtcProgram prog, char \*log) nvrtcGetProgramLog stores the log generated by the previous compilation of prog in the memory pointed by log. nvrtcResult nvrtcGetProgramLogSize(nvrtcProgram prog, size\_t \*logSizeRet) nvrtcGetProgramLogSize sets logSizeRet with the size of the log generated by the previous compilation of prog (including the trailing NULL ). nvrtcResult nvrtcSetFlowCallback(nvrtcProgram prog, int(\*callback)(void \*, void \*), void \*payload) nvrtcSetFlowCallback registers a callback function that the compiler will invoke at different points during a call to nvrtcCompileProgram, and the callback function can decide whether to cancel compilation by returning specific values. Typedefs nvrtcProgram nvrtcProgram is the unit of compilation, and an opaque handle for a program. 3.3.1. Functions nvrtcResult nvrtcAddNameExpression(nvrtcProgram prog, const char \*const name\_expression) nvrtcAddNameExpression notes the given name expression denoting the address of a global function or device/\_\_constant\_\_ variable. The identical name expression string must be provided on a subsequent call to nvrtcGetLoweredName to extract the lowered name. See also nvrtcGetLoweredName Parameters prog – \[in\] CUDA Runtime Compilation program. name\_expression – \[in\] constant expression denoting the address of a global function or device/\_\_constant\_\_ variable. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_PROGRAM NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_NO\_NAME\_EXPRESSIONS\_AFTER\_COMPILATION nvrtcResult nvrtcCompileProgram(nvrtcProgram prog, int numOptions, const char \*const \*options) nvrtcCompileProgram compiles the given program. It supports compile options listed in Supported Compile Options. Parameters prog – \[in\] CUDA Runtime Compilation program. numOptions – \[in\] Number of compiler options passed. options – \[in\] Compiler options in the form of C string array.options can be NULL when numOptions is 0. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_OUT\_OF\_MEMORY NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_INVALID\_PROGRAM NVRTC\_ERROR\_INVALID\_OPTION NVRTC\_ERROR\_COMPILATION NVRTC\_ERROR\_BUILTIN\_OPERATION\_FAILURE NVRTC\_ERROR\_TIME\_FILE\_WRITE\_FAILED NVRTC\_ERROR\_CANCELLED nvrtcResult nvrtcCreateProgram(nvrtcProgram \*prog, const char \*src, const char \*name, int numHeaders, const char \*const \*headers, const char \*const \*includeNames) nvrtcCreateProgram creates an instance of nvrtcProgram with the given input parameters, and sets the output parameter prog with it. See also nvrtcDestroyProgram Parameters prog – \[out\] CUDA Runtime Compilation program. src – \[in\] CUDA program source. name – \[in\] CUDA program name.name can be NULL; "default\_program" is used when name is NULL or “”. numHeaders – \[in\] Number of headers used.numHeaders must be greater than or equal to 0. headers – \[in\] Sources of the headers.headers can be NULL when numHeaders is 0. includeNames – \[in\] Name of each header by which they can be included in the CUDA program source.includeNames can be NULL when numHeaders is 0. These headers must be included with the exact names specified here. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_OUT\_OF\_MEMORY NVRTC\_ERROR\_PROGRAM\_CREATION\_FAILURE NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_INVALID\_PROGRAM nvrtcResult nvrtcDestroyProgram(nvrtcProgram \*prog) nvrtcDestroyProgram destroys the given program. See also nvrtcCreateProgram Parameters prog – \[in\] CUDA Runtime Compilation program. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_PROGRAM nvrtcResult nvrtcGetCUBIN(nvrtcProgram prog, char \*cubin) nvrtcGetCUBIN stores the cubin generated by the previous compilation of prog in the memory pointed by cubin. No cubin is available if the value specified to -arch is a virtual architecture instead of an actual architecture. See also nvrtcGetCUBINSize Parameters prog – \[in\] CUDA Runtime Compilation program. cubin – \[out\] Compiled and assembled result. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_INVALID\_PROGRAM nvrtcResult nvrtcGetCUBINSize(nvrtcProgram prog, size\_t \*cubinSizeRet) nvrtcGetCUBINSize sets the value of cubinSizeRet with the size of the cubin generated by the previous compilation of prog. The value of cubinSizeRet is set to 0 if the value specified to -arch is a virtual architecture instead of an actual architecture. See also nvrtcGetCUBIN Parameters prog – \[in\] CUDA Runtime Compilation program. cubinSizeRet – \[out\] Size of the generated cubin. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_INVALID\_PROGRAM nvrtcResult nvrtcGetLTOIR(nvrtcProgram prog, char \*LTOIR) nvrtcGetLTOIR stores the LTO IR generated by the previous compilation of prog in the memory pointed by LTOIR. No LTO IR is available if the program was compiled without -dlto. See also nvrtcGetLTOIRSize Parameters prog – \[in\] CUDA Runtime Compilation program. LTOIR – \[out\] Compiled result. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_INVALID\_PROGRAM nvrtcResult nvrtcGetLTOIRSize(nvrtcProgram prog, size\_t \*LTOIRSizeRet) nvrtcGetLTOIRSize sets the value of LTOIRSizeRet with the size of the LTO IR generated by the previous compilation of prog. The value of LTOIRSizeRet is set to 0 if the program was not compiled with -dlto. See also nvrtcGetLTOIR Parameters prog – \[in\] CUDA Runtime Compilation program. LTOIRSizeRet – \[out\] Size of the generated LTO IR. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_INVALID\_PROGRAM nvrtcResult nvrtcGetLoweredName(nvrtcProgram prog, const char \*const name\_expression, const char \*\*lowered\_name) nvrtcGetLoweredName extracts the lowered (mangled) name for a global function or device/\_\_constant\_\_ variable, and updates \*lowered\_name to point to it. The memory containing the name is released when the NVRTC program is destroyed by nvrtcDestroyProgram. The identical name expression must have been previously provided to nvrtcAddNameExpression. See also nvrtcAddNameExpression Parameters prog – \[in\] CUDA Runtime Compilation program. name\_expression – \[in\] constant expression denoting the address of a global function or device/\_\_constant\_\_ variable. lowered\_name – \[out\] initialized by the function to point to a C string containing the lowered (mangled) name corresponding to the provided name expression. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_NO\_LOWERED\_NAMES\_BEFORE\_COMPILATION NVRTC\_ERROR\_INVALID\_PROGRAM NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_NAME\_EXPRESSION\_NOT\_VALID nvrtcResult nvrtcGetOptiXIR(nvrtcProgram prog, char \*optixir) nvrtcGetOptiXIR stores the OptiX IR generated by the previous compilation of prog in the memory pointed by optixir. No OptiX IR is available if the program was compiled with options incompatible with OptiX IR generation. See also nvrtcGetOptiXIRSize Parameters prog – \[in\] CUDA Runtime Compilation program. optixir – \[out\] Optix IR Compiled result. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_INVALID\_PROGRAM nvrtcResult nvrtcGetOptiXIRSize(nvrtcProgram prog, size\_t \*optixirSizeRet) nvrtcGetOptiXIRSize sets the value of optixirSizeRet with the size of the OptiX IR generated by the previous compilation of prog. The value of nvrtcGetOptiXIRSize is set to 0 if the program was compiled with options incompatible with OptiX IR generation. See also nvrtcGetOptiXIR Parameters prog – \[in\] CUDA Runtime Compilation program. optixirSizeRet – \[out\] Size of the generated LTO IR. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_INVALID\_PROGRAM nvrtcResult nvrtcGetPTX(nvrtcProgram prog, char \*ptx) nvrtcGetPTX stores the PTX generated by the previous compilation of prog in the memory pointed by ptx. See also nvrtcGetPTXSize Parameters prog – \[in\] CUDA Runtime Compilation program. ptx – \[out\] Compiled result. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_INVALID\_PROGRAM nvrtcResult nvrtcGetPTXSize(nvrtcProgram prog, size\_t \*ptxSizeRet) nvrtcGetPTXSize sets the value of ptxSizeRet with the size of the PTX generated by the previous compilation of prog (including the trailing NULL). See also nvrtcGetPTX Parameters prog – \[in\] CUDA Runtime Compilation program. ptxSizeRet – \[out\] Size of the generated PTX (including the trailing NULL). Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_INVALID\_PROGRAM nvrtcResult nvrtcGetProgramLog(nvrtcProgram prog, char \*log) nvrtcGetProgramLog stores the log generated by the previous compilation of prog in the memory pointed by log. See also nvrtcGetProgramLogSize Parameters prog – \[in\] CUDA Runtime Compilation program. log – \[out\] Compilation log. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_INVALID\_PROGRAM nvrtcResult nvrtcGetProgramLogSize(nvrtcProgram prog, size\_t \*logSizeRet) nvrtcGetProgramLogSize sets logSizeRet with the size of the log generated by the previous compilation of prog (including the trailing NULL). Note that compilation log may be generated with warnings and informative messages, even when the compilation of prog succeeds. See also nvrtcGetProgramLog Parameters prog – \[in\] CUDA Runtime Compilation program. logSizeRet – \[out\] Size of the compilation log (including the trailing NULL). Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_INPUT NVRTC\_ERROR\_INVALID\_PROGRAM nvrtcResult nvrtcSetFlowCallback(nvrtcProgram prog, int (\*callback)(void\*, void\*), void \*payload) nvrtcSetFlowCallback registers a callback function that the compiler will invoke at different points during a call to nvrtcCompileProgram, and the callback function can decide whether to cancel compilation by returning specific values. The callback function must satisfy the following constraints: (1) Its signature should be: int callback(void\* param1, void\* param2); When invoking the callback, the compiler will always pass payload to param1 so that the callback may make decisions based on payload. It’ll always pass NULL to param2 for now which is reserved for future extensions. (2) It must return 1 to cancel compilation or 0 to continue. Other return values are reserved for future use. (3) It must return consistent values. Once it returns 1 at one point, it must return 1 in all following invocations during the current nvrtcCompileProgram call in progress. (4) It must be thread-safe. (5) It must not invoke any nvrtc/libnvvm/ptx APIs. Parameters prog – \[in\] CUDA Runtime Compilation program. callback – \[in\] the callback that issues cancellation signal. payload – \[in\] to be passed as a parameter when invoking the callback. Returns NVRTC\_SUCCESS NVRTC\_ERROR\_INVALID\_PROGRAM NVRTC\_ERROR\_INVALID\_INPUT 3.3.2. Typedefs typedef struct \_nvrtcProgram \*nvrtcProgram nvrtcProgram is the unit of compilation, and an opaque handle for a program. To compile a CUDA program string, an instance of nvrtcProgram must be created first with nvrtcCreateProgram, then compiled with nvrtcCompileProgram. 3.4. Supported Compile Options NVRTC supports the compile options below. Option names with two preceding dashs (--) are long option names and option names with one preceding dash (-) are short option names. Short option names can be used instead of long option names. When a compile option takes an argument, an assignment operator (=) is used to separate the compile option argument from the compile option name, e.g., "--gpu-architecture=compute\_100". Alternatively, the compile option name and the argument can be specified in separate strings without an assignment operator,.e.g, "--gpu-architecture" "compute\_100". Single-character short option names, such as -D, -U, and -I, do not require an assignment operator, and the compile option name and the argument can be present in the same string with or without spaces between them. For instance, "-D= ", "-D ", and "-D " are all supported. The valid compiler options are: Compilation targets --gpu-architecture= (-arch) Specify the name of the class of GPU architectures for which the input must be compiled. Valid s: compute\_75 compute\_80 compute\_86 compute\_87 compute\_89 compute\_90 compute\_90a compute\_100 compute\_100f compute\_100a compute\_101 compute\_101f compute\_101a compute\_103 compute\_103f compute\_103a compute\_120 compute\_120f compute\_120a compute\_121 compute\_121f compute\_121a sm\_75 sm\_80 sm\_86 sm\_87 sm\_89 sm\_90 sm\_90a sm\_100 sm\_100f sm\_100a sm\_101 sm\_101f sm\_101a sm\_103 sm\_103f sm\_103a sm\_120 sm\_120f sm\_120a sm\_121 sm\_121f sm\_121a Default: compute\_75 Separate compilation / whole-program compilation --device-c (-dc) Generate relocatable code that can be linked with other relocatable device code. It is equivalent to --relocatable-device-code=true. --device-w (-dw) Generate non-relocatable code. It is equivalent to --relocatable-device-code=false. --relocatable-device-code={true|false} (-rdc) Enable (disable) the generation of relocatable device code. Default: false --extensible-whole-program (-ewp) Do extensible whole program compilation of device code. Default: false Debugging support --device-debug (-G) Generate debug information. If --dopt is not specified, then turns off all optimizations. --generate-line-info (-lineinfo) Generate line-number information. Code generation --dopt on (-dopt) --dopt=on Enable device code optimization. When specified along with -G, enables limited debug information generation for optimized device code (currently, only line number information). When -G is not specified, -dopt=on is implicit. --Ofast-compile={0|min|mid|max} (-Ofc) Specify the fast-compile level for device code, which controls the tradeoff between compilation speed and runtime performance by disabling certain optimizations at varying levels. Levels: max: Focus only on the fastest compilation speed, disabling many optimizations. mid: Balance compile time and runtime, disabling expensive optimizations. min: More minimal impact on both compile time and runtime, minimizing some expensive optimizations. 0: Disable fast-compile. The option is disabled by default. --ptxas-options (-Xptxas) --ptxas-options= Specify options directly to ptxas, the PTX optimizing assembler. --maxrregcount= (-maxrregcount) Specify the maximum amount of registers that GPU functions can use. Until a function-specific limit, a higher value will generally increase the performance of individual GPU threads that execute this function. However, because thread registers are allocated from a global register pool on each GPU, a higher value of this option will also reduce the maximum thread block size, thereby reducing the amount of thread parallelism. Hence, a good maxrregcount value is the result of a trade-off. If this option is not specified, then no maximum is assumed. Value less than the minimum registers required by ABI will be bumped up by the compiler to ABI minimum limit. --ftz={true|false} (-ftz) When performing single-precision floating-point operations, flush denormal values to zero or preserve denormal values. --use\_fast\_math implies --ftz=true. Default: false --prec-sqrt={true|false} (-prec-sqrt) For single-precision floating-point square root, use IEEE round-to-nearest mode or use a faster approximation. --use\_fast\_math implies --prec-sqrt=false. Default: true --prec-div={true|false} (-prec-div) For single-precision floating-point division and reciprocals, use IEEE round-to-nearest mode or use a faster approximation. --use\_fast\_math implies --prec-div=false. Default: true --fmad={true|false} (-fmad) Enables (disables) the contraction of floating-point multiplies and adds/subtracts into floating-point multiply-add operations (FMAD, FFMA, or DFMA). --use\_fast\_math implies --fmad=true. Default: true --use\_fast\_math (-use\_fast\_math) Make use of fast math operations. --use\_fast\_math implies --ftz=true --prec-div=false --prec-sqrt=false --fmad=true. --extra-device-vectorization (-extra-device-vectorization) Enables more aggressive device code vectorization in the NVVM optimizer. --modify-stack-limit={true|false} (-modify-stack-limit) On Linux, during compilation, use setrlimit() to increase stack size to maximum allowed. The limit is reset to the previous value at the end of compilation. Note: setrlimit() changes the value for the entire process. Default: true --dlink-time-opt (-dlto) Generate intermediate code for later link-time optimization. It implies -rdc=true. Note: when this option is used the nvrtcGetLTOIR API should be used, as PTX or Cubin will not be generated. --gen-opt-lto (-gen-opt-lto) Run the optimizer passes before generating the LTO IR. --optix-ir (-optix-ir) Generate OptiX IR. The Optix IR is only intended for consumption by OptiX through appropriate APIs. This feature is not supported with link-time-optimization (-dlto). Note: when this option is used the nvrtcGetOptiX API should be used, as PTX or Cubin will not be generated. --jump-table-density=\[0-101\] (-jtd) Specify the case density percentage in switch statements, and use it as a minimal threshold to determine whether jump table(brx.idx instruction) will be used to implement a switch statement. Default value is 101. The percentage ranges from 0 to 101 inclusively. --device-stack-protector={true|false} (-device-stack-protector) Enable (disable) the generation of stack canaries in device code. Default: false --no-cache (-no-cache) Disable the use of cache for both ptx and cubin code generation. --frandom-seed (-frandom-seed) The user specified random seed will be used to replace random numbers used in generating symbol names and variable names. The option can be used to generate deterministically identical ptx and object files. If the input value is a valid number (decimal, octal, or hex), it will be used directly as the random seed. Otherwise, the CRC value of the passed string will be used instead. Preprocessing --define-macro= (-D) can be either or . Predefine as a macro with definition 1.\= The contents of are tokenized and preprocessed as if they appeared during translation phase three in a #define directive. In particular, the definition will be truncated by embedded new line characters. --undefine-macro= (-U) Cancel any previous definition of . --include-path=

(-I) Add the directory

to the list of directories to be searched for headers. These paths are searched after the list of headers given to nvrtcCreateProgram. --pre-include=