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

210 views Asked by At

I'm profiling a kernel compiled (with debug and lineinfo) using the nvrtc library. In the profiling results, many of the samples are listed as being within __nv_nvrtc_builtin_header.h. However - there is obviously no such file on disk, and naturally (?) the NVIDIA Compute source view can't locate it.

My questions:

  • What is actually in the __nv_nvrtc_builtin_header.h?
  • Is it possible for me to view the contents of this mysterious header? (If it helps, assume the code I use to perform the compilation can be adapted/added to.)
2

There are 2 answers

5
talonmies On BEST ANSWER

What is actually in the __nv_nvrtc_builtin_header.h?

All the standard definitions you would otherwise get in the standard CUDA includes and internal toolchain/host compiler headers the toolchain automagically includes during compilation. Just all assembled into one huge file.

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

The header is contained within the the nvrtc-builtins library, and you should be able to use the requisite library dump utility on your platform to view it. for example:

$ 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

(probable EULA violations if I show more...)

0
einpoklum On

Adding to @talonmies answer:

If you remove the objdump header lines, you can pass the actual dump lines through xxd -r to get the __nv_nvrtc_builtin_header.h text proper:

$ objdump -s --section=.rodata /usr/local/cuda/lib64/libnvrtc-builtins.so | tail --lines=+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

(the last sed removes some junk at the beginning of the 6th line - as for CUDA 11.6)