{
  "id": "cuda/nvrtc-ptx-arch-mismatch",
  "signature": "RuntimeError: NVRTC compilation failed: error: Ptx assembly requires .target sm_52 or higher. Current target: sm_50",
  "signature_zh": "RuntimeError: NVRTC 编译失败：错误：PTX 汇编需要 .target sm_52 或更高版本。当前目标：sm_50",
  "regex": "NVRTC compilation failed.*Ptx assembly requires .target sm_52 or higher",
  "domain": "cuda",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "PTX assembly (inline or via nvrtc) requires a minimum compute capability of 5.2 (Maxwell) to support certain instructions; targeting sm_50 (Maxwell 5.0) lacks features like unified memory addressing and native atomics needed for PTX.",
  "root_cause_type": "generic",
  "root_cause_zh": "PTX 汇编（内联或通过 nvrtc）需要最低计算能力 5.2（Maxwell）才能支持某些指令；针对 sm_50（Maxwell 5.0）缺少统一内存寻址和原生原子操作等特性，这些是 PTX 所需的。",
  "versions": [
    {
      "version": "CUDA 11.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CUDA 12.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "NVRTC 11.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "NVRTC 12.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Removing PTX instructions entirely may break the kernel functionality; the error only occurs if PTX is actually used.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Setting a higher architecture like sm_86 on an older GPU (e.g., sm_50) causes a different error: 'no kernel image is available for execution on the device'.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Update the target architecture to sm_52 or higher in the NVRTC compilation options. Example: pass '-arch=sm_52' or set the environment variable CUDAARCHS to include sm_52.",
      "success_rate": 0.95,
      "how": "Update the target architecture to sm_52 or higher in the NVRTC compilation options. Example: pass '-arch=sm_52' or set the environment variable CUDAARCHS to include sm_52.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the GPU actually supports sm_52 (e.g., Tesla M40 or newer), ensure the CUDA toolkit version is >= 8.0 which added sm_52 support. If the GPU is sm_50 only (e.g., Tesla K80), replace PTX assembly with equivalent CUDA C code that compiles without PTX.",
      "success_rate": 0.85,
      "how": "If the GPU actually supports sm_52 (e.g., Tesla M40 or newer), ensure the CUDA toolkit version is >= 8.0 which added sm_52 support. If the GPU is sm_50 only (e.g., Tesla K80), replace PTX assembly with equivalent CUDA C code that compiles without PTX.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Update the target architecture to sm_52 or higher in the NVRTC compilation options. Example: pass '-arch=sm_52' or set the environment variable CUDAARCHS to include sm_52.",
    "If the GPU actually supports sm_52 (e.g., Tesla M40 or newer), ensure the CUDA toolkit version is >= 8.0 which added sm_52 support. If the GPU is sm_50 only (e.g., Tesla K80), replace PTX assembly with equivalent CUDA C code that compiles without PTX."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.nvidia.com/cuda/nvrtc/index.html#nvrtc-compilation",
  "official_doc_section": null,
  "error_code": "NVRTC_ERROR_COMPILATION (6)",
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2023-03-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}