Skip to content

Commit 737028d

Browse files
committed
Merge remote-tracking branch 'upstream/sycl' into sycl
2 parents 682c64c + 6314bef commit 737028d

File tree

1,490 files changed

+54307
-19965
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,490 files changed

+54307
-19965
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Linux Post Commit Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- sycl
7+
jobs:
8+
check:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
config: ["Default", "SharedLibs", "Assertions"]
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
path: src
19+
- name: Install Ubuntu deps
20+
run: sudo apt install -y ninja-build
21+
- name: Configure
22+
run: |
23+
CONFIG=${{ matrix.config }}
24+
case $CONFIG in
25+
Default)
26+
export ARGS=""
27+
;;
28+
SharedLibs)
29+
export ARGS="--shared-libs"
30+
;;
31+
Assertiosn)
32+
export ARGS="--assertions"
33+
;;
34+
esac
35+
mkdir -p $GITHUB_WORKSPACE/build
36+
cd $GITHUB_WORKSPACE/build
37+
python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \
38+
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t Release --no-ocl $ARGS
39+
- name: Compile
40+
run: |
41+
python3 $GITHUB_WORKSPACE/src/buildbot/compile.py -w $GITHUB_WORKSPACE \
42+
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build
43+
- name: check-llvm
44+
if: always()
45+
run: |
46+
python3 $GITHUB_WORKSPACE/src/buildbot/check.py -w $GITHUB_WORKSPACE \
47+
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t check-llvm
48+
- name: check-clang
49+
if: always()
50+
run: |
51+
python3 $GITHUB_WORKSPACE/src/buildbot/check.py -w $GITHUB_WORKSPACE \
52+
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t check-clang
53+
- name: check-sycl
54+
if: always()
55+
run: |
56+
python3 $GITHUB_WORKSPACE/src/buildbot/check.py -w $GITHUB_WORKSPACE \
57+
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t check-sycl
58+
- name: check-llvm-spirv
59+
if: always()
60+
run: |
61+
python3 $GITHUB_WORKSPACE/src/buildbot/check.py -w $GITHUB_WORKSPACE \
62+
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t check-llvm-spirv
63+
- name: Pack
64+
run: tar -czvf llvm_sycl.tar.gz -C $GITHUB_WORKSPACE/build/install .
65+
- name: Upload artifacts
66+
uses: actions/upload-artifact@v1
67+
with:
68+
name: sycl_linux_${{ matrix.config }}
69+
path: llvm_sycl.tar.gz
70+

CONTRIBUTING.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Contributing
22

33
## License
4-
Intel Project for LLVM* technology is licensed under the terms of the
4+
Intel Project for LLVM\* technology is licensed under the terms of the
55
Apache-2.0 with LLVM-exception license ([LICENSE.txt](llvm/LICENSE.TXT))
66
to ensure our ability to contribute this project to the LLVM project
77
under the same license.
@@ -70,11 +70,11 @@ commit automatically with `git commit -s`.
7070
### Development
7171

