{
  "id": "cuda/cuda-error-invalid-pc",
  "signature": "CUDA error: invalid program counter (cudaErrorInvalidPc)",
  "signature_zh": "CUDA 错误：无效的程序计数器 (cudaErrorInvalidPc)",
  "regex": "CUDA error: invalid program counter",
  "domain": "cuda",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The GPU attempted to execute a kernel with an invalid program counter, typically due to a corrupted device function pointer, a miscompiled kernel, or an out-of-bounds jump in device code (e.g., from a misused function pointer or indirect call).",
  "root_cause_type": "generic",
  "root_cause_zh": "GPU 尝试执行具有无效程序计数器的内核，通常是由于损坏的设备函数指针、编译错误的内核或设备代码中的越界跳转（例如，误用函数指针或间接调用）。",
  "versions": [
    {
      "version": "CUDA 12.4",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CUDA 12.6",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "NVIDIA Driver 550.54.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "NVIDIA Driver 560.35.03",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PyTorch 2.5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The error occurs during kernel execution, not during API calls; post-hoc checks do not prevent the invalid program counter from being reached.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Scheduling policy does not affect kernel correctness; the invalid PC is a code bug, not a synchronization issue.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Compile the kernel with `-lineinfo` and run with `cuda-memcheck` or `compute-sanitizer` to identify the exact source line causing the invalid jump: `compute-sanitizer --tool memcheck ./my_app`",
      "success_rate": 0.85,
      "how": "Compile the kernel with `-lineinfo` and run with `cuda-memcheck` or `compute-sanitizer` to identify the exact source line causing the invalid jump: `compute-sanitizer --tool memcheck ./my_app`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Avoid using function pointers in device code if possible; replace them with switch statements or templates to eliminate indirect jumps.",
      "success_rate": 0.8,
      "how": "Avoid using function pointers in device code if possible; replace them with switch statements or templates to eliminate indirect jumps.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Ensure all device function pointers are initialized correctly and not left as null or garbage. For example, in CUDA C++: `typedef void (*func_t)(); func_t f = &my_device_func;`",
      "success_rate": 0.75,
      "how": "Ensure all device function pointers are initialized correctly and not left as null or garbage. For example, in CUDA C++: `typedef void (*func_t)(); func_t f = &my_device_func;`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Compile the kernel with `-lineinfo` and run with `cuda-memcheck` or `compute-sanitizer` to identify the exact source line causing the invalid jump: `compute-sanitizer --tool memcheck ./my_app`",
    "Avoid using function pointers in device code if possible; replace them with switch statements or templates to eliminate indirect jumps.",
    "Ensure all device function pointers are initialized correctly and not left as null or garbage. For example, in CUDA C++: `typedef void (*func_t)(); func_t f = &my_device_func;`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html",
  "official_doc_section": null,
  "error_code": "cudaErrorInvalidPc (805)",
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.75,
  "resolvable": "partial",
  "first_seen": "2025-04-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}