1

(Following Is NVIDIA's JIT compilation cache used when you don't use NVCC?)

NVIDIA's JIT compilation cache (which we find in ~/.nv/CompilationCache on Linux systems) has a somewhat opaque structure, with a non-textual index. I would like to be able to interact with, or manipulate, this cache:

  • Parse the index.
  • Determine if my program/kernel/PTX/etc is cached.
  • Read the cached data (e.g. as a cubin or some other way)
  • Add a new entry to the cache.

Is that possible (without reverse-engineering)?

einpoklum
  • 118,144
  • 57
  • 340
  • 684
  • I don’t understand. The driver is automagically doing all this cache magic for you without you needing to do anything. What do you hope to achieve by trying to do it yourself? – talonmies May 16 '22 at 23:50
  • @talonmies: In the linked-to question it is mentioned that, sometimes, it doesn't. – einpoklum May 17 '22 at 06:29
  • Also... I wanted to understand what the exact key is; and if I could possibly use it to cache other things (like compiled PTX). – einpoklum May 17 '22 at 14:01
  • It doesn't cache anything when it doesn't compile anything, which should hardly be a surprise. If you supply useable PTX, it compiles and caches. If you supply a compatible binary payload it runs without any compilation or caching. If you supply an incompatible binary payload without useable PTX, it fails you and get an runtime error telling you there is no way to run your payload. I am still puzzled as to which of those three scenarios you envisage a theoretical ability to inspect the cache solves... – talonmies May 17 '22 at 14:12
  • @talonmies: " If you supply useable PTX, it compiles and caches" <- When I compile CUDA C++ dynamically, it doesn't cache the compilation from PTX to SASS, although that compilation does happen (AFAICT, there's always a transition through PTX and no direct compilation to SASS). Also, knowing what the cache holds right now would tell me how much actual compilation work I'm facing later on (if I know my cache keys anyway). – einpoklum May 17 '22 at 15:38
  • 1
    “It” being the driver, not nvrtc. If the driver compiles PTX, there is always cacheing, unless you defeat it by environment settings. If you compile to SASS with nvrtc, then there is no driver compilation and no cacheing. Don’t conflate the two, they are different cases – talonmies May 17 '22 at 15:57
  • @talonmies: Ok, well, I may want to cache my NVRTC compilations in the driver's cache. – einpoklum May 17 '22 at 16:51

0 Answers0