Skip to content

Commit 9afe27f

Browse files
Merge branch 'sycl' into mix-sycl-esimd-driver-1
2 parents e131ad5 + 61e763d commit 9afe27f

File tree

3,911 files changed

+663932
-420231
lines changed

Some content is hidden

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

3,911 files changed

+663932
-420231
lines changed

.github/CODEOWNERS

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,18 @@ llvm/**/file-table-tform/ @kbobrovs @AlexeySachkov
9999
llvm/**/llvm-foreach/ @AlexeySachkov @Fznamznon
100100
llvm/**/llvm-no-spir-kernel/ @AGindinson @AlexeySachkov
101101
llvm/**/sycl-post-link/ @kbobrovs @AlexeySachkov
102+
llvm/include/llvm/Support/PropertySetIO.h @kbobrovs @AlexeySachkov
103+
llvm/lib/Support/PropertySetIO.cpp @kbobrovs @AlexeySachkov
104+
llvm/unittests/Support/PropertySetIOTest.cpp @kbobrovs @AlexeySachkov
105+
llvm/lib/Support/Base64.cpp @kbobrovs @AlexeySachkov
102106

103107
# Clang offload tools
104108
clang/tools/clang-offload-bundler/ @kbobrovs @sndmitriev
105109
clang/tools/clang-offload-wrapper/ @sndmitriev @kbobrovs
106110
clang/tools/clang-offload-deps/ @sndmitriev
107111

108112
# Explicit SIMD
109-
SYCLLowerIR/ @kbobrovs
110-
esimd/ @kbobrovs
111-
sycl/include/CL/sycl/INTEL/esimd.hpp @kbobrovs
113+
SYCLLowerIR/ @kbobrovs @DenisBakhvalov
114+
esimd/ @kbobrovs @DenisBakhvalov
115+
sycl/include/CL/sycl/INTEL/esimd.hpp @kbobrovs @DenisBakhvalov
112116
sycl/doc/extensions/ExplicitSIMD/ @kbobrovs

.github/lockdown.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Configuration for Repo Lockdown - https://github.com/dessant/repo-lockdown
2+
3+
skipCreatedBefore: "2020-03-21"
4+
5+
pulls:
6+
comment: >
7+
This repository does not accept pull requests.
8+
Please follow http://llvm.org/docs/Contributing.html#how-to-submit-a-patch for contribution to LLVM.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
#OS X specific files.
2222
.DS_store
2323

24+
# Ignore the user specified CMake presets in subproject directories.
25+
/*/CMakeUserPresets.json
26+
2427
# Nested build directory
2528
/build*
2629
!buildbot
@@ -64,3 +67,5 @@ pythonenv*
6467
/clang/utils/analyzer/projects/*/PatchedSource
6568
/clang/utils/analyzer/projects/*/ScanBuildResults
6669
/clang/utils/analyzer/projects/*/RefScanBuildResults
70+
# automodapi puts generated documentation files here.
71+
/lldb/docs/python_api/

buildbot/configure.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,28 @@ def do_configure(args):
1313
if not os.path.isdir(abs_obj_dir):
1414
os.makedirs(abs_obj_dir)
1515

16+
llvm_external_projects = 'sycl;llvm-spirv;opencl-aot;libdevice'
17+
if not args.use_libcxx:
18+
llvm_external_projects += ';xpti;xptifw'
19+
1620
llvm_dir = os.path.join(abs_src_dir, "llvm")
1721
sycl_dir = os.path.join(abs_src_dir, "sycl")
1822
spirv_dir = os.path.join(abs_src_dir, "llvm-spirv")
1923
xpti_dir = os.path.join(abs_src_dir, "xpti")
24+
xptifw_dir = os.path.join(abs_src_dir, "xptifw")
2025
libdevice_dir = os.path.join(abs_src_dir, "libdevice")
2126
ocl_header_dir = os.path.join(abs_obj_dir, "OpenCL-Headers")
2227
icd_loader_lib = os.path.join(abs_obj_dir, "OpenCL-ICD-Loader", "build")
2328
llvm_targets_to_build = 'X86'
24-
llvm_enable_projects = 'clang;llvm-spirv;sycl;opencl-aot;xpti;libdevice'
29+
llvm_enable_projects = 'clang;' + llvm_external_projects
2530
libclc_targets_to_build = ''
2631
sycl_build_pi_cuda = 'OFF'
2732
sycl_werror = 'ON'
2833
llvm_enable_assertions = 'ON'
2934
llvm_enable_doxygen = 'OFF'
3035
llvm_enable_sphinx = 'OFF'
3136
llvm_build_shared_libs = 'OFF'
37+
sycl_enable_xpti_tracing = 'OFF' if args.use_libcxx else 'ON'
3238

