1

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.)
einpoklum
  • 118,144
  • 57
  • 340
  • 684

2 Answers2

3

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...)

einpoklum
  • 118,144
  • 57
  • 340
  • 684
talonmies
  • 70,661
  • 34
  • 192
  • 269
  • You asked "assuming I can instrument the compilation process to my liking" . That can't be done. There is no way to get the compiler to dump the header as part of the JIT process AFAIK – talonmies Sep 01 '20 at 12:13
  • Edited my question and your answer to clarify what I meant. – einpoklum Sep 01 '20 at 12:15
  • 1
    1. You can revert the answer to anything else you like; edits are always just suggestions. 2. Yes, this is common practice and actually encouraged if memory serves, because now the question and answer better serve others. The idea is that SO is a body of Q&As which is perfected via edits and additional answers. 3. I just cut out a few words from the beginning of your sentence, it's not like you're "saying" something you didn't say before. – einpoklum Sep 01 '20 at 12:18
  • You changed the question enough that the gist of the answer changes from "no...." to "yes...". All because you didn't think enough about the question you asked in the first place. That is my objection. – talonmies Sep 02 '20 at 09:38
  • The only change was in the phrasing of the "assuming I can instrument etc." - and my change was clarifying what I meant by that. I meant I can change the code on "my side", not the CUDA side, i.e. that I have complete control of the code making CUDA NVRTC calls and can put things in there that might help me. – einpoklum Sep 02 '20 at 10:58
0

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)

einpoklum
  • 118,144
  • 57
  • 340
  • 684