Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IRLinker] Suppress linker warnings when linking with CUDA libdevice.
libdevice bitcode provided by NVIDIA is linked with clang/LLVM-generated IR which uses nvptx*-nvidia-cuda triple. We need to mark them as compatible. Differential Revision: https://reviews.llvm.org/D108835
- Loading branch information
Showing
6 changed files
with
78 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
target triple = "nvptx64-nvidia-gpulibs" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64" | ||
target triple = "nvptx64-nvidia-gpulibs" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
target triple = "nvptx-unknown-unknown" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
target triple = "nvptx64-nvidia-nosuchthing" | ||
target datalayout = "e-i64:64-i128:128-v32:32-n16:32:64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
; Prepare bitcode files. | ||
; RUN: rm -rf %t && mkdir -p %t | ||
; RUN: llvm-as %s -o %t/main.bc | ||
; RUN: llvm-as %p/Inputs/libdevice-cuda-9.ll -o %t/libdevice.compute_35.10.bc | ||
; RUN: llvm-as %p/Inputs/libdevice-cuda-10.ll -o %t/libdevice.10.bc | ||
; RUN: llvm-as %p/Inputs/libdevice-cuda-11.ll -o %t/libdevice.11.10.bc | ||
; RUN: llvm-as %p/Inputs/libdevice-cuda-9.ll -o %t/correct-libdevice-wrong-filename.bc | ||
; RUN: llvm-as %p/Inputs/not-a-libdevice.ll -o %t/libdevice-with-wrong-info.bc | ||
|
||
; No warnings expected when we link with libdevice variants | ||
; RUN: llvm-link %t/main.bc %t/libdevice.compute_35.10.bc -S 2>&1 \ | ||
; RUN: | FileCheck --check-prefixes COMMON,NOWARN %s | ||
; RUN: llvm-link %t/main.bc %t/libdevice.10.bc -S 2>&1 \ | ||
; RUN: | FileCheck --check-prefixes COMMON,NOWARN %s | ||
; RUN: llvm-link %t/main.bc %t/libdevice.11.10.bc -S 2>&1 \ | ||
; RUN: | FileCheck --check-prefixes COMMON,NOWARN %s | ||
|
||
; But make sure we still issue warnings if we see unexpected filename, or | ||
; unexpected triple or datalayout within a libdevice filename. | ||
; RUN: llvm-link %t/main.bc %t/correct-libdevice-wrong-filename.bc -S 2>&1 \ | ||
; RUN: | FileCheck --check-prefixes COMMON,WARN-TRIPLE %s | ||
; RUN: llvm-link %t/main.bc %t/libdevice-with-wrong-info.bc -S 2>&1 \ | ||
; RUN: | FileCheck --check-prefixes COMMON,WARN-TRIPLE,WARN-DL %s | ||
|
||
|
||
target triple = "nvptx64-nvidia-cuda" | ||
target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64" | ||
|
||
; WARN-TRIPLE-DAG: warning: Linking two modules of different target triples: | ||
; WARN-DL-DAG: warning: Linking two modules of different data layouts: | ||
|
||
; NOWARN-NOT: warning: | ||
; COMMON-DAG: target triple = "nvptx64-nvidia-cuda" | ||
; NOWARN-NOT: warning: |