Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a frontend flag to disable CUDA cross-target call checks
For CUDA source, Sema checks that the targets of call expressions make sense (e.g. a host function can't call a device function). Adding a flag that lets us skip this check. Motivation: for source-to-source translation tools that have to accept code that's not strictly kosher CUDA but is still accepted by nvcc. The source-to-source translation tool can then fix the code and leave calls that are semantically valid for the actual compilation stage. Differential Revision: http://reviews.llvm.org/D9036 llvm-svn: 235049
- Loading branch information
Showing
5 changed files
with
38 additions
and
0 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
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
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,26 @@ | ||
// Test that we can disable cross-target call checks in Sema with the | ||
// -fcuda-disable-target-call-checks flag. Without this flag we'd get a bunch | ||
// of errors here, since there are invalid cross-target calls present. | ||
|
||
// RUN: %clang_cc1 -fsyntax-only -verify %s -fcuda-disable-target-call-checks | ||
// RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -verify %s -fcuda-disable-target-call-checks | ||
|
||
// expected-no-diagnostics | ||
|
||
#define __device__ __attribute__((device)) | ||
#define __global__ __attribute__((global)) | ||
#define __host__ __attribute__((host)) | ||
|
||
__attribute__((host)) void h1(); | ||
|
||
__attribute__((device)) void d1() { | ||
h1(); | ||
} | ||
|
||
__attribute__((host)) void h2() { | ||
d1(); | ||
} | ||
|
||
__attribute__((global)) void g1() { | ||
h2(); | ||
} |