7272
- Create a personal fork of the project on GitHub
73-
- Use **sycl** branch as baseline for your changes
73+
- For the DPC++ Compiler project, use **sycl** branch as baseline for your
74+
changes. See [Get Started Guide](sycl/doc/GetStartedGuide.md).
7475
- Prepare your patch (follow
7576
[LLVM coding standards](https://llvm.org/docs/CodingStandards.html))
76-
- Build the project and run all tests (see
77-
[GetStartedWithSYCLCompiler.md](sycl/doc/GetStartedWithSYCLCompiler.md))
77+
- Build the project and run all tests
7878

7979
### Review and acceptance testing
8080

@@ -94,4 +94,8 @@ Project maintainers merge pull requests using one of the following options:
9494
- [Squash and merge] Used when there are multiple commits in the PR
9595
- Squashing is done to make sure that the project is buildable on any commit
9696
- [Create a merge commit] Used for LLVM pull-down PRs to preserve hashes of the
97-
commits pulled from the LLVM community repository
97+
commits pulled from the LLVM community repository
98+
99+
100+
*Other names and brands may be claimed as the property of others.
101+

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
# Intel Project for LLVM* technology
1+
# Intel Project for LLVM\* technology
22

33
## Introduction
44

55
Intel staging area for llvm.org contribution.
66
Home for Intel LLVM-based projects:
7-
- SYCL* Compiler and Runtimes - compiler and runtime libraries for SYCL ([https://www.khronos.org/sycl/](https://www.khronos.org/sycl/)). See **sycl** branch.
7+
- oneAPI Data Parallel C++ compiler - see **sycl** branch. More information on
8+
oneAPI and DPC++ is available at
9+
([https://www.oneapi.com/](https://www.oneapi.com/))
810

911
## License
1012
See [LICENSE.txt](sycl/LICENSE.TXT) for details.
1113

12-
1314
## Contributing
1415
See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
1516

1617
## Sub-projects Documentation
17-
- SYCL Compiler and Runtimes - See [GetStartedWithSYCLCompiler.md](sycl/doc/GetStartedWithSYCLCompiler.md)
18+
- oneAPI Data Parallel C++ compiler - See
19+
[GetStartedGuide.md](sycl/doc/GetStartedGuide.md)
1820

19-
*Other names and brands may be claimed as the property of others.
21+
## DPC++ extensions
2022

21-
## SYCL Extension Proposal Documents
23+
DPC++ is an open, cross-architecture language built upon the ISO C++ and Khronos
24+
SYCL\* standards. DPC++ extends these standards with a number of extensions,
25+
which can be found in [sycl/doc/extensions](sycl/doc/extensions) directory.
2226

23-
See [sycl/doc/extensions](sycl/doc/extensions)
27+
\*Other names and brands may be claimed as the property of others.
2428

buildbot/configure.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ def do_configure(args):
1010
llvm_dir = os.path.join(args.src_dir, "llvm")
1111
sycl_dir = os.path.join(args.src_dir, "sycl")
1212
spirv_dir = os.path.join(args.src_dir, "llvm-spirv")
13+
xpti_dir = os.path.join(args.src_dir, "xpti")
1314
ocl_header_dir = os.path.join(args.obj_dir, "OpenCL-Headers")
1415
icd_loader_lib = os.path.join(args.obj_dir, "OpenCL-ICD-Loader", "build")
1516
llvm_targets_to_build = 'X86'
16-
llvm_enable_projects = 'clang;llvm-spirv;sycl;opencl-aot'
17+
llvm_enable_projects = 'clang;llvm-spirv;sycl;opencl-aot;xpti'
1718
libclc_targets_to_build = ''
1819
sycl_build_pi_cuda = 'OFF'
1920
llvm_enable_assertions = 'ON'
2021
llvm_enable_doxygen = 'OFF'
22+
llvm_build_shared_libs = 'OFF'
2123

2224
if platform.system() == 'Linux':
2325
icd_loader_lib = os.path.join(icd_loader_lib, "libOpenCL.so")
@@ -36,6 +38,9 @@ def do_configure(args):
3638
if args.docs:
3739
llvm_enable_doxygen = 'ON'
3840

41+
if args.shared_libs:
42+
llvm_build_shared_libs = 'ON'
43+
3944
install_dir = os.path.join(args.obj_dir, "install")
4045

4146
cmake_cmd = [
@@ -44,9 +49,10 @@ def do_configure(args):
4449
"-DCMAKE_BUILD_TYPE={}".format(args.build_type),
4550
"-DLLVM_ENABLE_ASSERTIONS={}".format(llvm_enable_assertions),
4651
"-DLLVM_TARGETS_TO_BUILD={}".format(llvm_targets_to_build),
47-
"-DLLVM_EXTERNAL_PROJECTS=sycl;llvm-spirv;opencl-aot",
52+
"-DLLVM_EXTERNAL_PROJECTS=sycl;llvm-spirv;opencl-aot;xpti",
4853
"-DLLVM_EXTERNAL_SYCL_SOURCE_DIR={}".format(sycl_dir),
4954
"-DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR={}".format(spirv_dir),
55+
"-DLLVM_EXTERNAL_XPTI_SOURCE_DIR={}".format(xpti_dir),
5056
"-DLLVM_ENABLE_PROJECTS={}".format(llvm_enable_projects),
5157
"-DLIBCLC_TARGETS_TO_BUILD={}".format(libclc_targets_to_build),
5258
"-DOpenCL_INCLUDE_DIR={}".format(ocl_header_dir),
@@ -57,9 +63,16 @@ def do_configure(args):
5763
"-DCMAKE_INSTALL_PREFIX={}".format(install_dir),
5864
"-DSYCL_INCLUDE_TESTS=ON", # Explicitly include all kinds of SYCL tests.
5965
"-DLLVM_ENABLE_DOXYGEN={}".format(llvm_enable_doxygen),
66+
"-DBUILD_SHARED_LIBS={}".format(llvm_build_shared_libs),
67+
"-DSYCL_ENABLE_XPTI_TRACING=ON", # Explicitly turn on XPTI tracing
6068
llvm_dir
6169
]
6270

71+
if not args.no_ocl:
72+
cmake_cmd.extend([
73+
"-DOpenCL_INCLUDE_DIR={}".format(ocl_header_dir),
74+
"-DOpenCL_LIBRARY={}".format(icd_loader_lib)])
75+
6376
print(cmake_cmd)
6477

6578
try:
@@ -90,6 +103,8 @@ def main():
90103
parser.add_argument("--cuda", action='store_true', help="switch from OpenCL to CUDA")
91104
parser.add_argument("--assertions", action='store_true', help="build with assertions")
92105
parser.add_argument("--docs", action='store_true', help="build Doxygen documentation")
106+
parser.add_argument("--no-ocl", action='store_true', help="download OpenCL deps via CMake")
107+
parser.add_argument("--shared-libs", action='store_true', help="Build shared libraries")
93108

94109
args = parser.parse_args()
95110

clang-tools-extra/clang-tidy/ClangTidy.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
409409
}
410410

411411
for (auto &Check : Checks) {
412+
if (!Check->isLanguageVersionSupported(Context.getLangOpts()))
413+
continue;
412414
Check->registerMatchers(&*Finder);
413415
Check->registerPPCallbacks(*SM, PP, ModuleExpanderPP);
414416
}

clang-tools-extra/clang-tidy/ClangTidyCheck.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,24 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
5353
/// constructor using the Options.get() methods below.
5454
ClangTidyCheck(StringRef CheckName, ClangTidyContext *Context);
5555

56+
/// Override this to disable registering matchers and PP callbacks if an
57+
/// invalid language version is being used.
58+
///
59+
/// For example if a check is examining overloaded functions then this should
60+
/// be overridden to return false when the CPlusPlus flag is not set in
61+
/// \p LangOpts.
62+
virtual bool isLanguageVersionSupported(const LangOptions &LangOpts) const {
63+
return true;
64+
}
65+
5666
/// Override this to register ``PPCallbacks`` in the preprocessor.
5767
///
5868
/// This should be used for clang-tidy checks that analyze preprocessor-
5969
/// dependent properties, e.g. include directives and macro definitions.
6070
///
71+
/// This will only be executed if the function isLanguageVersionSupported
72+
/// returns true.
73+
///
6174
/// There are two Preprocessors to choose from that differ in how they handle
6275
/// modular #includes:
6376
/// - PP is the real Preprocessor. It doesn't walk into modular #includes and
@@ -80,6 +93,9 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
8093
/// "this" will be used as callback, but you can also specify other callback
8194
/// classes. Thereby, different matchers can trigger different callbacks.
8295
///
96+
/// This will only be executed if the function isLanguageVersionSupported
97+
/// returns true.
98+
///
8399
/// If you need to merge information between the different matchers, you can
84100
/// store these as members of the derived class. However, note that all
85101
/// matches occur in the order of the AST traversal.

clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ void NoRecursionCheck::check(const MatchFinder::MatchResult &Result) {
264264
for (llvm::scc_iterator<CallGraph *> SCCI = llvm::scc_begin(&CG),
265265
SCCE = llvm::scc_end(&CG);
266266
SCCI != SCCE; ++SCCI) {
267-
if (!SCCI.hasLoop()) // We only care about cycles, not standalone nodes.
267+
if (!SCCI.hasCycle()) // We only care about cycles, not standalone nodes.
268268
continue;
269269
handleSCC(*SCCI);
270270
}

clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,12 @@ bool MakeSmartPtrCheck::isLanguageVersionSupported(
6868
void MakeSmartPtrCheck::registerPPCallbacks(const SourceManager &SM,
6969
Preprocessor *PP,
7070
Preprocessor *ModuleExpanderPP) {
71-
if (isLanguageVersionSupported(getLangOpts())) {
7271
Inserter = std::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
7372
IncludeStyle);
7473
PP->addPPCallbacks(Inserter->CreatePPCallbacks());
75-
}
7674
}
7775

7876
void MakeSmartPtrCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
79-
if (!isLanguageVersionSupported(getLangOpts()))
80-
return;
81-
8277
// Calling make_smart_ptr from within a member function of a type with a
8378
// private or protected constructor would be ill-formed.
8479
auto CanCallCtor = unless(has(ignoringImpCasts(

clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class MakeSmartPtrCheck : public ClangTidyCheck {
4141
virtual SmartPtrTypeMatcher getSmartPointerTypeMatcher() const = 0;
4242

4343
/// Returns whether the C++ version is compatible with current check.
44-
virtual bool isLanguageVersionSupported(const LangOptions &LangOpts) const;
44+
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override;
4545

4646
static const char PointerType[];
4747

clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ AST_MATCHER(CXXRecordDecl, isMoveConstructible) {
4646
}
4747
} // namespace
4848

49-
static TypeMatcher constRefType() {
50-
return lValueReferenceType(pointee(isConstQualified()));
49+
static TypeMatcher notTemplateSpecConstRefType() {
50+
return lValueReferenceType(
51+
pointee(unless(templateSpecializationType()), isConstQualified()));
5152
}
5253

5354
static TypeMatcher nonConstValueType() {
@@ -145,16 +146,18 @@ void PassByValueCheck::registerMatchers(MatchFinder *Finder) {
145146
// ParenListExpr is generated instead of a CXXConstructExpr,
146147
// filtering out templates automatically for us.
147148
withInitializer(cxxConstructExpr(
148-
has(ignoringParenImpCasts(declRefExpr(to(
149-
parmVarDecl(
150-
hasType(qualType(
151-
// Match only const-ref or a non-const value
152-
// parameters. Rvalues and const-values
153-
// shouldn't be modified.
154-
ValuesOnly ? nonConstValueType()
155-
: anyOf(constRefType(),
156-
nonConstValueType()))))
157-
.bind("Param"))))),
149+
has(ignoringParenImpCasts(declRefExpr(
150+
to(parmVarDecl(
151+
hasType(qualType(
152+
// Match only const-ref or a non-const
153+
// value parameters. Rvalues,
154+
// TemplateSpecializationValues and
155+
// const-values shouldn't be modified.
156+
ValuesOnly
157+
? nonConstValueType()
158+
: anyOf(notTemplateSpecConstRefType(),
159+
nonConstValueType()))))
160+
.bind("Param"))))),
158161
hasDeclaration(cxxConstructorDecl(
159162
isCopyConstructor(), unless(isDeleted()),
160163
hasDeclContext(

clang-tools-extra/clang-tidy/utils/LexerUtils.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "LexerUtils.h"
10+
#include "clang/Basic/SourceManager.h"
1011

1112
namespace clang {
1213
namespace tidy {

clang-tools-extra/clangd/AST.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "clang/Basic/SourceManager.h"
2626
#include "clang/Basic/Specifiers.h"
2727
#include "clang/Index/USRGeneration.h"
28-
#include "clang/Lex/Lexer.h"
2928
#include "llvm/ADT/ArrayRef.h"
3029
#include "llvm/ADT/Optional.h"
3130
#include "llvm/ADT/STLExtras.h"
@@ -417,16 +416,8 @@ class DeducedTypeVisitor : public RecursiveASTVisitor<DeducedTypeVisitor> {
417416

418417
llvm::Optional<QualType> getDeducedType(ASTContext &ASTCtx,
419418
SourceLocation Loc) {
420-
Token Tok;
421-
// Only try to find a deduced type if the token is auto or decltype.
422-
if (!Loc.isValid() ||
423-
Lexer::getRawToken(Loc, Tok, ASTCtx.getSourceManager(),
424-
ASTCtx.getLangOpts(), false) ||
425-
!Tok.is(tok::raw_identifier) ||
426-
!(Tok.getRawIdentifier() == "auto" ||
427-
Tok.getRawIdentifier() == "decltype")) {
419+
if (!Loc.isValid())
428420
return {};
429-
}
430421
DeducedTypeVisitor V(Loc);
431422
V.TraverseAST(ASTCtx);
432423
if (V.DeducedType.isNull())

clang-tools-extra/clangd/AST.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ NestedNameSpecifierLoc getQualifierLoc(const NamedDecl &ND);
109109
QualType declaredType(const TypeDecl *D);
110110

111111
/// Retrieves the deduced type at a given location (auto, decltype).
112-
/// Retuns None unless Loc starts an auto/decltype token.
113112
/// It will return the underlying type.
114113
llvm::Optional<QualType> getDeducedType(ASTContext &, SourceLocation Loc);
115114

0 commit comments

Comments
 (0)