This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Use all 64 bits of GUID in __nv_module_id
ClosedPublic

Authored by tra on Oct 5 2018, 10:44 AM.

Details

Summary

getGUID() returns an uint64_t and "%x" only prints 32 bits of it.
Use PRIx64 format string to print all 64 bits.

Diff Detail

Repository
rL LLVM

Event Timeline

tra created this revision.Oct 5 2018, 10:44 AM
Hahnfeld accepted this revision.Oct 5 2018, 11:06 AM

LG.

Out of interest: Is this fixing a particular issue?

This revision is now accepted and ready to land.Oct 5 2018, 11:06 AM
tra added a comment.Oct 5 2018, 11:40 AM

This particular change is largely cosmetic. I've just spotted this nit while I was debugging a different problem.

It's also related to module ID.

We're trying to compile NCCL 2.3 with -fcuda-rdc and we were getting duplicate symbols when we tried to link multiple object files compiled from the same source file.
E.g.

clang++ -DPART1 -o foo-1.o  foo.cu
clang++ -DPART2 -o foo-2.o  foo.cu
...
nvlink ....

The stubs generated by nvlink ended up with conflicting names (based on module ID) that were identical for all foo-*.o.

It appears that clang generates ID based on the source file name only, so all foo-*.o end up with identical ID.
NVCC, on the other hand, appears to generate ID based on some other factors (compiler flags? preprocessed TU source?) so each object file gets a unique ID.

For now we've worked around this by renaming the source files before compilation of each part, but we will need to find a better solution.

This revision was automatically updated to reflect the committed changes.