Skip to content

Commit a5cbe74

Browse files
authored
Merge branch 'sycl' into spec_const_property_defaults
2 parents 6d25843 + ae87657 commit a5cbe74

File tree

2,429 files changed

+105409
-158696
lines changed

Some content is hidden

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

2,429 files changed

+105409
-158696
lines changed

.github/CODEOWNERS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ clang/**/Driver @mdtoguchi @AGindinson
99
# LLVM-SPIRV translator
1010
llvm-spirv/ @AlexeySotkin @AlexeySachkov
1111

12+
# OpenCL deps
13+
opencl/ @pvchupin @vladimirlaz
14+
1215
# OpenCL "offline" compiler
13-
opencl-aot/ @dm-vodopyanov @AlexeySachkov @romanovvlad
16+
opencl/opencl-aot/ @dm-vodopyanov @AlexeySachkov @romanovvlad
1417

1518
# Device library
1619
libdevice/ @vzakhari @jinge90
@@ -89,6 +92,7 @@ llvm/lib/Support/Base64.cpp @mlychkov @AlexeySachkov @kbobrovs
8992
clang/tools/clang-offload-bundler/ @mlychkov @sndmitriev @AlexeySachkov
9093
clang/tools/clang-offload-wrapper/ @mlychkov @sndmitriev @AlexeySachkov @kbobrovs
9194
clang/tools/clang-offload-deps/ @sndmitriev @mlychkov @AlexeySachkov
95+
clang/tools/clang-offload-extract/ @sndmitriev @mlychkov @AlexeySachkov
9296

9397
# Explicit SIMD
9498
SYCLLowerIR/ @kbobrovs @DenisBakhvalov

buildbot/compile.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def do_compile(args):
3232
"--build", abs_obj_dir,
3333
"--",
3434
"deploy-sycl-toolchain",
35-
"deploy-opencl-aot",
3635
"-j", str(cpu_count)]
3736

3837
if args.verbose:

buildbot/configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ 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;opencl-aot;libdevice;xpti;xptifw'
16+
llvm_external_projects = 'sycl;llvm-spirv;opencl;libdevice;xpti;xptifw'
1717

1818
llvm_dir = os.path.join(abs_src_dir, "llvm")
1919
sycl_dir = os.path.join(abs_src_dir, "sycl")

buildbot/dependency.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ ocl_cpu_rt_ver=2021.11.3.0.09
44
# https://github.com/intel/llvm/releases/download/2021-WW11/win-oclcpuexp-2021.11.3.0.09_rel.zip
55
ocl_cpu_rt_ver_win=2021.11.3.0.09
66
# Same GPU driver supports Level Zero and OpenCL
7-
# https://github.com/intel/compute-runtime/releases/tag/21.13.19438
8-
ocl_gpu_rt_ver=21.13.19438
7+
# https://github.com/intel/compute-runtime/releases/tag/21.17.19709
8+
ocl_gpu_rt_ver=21.17.19709
99
# Same GPU driver supports Level Zero and OpenCL
1010
# https://downloadmirror.intel.com/30381/a08/igfx_win10_100.9466.zip
1111
ocl_gpu_rt_ver_win=27.20.100.9466
@@ -30,7 +30,7 @@ ocloc_ver_win=27.20.100.9168
3030
[DRIVER VERSIONS]
3131
cpu_driver_lin=2021.11.3.0.09
3232
cpu_driver_win=2021.11.3.0.09
33-
gpu_driver_lin=21.13.19438
33+
gpu_driver_lin=21.17.19709
3434
gpu_driver_win=27.20.100.9466
3535
fpga_driver_lin=2021.11.3.0.09
3636
fpga_driver_win=2021.11.3.0.09

clang-tools-extra/clang-query/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ clang_target_link_libraries(clangQuery
1919
clangBasic
2020
clangDynamicASTMatchers
2121
clangFrontend
22+
clangTooling
2223
clangSerialization
2324
)
2425

clang-tools-extra/clang-query/Query.cpp

Lines changed: 98 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "clang/ASTMatchers/ASTMatchFinder.h"
1313
#include "clang/Frontend/ASTUnit.h"
1414
#include "clang/Frontend/TextDiagnostic.h"
15+
#include "clang/Tooling/NodeIntrospection.h"
1516
#include "llvm/Support/raw_ostream.h"
1617

1718
using namespace clang::ast_matchers;
@@ -66,6 +67,8 @@ bool HelpQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
6667
"Diagnostic location for bound nodes.\n"
6768
" detailed-ast "
6869
"Detailed AST output for bound nodes.\n"
70+
" srcloc "
71+
"Source locations and ranges for bound nodes.\n"
6972
" dump "
7073
"Detailed AST output for bound nodes (alias of detailed-ast).\n\n";
7174
return true;
@@ -86,6 +89,90 @@ struct CollectBoundNodes : MatchFinder::MatchCallback {
8689
}
8790
};
8891

