What's the unique id of a Cubin (cuda binary)

101 Views Asked by At

For common elf binaries, one could use readelf -n <binary file> to get the unique build id as follows:

$ readelf -n matrix

Displaying notes found in: .note.gnu.build-id
  Owner                Data size    Description
  GNU                  0x00000014   NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: 30935f4bf2ea2d76a53538b28ed7ffbc51437e3c

Displaying notes found in: .note.ABI-tag
  Owner                Data size    Description
  GNU                  0x00000010   NT_GNU_ABI_TAG (ABI version tag)
    OS: Linux, ABI: 3.2.0

yet for cuda binaries, aka cubin, readelf -n does not work. So how to get the unique id of a cubin? Or what's the unique id of a cubin?

1

There are 1 best solutions below

2
On BEST ANSWER

For common elf binaries, one could use readelf -n to get the unique build id

That isn't strictly true. What you are referring to as the "build id" is the .note.gnu.build-id section of the elf header, which is populated by a specific feature of the gnu linker ld and (when enabled) creates some identifying bits for that notes field from the contents of the elf section. The resulting ID value isn't unique, in that two files containing identical code will hash to the same ID, as far as I am aware. If you use another linker, that field isn't populated (the LLD linker clang uses certainly didn't, last time I checked)

So how to get the unique id of a cubin? Or what's the unique id of a cubin?

There isn't one. The NVIDIA elf headers don't contain a .notes section and the resulting elf files are not linked with the GNU linker, they are linked with nvlink and that doesn't have the same ID functionality, to the best of my knowledge.