This is an archive of the discontinued LLVM Phabricator instance.

[Libomptarget][CUDA] Check CUDA compatibilty correctly
ClosedPublic

Authored by jhuber6 on Aug 10 2022, 6:59 AM.

Details

Summary

We recently added support for multi-architecture binaries in
libomptarget. This is done by extracting the architecture from the
embedded image and comparing it with the major and minor version
supported by the current CUDA installation. Previously we just compared
these directly, which was not correct for binary compatibility. The CUDA
documentation states that we can consider any image with an equivalent
major or a greater or equal to minor compatible with the current image.
Change the check to use this new logic in the CUDA plugin.

Fixes #57049

Diff Detail

Event Timeline

jhuber6 created this revision.Aug 10 2022, 6:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2022, 6:59 AM
jhuber6 requested review of this revision.Aug 10 2022, 6:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2022, 6:59 AM
This revision is now accepted and ready to land.Aug 10 2022, 7:13 AM

a.out: /home/yeluo/opt/llvm-clang/llvm-project/llvm/include/llvm/ADT/StringRef.h:223: char llvm::StringRef::operator[](size_t) const: Assertion `Index < Length && "Invalid index!"' failed.
Aborted (core dumped)

a.out: /home/yeluo/opt/llvm-clang/llvm-project/llvm/include/llvm/ADT/StringRef.h:223: char llvm::StringRef::operator[](size_t) const: Assertion `Index < Length && "Invalid index!"' failed.
Aborted (core dumped)

Interesting, probably just messed up the string handling.

jhuber6 updated this revision to Diff 451457.Aug 10 2022, 7:44 AM

Fix index error, sizeof("x") is actually +1 because I forgot about the null byte.

ye-luo accepted this revision.Aug 10 2022, 7:53 AM

Pass my tests now.

This revision was automatically updated to reflect the committed changes.