92+
void dumpLocations(llvm::raw_ostream &OS, DynTypedNode Node, ASTContext &Ctx,
93+
const DiagnosticsEngine &Diags, SourceManager const &SM) {
94+
auto Locs = clang::tooling::NodeIntrospection::GetLocations(Node);
95+
96+
auto PrintLocations = [](llvm::raw_ostream &OS, auto Iter, auto End) {
97+
auto CommonEntry = Iter->first;
98+
auto Scout = Iter;
99+
SmallVector<std::string> LocationStrings;
100+
while (Scout->first == CommonEntry) {
101+
LocationStrings.push_back(
102+
tooling::LocationCallFormatterCpp::format(*Iter->second));
103+
if (Scout == End)
104+
break;
105+
++Scout;
106+
if (Scout->first == CommonEntry)
107+
++Iter;
108+
}
109+
llvm::sort(LocationStrings);
110+
for (auto &LS : LocationStrings) {
111+
OS << " * \"" << LS << "\"\n";
112+
}
113+
return Iter;
114+
};
115+
116+
TextDiagnostic TD(OS, Ctx.getLangOpts(), &Diags.getDiagnosticOptions());
117+
118+
for (auto Iter = Locs.LocationAccessors.begin();
119+
Iter != Locs.LocationAccessors.end(); ++Iter) {
120+
if (!Iter->first.isValid())
121+
continue;
122+
123+
TD.emitDiagnostic(FullSourceLoc(Iter->first, SM), DiagnosticsEngine::Note,
124+
"source locations here", None, None);
125+
126+
Iter = PrintLocations(OS, Iter, Locs.LocationAccessors.end());
127+
OS << '\n';
128+
}
129+
130+
for (auto Iter = Locs.RangeAccessors.begin();
131+
Iter != Locs.RangeAccessors.end(); ++Iter) {
132+
133+
if (!Iter->first.getBegin().isValid())
134+
continue;
135+
136+
if (SM.getPresumedLineNumber(Iter->first.getBegin()) !=
137+
SM.getPresumedLineNumber(Iter->first.getEnd()))
138+
continue;
139+
140+
TD.emitDiagnostic(FullSourceLoc(Iter->first.getBegin(), SM),
141+
DiagnosticsEngine::Note,
142+
"source ranges here " + Iter->first.printToString(SM),
143+
CharSourceRange::getTokenRange(Iter->first), None);
144+
145+
Iter = PrintLocations(OS, Iter, Locs.RangeAccessors.end());
146+
}
147+
for (auto Iter = Locs.RangeAccessors.begin();
148+
Iter != Locs.RangeAccessors.end(); ++Iter) {
149+
150+
if (!Iter->first.getBegin().isValid())
151+
continue;
152+
153+
if (SM.getPresumedLineNumber(Iter->first.getBegin()) ==
154+
SM.getPresumedLineNumber(Iter->first.getEnd()))
155+
continue;
156+
157+
TD.emitDiagnostic(
158+
FullSourceLoc(Iter->first.getBegin(), SM), DiagnosticsEngine::Note,
159+
"source range " + Iter->first.printToString(SM) + " starting here...",
160+
CharSourceRange::getTokenRange(Iter->first), None);
161+
162+
auto ColNum = SM.getPresumedColumnNumber(Iter->first.getEnd());
163+
auto LastLineLoc = Iter->first.getEnd().getLocWithOffset(-(ColNum - 1));
164+
165+
TD.emitDiagnostic(FullSourceLoc(Iter->first.getEnd(), SM),
166+
DiagnosticsEngine::Note, "... ending here",
167+
CharSourceRange::getTokenRange(
168+
SourceRange(LastLineLoc, Iter->first.getEnd())),
169+
None);
170+
171+
Iter = PrintLocations(OS, Iter, Locs.RangeAccessors.end());
172+
}
173+
OS << "\n";
174+
}
175+
89176
} // namespace
90177

91178
bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
@@ -106,8 +193,10 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
106193
return false;
107194
}
108195

109-
AST->getASTContext().getParentMapContext().setTraversalKind(QS.TK);
110-
Finder.matchAST(AST->getASTContext());
196+
auto &Ctx = AST->getASTContext();
197+
const auto &SM = Ctx.getSourceManager();
198+
Ctx.getParentMapContext().setTraversalKind(QS.TK);
199+
Finder.matchAST(Ctx);
111200