3339
icd_loader_lib = os.path.join(icd_loader_lib, "libOpenCL.so" if platform.system() == 'Linux' else "OpenCL.lib")
3440

@@ -63,10 +69,12 @@ def do_configure(args):
6369
"-DCMAKE_BUILD_TYPE={}".format(args.build_type),
6470
"-DLLVM_ENABLE_ASSERTIONS={}".format(llvm_enable_assertions),
6571
"-DLLVM_TARGETS_TO_BUILD={}".format(llvm_targets_to_build),
66-
"-DLLVM_EXTERNAL_PROJECTS=sycl;llvm-spirv;opencl-aot;xpti;libdevice",
72+
"-DLLVM_EXTERNAL_PROJECTS={}".format(llvm_external_projects),
6773
"-DLLVM_EXTERNAL_SYCL_SOURCE_DIR={}".format(sycl_dir),
6874
"-DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR={}".format(spirv_dir),
6975
"-DLLVM_EXTERNAL_XPTI_SOURCE_DIR={}".format(xpti_dir),
76+
"-DXPTI_SOURCE_DIR={}".format(xpti_dir),
77+
"-DLLVM_EXTERNAL_XPTIFW_SOURCE_DIR={}".format(xptifw_dir),
7078
"-DLLVM_EXTERNAL_LIBDEVICE_SOURCE_DIR={}".format(libdevice_dir),
7179
"-DLLVM_ENABLE_PROJECTS={}".format(llvm_enable_projects),
7280
"-DLIBCLC_TARGETS_TO_BUILD={}".format(libclc_targets_to_build),
@@ -78,7 +86,7 @@ def do_configure(args):
7886
"-DLLVM_ENABLE_DOXYGEN={}".format(llvm_enable_doxygen),
7987
"-DLLVM_ENABLE_SPHINX={}".format(llvm_enable_sphinx),
8088
"-DBUILD_SHARED_LIBS={}".format(llvm_build_shared_libs),
81-
"-DSYCL_ENABLE_XPTI_TRACING=ON" # Explicitly turn on XPTI tracing
89+
"-DSYCL_ENABLE_XPTI_TRACING={}".format(sycl_enable_xpti_tracing)
8290
]
8391

8492
if args.system_ocl:
@@ -101,6 +109,15 @@ def do_configure(args):
101109
# Add path to root CMakeLists.txt
102110
cmake_cmd.append(llvm_dir)
103111

112+
if args.use_libcxx:
113+
if not (args.libcxx_include and args.libcxx_library):
114+
sys.exit("Please specify include and library path of libc++ when building sycl "
115+
"runtime with it")
116+
cmake_cmd.extend([
117+
"-DSYCL_USE_LIBCXX=ON",
118+
"-DSYCL_LIBCXX_INCLUDE_PATH={}".format(args.libcxx_include),
119+
"-DSYCL_LIBCXX_LIBRARY_PATH={}".format(args.libcxx_library)])
120+
104121
print("[Cmake Command]: {}".format(" ".join(cmake_cmd)))
105122

106123
try:
@@ -140,7 +157,9 @@ def main():
140157
parser.add_argument("--shared-libs", action='store_true', help="Build shared libraries")
141158
parser.add_argument("--cmake-opt", action='append', help="Additional CMake option not configured via script parameters")
142159
parser.add_argument("--cmake-gen", default="Ninja", help="CMake generator")
143-
160+
parser.add_argument("--use-libcxx", action="store_true", help="build sycl runtime with libcxx")
161+
parser.add_argument("--libcxx-include", metavar="LIBCXX_INCLUDE_PATH", help="libcxx include path")
162+
parser.add_argument("--libcxx-library", metavar="LIBCXX_LIBRARY_PATH", help="libcxx library path")
144163
args = parser.parse_args()
145164

146165
print("args:{}".format(args))

