CUDASafety-1.2ΒΆ

Do not use ASM declarations in device code

Required inputs: IR

CUDA SAFETY 1.2 [safety.inline_ptx] Do not use ASM declarations in device code

Asm declarations and extended asm declarations shall not be used in device code.

Scope: Device.
Audience: CUDA C++.
Category: Mandatory.
Hardware Applicability: All Compute Capabilities.
Rationale

PTX ASM instructions are not supported in the safety subset.

Example 1 (Bad)
__global__ void kernel() {
  asm("trap;"); // Non-compliant: use of asm declaration in device code.
}
Excerpt from NVIDIA CUDA C++ Guidelines for robust and safety-critical programming, Version 3.0.1, Copyright (C) 2018-2023 NVIDIA Corporation.

Possible Messages

Key

Text

Severity

Disabled

asm_in_device_code

Do not use ASM declarations in device code

None

False

Options