112201
if (QS.PrintMatcher) {
113202
SmallVector<StringRef, 4> Lines;
@@ -159,6 +248,13 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
159248
Dumper.Visit(BI->second);
160249
OS << "\n";
161250
}
251+
if (QS.SrcLocOutput) {
252+
OS << "\n \"" << BI->first << "\" Source locations\n";
253+
OS << " " << std::string(19 + BI->first.size(), '-') << '\n';
254+
255+
dumpLocations(OS, BI->second, Ctx, AST->getDiagnostics(), SM);
256+
OS << "\n";
257+
}
162258
}
163259

164260
if (MI->getMap().empty())

clang-tools-extra/clang-query/Query.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
namespace clang {
1919
namespace query {
2020

21-
enum OutputKind { OK_Diag, OK_Print, OK_DetailedAST };
21+
enum OutputKind { OK_Diag, OK_Print, OK_DetailedAST, OK_SrcLoc };
2222

2323
enum QueryKind {
2424
QK_Invalid,
@@ -149,6 +149,7 @@ struct SetExclusiveOutputQuery : Query {
149149
QS.DiagOutput = false;
150150
QS.DetailedASTOutput = false;
151151
QS.PrintOutput = false;
152+
QS.SrcLocOutput = false;
152153
QS.*Var = true;
153154
return true;
154155
}

clang-tools-extra/clang-query/QueryParser.cpp

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "QuerySession.h"
1212
#include "clang/ASTMatchers/Dynamic/Parser.h"
1313
#include "clang/Basic/CharInfo.h"
14+
#include "clang/Tooling/NodeIntrospection.h"
1415
#include "llvm/ADT/StringRef.h"
1516
#include "llvm/ADT/StringSwitch.h"
1617
#include <set>
@@ -104,16 +105,19 @@ QueryRef QueryParser::parseSetBool(bool QuerySession::*Var) {
104105

105106
template <typename QueryType> QueryRef QueryParser::parseSetOutputKind() {
106107
StringRef ValStr;
107-
unsigned OutKind = LexOrCompleteWord<unsigned>(this, ValStr)
108-
.Case("diag", OK_Diag)
109-
.Case("print", OK_Print)
110-
.Case("detailed-ast", OK_DetailedAST)
111-
.Case("dump", OK_DetailedAST)
112-
.Default(~0u);
108+
bool HasIntrospection = tooling::NodeIntrospection::hasIntrospectionSupport();
109+
unsigned OutKind =
110+
LexOrCompleteWord<unsigned>(this, ValStr)
111+
.Case("diag", OK_Diag)
112+
.Case("print", OK_Print)
113+
.Case("detailed-ast", OK_DetailedAST)
114+
.Case("srcloc", OK_SrcLoc, /*IsCompletion=*/HasIntrospection)
115+
.Case("dump", OK_DetailedAST)
116+
.Default(~0u);
113117
if (OutKind == ~0u) {
114-
return new InvalidQuery(
115-
"expected 'diag', 'print', 'detailed-ast' or 'dump', got '" + ValStr +
116-
"'");
118+
return new InvalidQuery("expected 'diag', 'print', 'detailed-ast'" +
119+
StringRef(HasIntrospection ? ", 'srcloc'" : "") +
120+
" or 'dump', got '" + ValStr + "'");
117121
}
118122

119123
switch (OutKind) {
@@ -123,6 +127,10 @@ template <typename QueryType> QueryRef QueryParser::parseSetOutputKind() {
123127
return new QueryType(&QuerySession::DiagOutput);
124128
case OK_Print:
125129
return new QueryType(&QuerySession::PrintOutput);
130+
case OK_SrcLoc:
131+
if (HasIntrospection)
132+
return new QueryType(&QuerySession::SrcLocOutput);
133+
return new InvalidQuery("'srcloc' output support is not available.");
126134
}
127135

128136
llvm_unreachable("Invalid output kind");

clang-tools-extra/clang-query/QuerySession.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ class QuerySession {
2525
public:
2626
QuerySession(llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs)
2727
: ASTs(ASTs), PrintOutput(false), DiagOutput(true),
28-
DetailedASTOutput(false), BindRoot(true), PrintMatcher(false),
29-
Terminate(false), TK(TK_AsIs) {}
28+
DetailedASTOutput(false), SrcLocOutput(false), BindRoot(true),
29+
PrintMatcher(false), Terminate(false), TK(TK_AsIs) {}
3030

3131
llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs;
3232

3333
bool PrintOutput;
3434
bool DiagOutput;
3535
bool DetailedASTOutput;
36+
bool SrcLocOutput;
3637

3738
bool BindRoot;
3839
bool PrintMatcher;

0 commit comments

Comments
 (0)