我可以获取用作 __nv_nvrtc_builtin_header.h 的内容吗?

Can I obtain what's used as __nv_nvrtc_builtin_header.h?

我正在分析一个使用 nvrtc 库编译的内核(使用调试和 lineinfo)。在分析结果中,许多样本都列在 __nv_nvrtc_builtin_header.h 之内。但是 - 磁盘上显然没有这样的文件,自然 (?) NVIDIA Compute 源视图无法找到它。

我的问题:

What is actually in the __nv_nvrtc_builtin_header.h?

您将在标准 CUDA 中获得的所有标准定义包括和内部 toolchain/host 编译器 header 工具链在编译期间自动包含。全部组装成一个巨大的文件。

Is it possible for me to view the contents of this mysterious header?

header 包含在 nvrtc-builtins 库中,您应该能够在您的平台上使用必要的库转储实用程序来查看它。例如:

$ objdump -s libnvrtc-builtins.so

  [snipped for brevity]

Contents of section .rodata:
 0007a0 2f2a0a20 2a20436f 70797269 67687420  /*. * Copyright
 0007b0 31393933 2d323031 36204e56 49444941  1993-2016 NVIDIA
 0007c0 20436f72 706f7261 74696f6e 2e202041   Corporation.  A
 0007d0 6c6c2072 69676874 73207265 73657276  ll rights reserv
 0007e0 65642e0a 202a0a20 2a204e4f 54494345  ed.. *. * NOTICE
 0007f0 20544f20 4c494345 4e534545 3a0a202a   TO LICENSEE:. *
 000800 0a202a20 54686973 20736f75 72636520  . * This source
 000810 636f6465 20616e64 2f6f7220 646f6375  code and/or docu
 000820 6d656e74 6174696f 6e202822 4c696365  mentation ("Lice
 000830 6e736564 2044656c 69766572 61626c65  nsed Deliverable
 000840 73222920 6172650a 202a2073 75626a65  s") are. * subje
 000850 63742074 6f204e56 49444941 20696e74  ct to NVIDIA int
 000860 656c6c65 63747561 6c207072 6f706572  ellectual proper
 000870 74792072 69676874 7320756e 64657220  ty rights under
 000880 552e532e 20616e64 0a202a20 696e7465  U.S. and. * inte
 000890 726e6174 696f6e61 6c20436f 70797269  rnational Copyri
 0008a0 67687420 6c617773 2e0a202a 0a202a20  ght laws.. *. *
 0008b0 54686573 65204c69 63656e73 65642044  These Licensed D
 0008c0 656c6976 65726162 6c657320 636f6e74  eliverables cont

(如果我显示更多信息,则可能违反 EULA...)

添加到@talonmies answer:

如果删除 objdump header 行,您可以通过 xxd -r 传递实际的转储行以获得正确的 __nv_nvrtc_builtin_header.h 文本:

$ objdump -s --section=.rodata /usr/local/cuda/lib64/libnvrtc-builtins.so | tail +5 | xxd -r | sed -r '1s/^.*\//\//;' | less

/*
 * Copyright 1993-2016 NVIDIA Corporation.  All rights reserved.
 *
 * NOTICE TO LICENSEE:
 *
 * This source code and/or documentation ("Licensed Deliverables") are
 * subject to NVIDIA intellectual property rights under U.S. and
 * international Copyright laws.
 *
 * These Licensed Deliverables contained herein is PROPRIETARY and
 * CONFIDENTIAL to NVIDIA and is being provided under the terms and

(最后一个 sed 删除了第 6 行开头的一些垃圾 - 对于 CUDA 11.6)