Page MenuHomePhabricator

[CUDA][HIP] Emit dependent libs for host only

Authored by yaxunl on May 27 2019, 5:17 AM.



Recently D60274 was introduced to allow lld to handle dependent libs. However current
usage of dependent libs (e.g. pragma comment(lib, *) in windows header files) are intended
for host only. Emitting the metadata in device IR causes link error in device path.

Until there is a way to different it dependent libs for device or host, metadata for dependent
libs should be emitted for host only. This patch enforces that.

Diff Detail

rC Clang

Event Timeline

yaxunl created this revision.May 27 2019, 5:17 AM
tra accepted this revision.May 28 2019, 9:59 AM
This revision is now accepted and ready to land.May 28 2019, 9:59 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 28 2019, 2:17 PM
phosek added a subscriber: phosek.May 28 2019, 6:52 PM

This seems to be failing on macOS bots with the following error:

FAIL: Clang :: CodeGenCUDA/ (3052 of 14933)
******************** TEST 'Clang :: CodeGenCUDA/' FAILED ********************
: 'RUN: at line 1';   /b/s/w/ir/k/recipe_cleanup/clangAoYUvt/llvm_build_dir/bin/clang -cc1 -internal-isystem /b/s/w/ir/k/recipe_cleanup/clangAoYUvt/llvm_build_dir/lib/clang/9.0.0/include -nostdsysteminc -emit-llvm -o - -fcuda-is-device -x hip /b/s/w/ir/k/llvm-project/clang/test/CodeGenCUDA/ | /b/s/w/ir/k/recipe_cleanup/clangAoYUvt/llvm_build_dir/bin/FileCheck --check-prefix=DEV /b/s/w/ir/k/llvm-project/clang/test/CodeGenCUDA/
: 'RUN: at line 2';   /b/s/w/ir/k/recipe_cleanup/clangAoYUvt/llvm_build_dir/bin/clang -cc1 -internal-isystem /b/s/w/ir/k/recipe_cleanup/clangAoYUvt/llvm_build_dir/lib/clang/9.0.0/include -nostdsysteminc -emit-llvm -o - -x hip /b/s/w/ir/k/llvm-project/clang/test/CodeGenCUDA/ | /b/s/w/ir/k/recipe_cleanup/clangAoYUvt/llvm_build_dir/bin/FileCheck --check-prefix=HOST /b/s/w/ir/k/llvm-project/clang/test/CodeGenCUDA/
Exit Code: 1

Command Output (stderr):
/b/s/w/ir/k/llvm-project/clang/test/CodeGenCUDA/ error: HOST: expected string not found in input
// HOST: llvm.dependent-libraries
<stdin>:1:1: note: scanning from here
; ModuleID = '/b/s/w/ir/k/llvm-project/clang/test/CodeGenCUDA/'
<stdin>:1:58: note: possible intended match here
; ModuleID = '/b/s/w/ir/k/llvm-project/clang/test/CodeGenCUDA/'


The full test log is here: