Page MenuHomePhabricator

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

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

Details

Summary

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

Repository
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/dependent-libs.cu (3052 of 14933)
******************** TEST 'Clang :: CodeGenCUDA/dependent-libs.cu' FAILED ********************
Script:
--
: '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/dependent-libs.cu | /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/dependent-libs.cu
: '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/dependent-libs.cu | /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/dependent-libs.cu
--
Exit Code: 1

Command Output (stderr):
--
/b/s/w/ir/k/llvm-project/clang/test/CodeGenCUDA/dependent-libs.cu:5:10: 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/dependent-libs.cu'
^
<stdin>:1:58: note: possible intended match here
; ModuleID = '/b/s/w/ir/k/llvm-project/clang/test/CodeGenCUDA/dependent-libs.cu'
                                                         ^

--

The full test log is here: https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket.appspot.com/8912171419117598448/+/steps/clang/0/steps/test/0/stdout