Nvidia PTX Options (Using the GNU Compiler Collection (GCC))

#### 3.20.35 Nvidia PTX Options ¶

These options are defined for Nvidia PTX:

`-m64` ¶

  Ignored, but preserved for backward compatibility. Only 64-bit ABI is supported.

`-march=architecture-string` ¶

  Generate code for the specified PTX ISA target architecture. Valid architecture strings are ‘`sm_30`’, ‘`sm_35`’, ‘`sm_37`’, ‘`sm_50`’, ‘`sm_52`’, ‘`sm_53`’, ‘`sm_61`’, ‘`sm_70`’, ‘`sm_75`’, ‘`sm_80`’, and ‘`sm_89`’. The default depends on how the compiler has been configured, see `--with-arch`.

  This option sets the value of the preprocessor macro `__PTX_SM__`; for instance, for ‘`sm_35`’, it has the value ‘`350`’.

`-misa=architecture-string` ¶

  Alias of `-march=`.

`-march-map=architecture-string` ¶

  Select the closest available `-march=` value that is not more capable. For instance, for `-march-map=sm_50` select `-march=sm_37`, and for `-march-map=sm_53` select `-march=sm_53`.

`-mptx=version-string` ¶

  Generate code for the specified PTX ISA version. Valid version strings are ‘`3.1`’, ‘`4.0`’, ‘`4.1`’, ‘`4.2`’, ‘`5.0`’, ‘`6.0`’, ‘`6.3`’, ‘`7.0`’, ‘`7.3`’, and ‘`7.8`’. The default PTX ISA version is the one that added support for the selected PTX ISA target architecture, see `-march=`, but at least ‘`6.3`’, or ‘`7.3`’ for `-march=sm_52` and higher.

  This option sets the values of the preprocessor macros `__PTX_ISA_VERSION_MAJOR__` and `__PTX_ISA_VERSION_MINOR__`; for instance, for ‘`3.1`’ the macros have the values ‘`3`’ and ‘`1`’, respectively.

`-mmainkernel` ¶

  Link in code for a __main kernel. This is for stand-alone instead of offloading execution.

`-moptimize` ¶
`-mno-optimize`

  Enable/disable partitioned execution optimizations. This option is enabled by default when any level of optimization is selected.

`-msoft-stack` ¶
`-mno-soft-stack`

  For `-mno-soft-stack` (the default, unless `-mgomp` has been specified), use PTX “native” stacks, that is, generate code that uses `.local` memory or PTX `alloca` directly for stack storage. Unless `-mptx=7.3` or higher and `-march=sm_52` or higher are active, variable-length arrays and dynamically allocating memory on the stack with `alloca` are not supported.

  For `-msoft-stack` (implied by `-mgomp`), generate code that does not use `.local` memory or PTX `alloca` directly for stack storage. Instead, a per-warp stack pointer is maintained explicitly. This enables variable-length stack allocation (with variable-length arrays or `alloca`), and when global memory is used for underlying storage, makes it possible to access automatic variables from other threads, or with atomic instructions. This code generation variant is used for OpenMP offloading, but the option is exposed on its own for the purpose of testing the compiler; to generate code suitable for linking into programs using OpenMP offloading, use option `-mgomp`.

`-msoft-stack-reserve-local=size` ¶

  Specify the size of `.local` memory used for the stack when the exact amount is not known. It defaults to 128.

`-muniform-simt` ¶
`-mno-uniform-simt`

  Enable/disable code generation variant that allows execution of all threads in each warp, while maintaining memory state and side effects as if only one thread in each warp was active outside of OpenMP SIMD regions. All atomic operations and calls to runtime (`malloc`, `free`, `vprintf`) are conditionally executed (iff current lane index equals the master lane index), and the register being assigned is copied via a shuffle instruction from the master lane. Outside of SIMD regions lane 0 is the master; inside, each thread sees itself as the master. Shared memory array `int __nvptx_uni[]` stores all-zeros or all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD regions). Each thread can bitwise-and the bitmask at position `tid.y` with current lane index to compute the master lane index.

`-mgomp` ¶
`-mno-gomp`

  Enable/disable generation of code for use in OpenMP offloading. `-mgomp` enables `-msoft-stack` and `-muniform-simt` options, and selects a corresponding multilib variant.