buildbot/dependency.conf

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@ ocl_cpu_rt_ver=2020.11.11.0.04
44
# https://github.com/intel/llvm/releases/download/2020-WW45/win-oclcpuexp-2020.11.11.0.04_rel.zip
55
ocl_cpu_rt_ver_win=2020.11.11.0.04
66
# Same GPU driver supports Level Zero and OpenCL
7-
# https://github.com/intel/compute-runtime/releases/tag/21.02.18820
8-
ocl_gpu_rt_ver=21.02.18820
7+
# https://github.com/intel/compute-runtime/releases/tag/21.03.18857
8+
ocl_gpu_rt_ver=21.03.18857
99
# Same GPU driver supports Level Zero and OpenCL
1010
# https://downloadmirror.intel.com/30066/a08/igfx_win10_100.9030.zip
1111
ocl_gpu_rt_ver_win=27.20.100.9030
1212
intel_sycl_ver=build
13-
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.1-beta10/oneapi-tbb-2021.1-beta10-lin.tgz
14-
tbb_ver=2021.1.053
15-
# Binaries can be built from sources following instructions under:
13+
14+
# TBB binaries can be built from sources following instructions under
1615
# https://github.com/oneapi-src/oneTBB/blob/master/cmake/README.md
16+
# or downloaded using links below:
17+
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.1.1/oneapi-tbb-2021.1.1-lin.tgz
18+
tbb_ver=2021.1.053
19+
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.1.1/oneapi-tbb-2021.1.1-win.zip
1720
tbb_ver_win=2021.1.049
21+
1822
# https://github.com/intel/llvm/releases/download/2020-WW45/fpgaemu-2020.11.11.0.04_rel.tar.gz
1923
ocl_fpga_emu_ver=2020.11.11.0.04
2024
# https://github.com/intel/llvm/releases/download/2020-WW45/win-fpgaemu-2020.11.11.0.04_rel.zip
@@ -26,7 +30,7 @@ ocloc_ver_win=27.20.100.8935
2630
[DRIVER VERSIONS]
2731
cpu_driver_lin=2020.11.11.0.04
2832
cpu_driver_win=2020.11.11.0.04
29-
gpu_driver_lin=21.02.18820
33+
gpu_driver_lin=21.03.18857
3034
gpu_driver_win=27.20.100.9030
3135
fpga_driver_lin=2020.11.11.0.04
3236
fpga_driver_win=2020.11.11.0.04

clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void UpgradeDurationConversionsCheck::check(
128128

129129
if (!match(isInTemplateInstantiation(), *OuterExpr, *Result.Context)
130130
.empty()) {
131-
if (MatchedTemplateLocations.count(Loc.getRawEncoding()) == 0) {
131+
if (MatchedTemplateLocations.count(Loc) == 0) {
132132
// For each location matched in a template instantiation, we check if the
133133
// location can also be found in `MatchedTemplateLocations`. If it is not
134134
// found, that means the expression did not create a match without the
@@ -144,7 +144,7 @@ void UpgradeDurationConversionsCheck::check(
144144
internal::Matcher<Stmt> IsInsideTemplate =
145145
hasAncestor(decl(anyOf(classTemplateDecl(), functionTemplateDecl())));
146146
if (!match(IsInsideTemplate, *ArgExpr, *Result.Context).empty())
147-
MatchedTemplateLocations.insert(Loc.getRawEncoding());
147+
MatchedTemplateLocations.insert(Loc);
148148

149149
DiagnosticBuilder Diag = diag(Loc, Message);
150150
CharSourceRange SourceRange = Lexer::makeFileCharRange(

clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
#include "../ClangTidyCheck.h"
1313

14-
#include <unordered_set>
14+
#include "clang/Basic/SourceLocation.h"
15+
#include "llvm/ADT/DenseSet.h"
1516

1617
namespace clang {
1718
namespace tidy {
@@ -32,7 +33,7 @@ class UpgradeDurationConversionsCheck : public ClangTidyCheck {
3233
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
3334

3435
private:
35-
std::unordered_set<unsigned> MatchedTemplateLocations;
36+
llvm::DenseSet<SourceLocation> MatchedTemplateLocations;
3637
};
3738

3839
} // namespace abseil

clang-tools-extra/clangd/AST.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ getQualification(ASTContext &Context, const DeclContext *DestContext,
116116
if (auto *TD = llvm::dyn_cast<TagDecl>(CurContext)) {
117117
// There can't be any more tag parents after hitting a namespace.
118118
assert(!ReachedNS);
119+
(void)ReachedNS;
119120
NNS = NestedNameSpecifier::Create(Context, nullptr, false,
120121
TD->getTypeForDecl());
121122
} else {
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//===--- ASTSignals.cpp ------------------------------------------*- C++-*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "ASTSignals.h"
10+
#include "AST.h"
11+
#include "FindTarget.h"
12+
13+
namespace clang {
14+
namespace clangd {
15+
ASTSignals ASTSignals::derive(const ParsedAST &AST) {
16+
ASTSignals Signals;
17+
const SourceManager &SM = AST.getSourceManager();
18+
findExplicitReferences(AST.getASTContext(), [&](ReferenceLoc Ref) {
19+
for (const NamedDecl *ND : Ref.Targets) {
20+
if (!isInsideMainFile(Ref.NameLoc, SM))
21+
continue;
22+
SymbolID ID = getSymbolID(ND);
23+
if (!ID)
24+
continue;
25+
unsigned &SymbolCount = Signals.ReferencedSymbols[ID];
26+
SymbolCount++;
27+
// Process namespace only when we see the symbol for the first time.
28+
if (SymbolCount != 1)
29+
continue;
30+
if (const auto *NSD = dyn_cast<NamespaceDecl>(ND->getDeclContext())) {
31+
if (NSD->isAnonymousNamespace())
32+
continue;
33+
std::string NS = printNamespaceScope(*NSD);
34+
if (!NS.empty())
35+
Signals.RelatedNamespaces[NS]++;
36+
}
37+
}
38+
});
39+
return Signals;
40+
}
41+
} // namespace clangd
42+
} // namespace clang

clang-tools-extra/clangd/ASTSignals.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//===--- ASTSignals.h --------------------------------------------*- C++-*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_ASTSIGNALS_H
10+
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_ASTSIGNALS_H
11+
12+
#include "ParsedAST.h"
13+
#include "index/SymbolID.h"
14+
#include "llvm/ADT/DenseMap.h"
15+
#include "llvm/ADT/StringMap.h"
16+
17+
namespace clang {
18+
namespace clangd {
19+
20+
/// Signals derived from a valid AST of a file.
21+
/// Provides information that can only be extracted from the AST to actions that
22+
/// can't access an AST. The signals are computed and updated asynchronously by
23+
/// the ASTWorker and thus they are always stale and also can be absent.
24+
/// Example usage: Information about the declarations used in a file affects
25+
/// code-completion ranking in that file.
26+
struct ASTSignals {
27+
/// Number of occurrences of each symbol present in the file.
28+
llvm::DenseMap<SymbolID, unsigned> ReferencedSymbols;
29+
/// Namespaces whose symbols are used in the file, and the number of such
30+
/// distinct symbols.
31+
llvm::StringMap<unsigned> RelatedNamespaces;
32+
33+
static ASTSignals derive(const ParsedAST &AST);
34+
};
35+
36+
} // namespace clangd
37+
} // namespace clang
38+
39+
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_ASTSIGNALS_H

clang-tools-extra/clangd/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/../clang-tidy")
4646

4747
add_clang_library(clangDaemon
4848
AST.cpp
49+
ASTSignals.cpp
4950
ClangdLSPServer.cpp
5051
ClangdServer.cpp
5152
CodeComplete.cpp

clang-tools-extra/clangd/ClangdLSPServer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,6 +1469,12 @@ ClangdLSPServer::ClangdLSPServer(class Transport &Transp,
14691469
MsgHandler(new MessageHandler(*this)), TFS(TFS),
14701470
SupportedSymbolKinds(defaultSymbolKinds()),
14711471
SupportedCompletionItemKinds(defaultCompletionItemKinds()), Opts(Opts) {
1472+
if (Opts.ConfigProvider) {
1473+
assert(!Opts.ContextProvider &&
1474+
"Only one of ConfigProvider and ContextProvider allowed!");
1475+
this->Opts.ContextProvider = ClangdServer::createConfiguredContextProvider(
1476+
Opts.ConfigProvider, this);
1477+
}
14721478

14731479
// clang-format off
14741480
MsgHandler->bind("initialize", &ClangdLSPServer::onInitialize);

clang-tools-extra/clangd/ClangdLSPServer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class SymbolIndex;
4141
class ClangdLSPServer : private ClangdServer::Callbacks {
4242
public:
4343
struct Options : ClangdServer::Options {
44+
/// Supplies configuration (overrides ClangdServer::ContextProvider).
45+
config::Provider *ConfigProvider = nullptr;
4446
/// Look for compilation databases, rather than using compile commands
4547
/// set via LSP (extensions) only.
4648
bool UseDirBasedCDB = true;

0 commit comments

Comments
 (0)