Skip to content

Commit 996bfe2

Browse files
committed
Merge remote-tracking branch 'intel_llvm/sycl' into public_vklochkov_mem_leaks3
2 parents 961d820 + f126512 commit 996bfe2

File tree

1,997 files changed

+856426
-32826
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,997 files changed

+856426
-32826
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Please describe the steps to reproduce the behavior:
15+
16+
1. Include code snippet as short as possible
17+
2. Specify the command which should be used to compile the program
18+
3. Specify the comment which should be used to launch the program
19+
4. Indicate what is wrong and what was expected
20+
21+
**Environment (please complete the following information):**
22+
23+
- OS: [e.g Windows/Linux]
24+
- Target device and vendor: [e.g. Intel GPU]
25+
- DPC++ version: [e.g. commit hash or output of `clang++ --version`]
26+
- Dependencies version: [e.g. low-level runtime versions (like NEO 20.04)]
27+
28+
**Additional context**
29+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
contact_links:
2+
- name: Ask community a question
3+
url: https://github.com/intel/llvm/discussions/categories/q-a
4+
about: Please use Q&A Discussions category instead of Issues to ask questions
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea/improvement for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe**
11+
A clear and concise description of what the problem is.
12+
Include reproducer or code/pseudo-code example.
13+
Include specific environment details where problem occurs.
14+
15+
**Describe the solution you would like**
16+
A clear and concise description of what you want to happen.
17+
18+
**Describe alternatives you have considered**
19+
A clear and concise description of any alternative solutions or features you
20+
have considered.
21+
22+
**Additional context**
23+
Add any other context about the feature request here.

.github/workflows/linux_post_commit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
3030
sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main"
3131
sudo apt-get update
32-
sudo apt-get install -y clang-12
32+
sudo apt-get install -y clang-13
3333
export ARGS="--shared-libs"
34-
export CC="clang-12"
35-
export CXX="clang++-12"
34+
export CC="clang-13"
35+
export CXX="clang++-13"
3636
;;
3737
NoAssertions)
3838
export ARGS="--no-assertions"

CONTRIBUTING.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,63 @@ see [ABI Policy Guide](sycl/doc/ABIPolicyGuide.md) for more information.
5454
- Run regression tests -
5555
[instructions](sycl/doc/GetStartedGuide.md#test-dpc-toolchain).
5656

57+
### Tests development
58+
59+
Every product change should be accompanied with corresponding test modification
60+
(adding new test(s), extending, removing or modifying existing test(s)).
61+
62+
There are 3 types of tests which are used for DPC++ toolchain validation:
63+
* DPC++ in-tree LIT tests including [check-llvm](../../llvm/test),
64+
[check-clang](../../clang/test), [check-llvm-spirv](../../llvm-spirv/test) and
65+
[check-sycl](../../sycl/test) targets stored in this repository. These tests
66+
should not have hardware (e.g. GPU, FPGA, etc.) or external software
67+
dependencies (e.g. OpenCL, Level Zero, CUDA runtimes). All tests not following
68+
this approach should be moved to DPC++ end-to-end or SYCL-CTS tests.
69+
However, the tests for a feature under active development requiring atomic
70+
change for tests and product can be put to
71+
[sycl/test/on-device](../../sycl/test/on-device) temporarily. It is developer
72+
responsibility to move the tests to DPC++ E2E test suite or SYCL-CTS once
73+
the feature is stabilized.
74+
75+
**Guidelines for adding DPC++ in-tree LIT tests (DPC++ Clang FE tests)**:
76+
- Use `sycl::` namespace instead of `cl::sycl::`
77+
78+
- Include sycl mock headers as system headers.
79+
Example: `-internal-isystem %S/Inputs`
80+
`#include "sycl.hpp"`
81+
82+
- Use SYCL functions for invoking kernels from the mock header `(single_task, parallel_for, parallel_for_work_group)`
83+
Example:
84+
```bash
85+
`#include "Inputs/sycl.hpp"`
86+
sycl::queue q;
87+
q.submit([&](cl::sycl::handler &h) {
88+
h.single_task( { //code });
89+
});
90+
```
91+
92+
- Add a helpful comment describing what the test does at the beginning and other comments throughout the test as necessary.
93+
94+
- Try to follow descriptive naming convention for variables, functions as much as possible.
95+
Please refer [LLVM naming convention](https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly)
96+
97+
* DPC++ end-to-end (E2E) tests which are extension to
98+
[LLVM\* test suite](https://github.com/intel/llvm-test-suite/tree/intel/SYCL).
99+
A test which requires full stack including backend runtimes (e.g. OpenCL,
100+
Level Zero or CUDA) should be put to DPC++ E2E test suite following
101+
[CONTRIBUTING](https://github.com/intel/llvm-test-suite/blob/intel/CONTRIBUTING.md).
102+
103+
* SYCL-CTS are official
104+
[Khronos\* SYCL\* conformance tests](https://github.com/KhronosGroup/SYCL-CTS).
105+
They verify SYCL specification compatibility. All implementation details or
106+
extensions are out of scope for the tests. If SYCL specification has changed
107+
(SYCL CTS tests conflict with recent version of SYCL specification) or change
108+
is required in the way the tests are built with DPC++ compiler (defined in
109+
[FindIntel_SYCL](https://github.com/KhronosGroup/SYCL-CTS/blob/SYCL-1.2.1/master/cmake/FindIntel_SYCL.cmake))
110+
pull request should be created under
111+
[KhronosGroup/SYCL-CTS](https://github.com/KhronosGroup/SYCL-CTS) with required
112+
patch.
113+
57114
### Commit message
58115
59116
- When writing your commit message, please make sure to follow

buildbot/dependency.conf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ 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.03.18857
8-
ocl_gpu_rt_ver=21.03.18857
7+
# https://github.com/intel/compute-runtime/releases/tag/21.04.18912
8+
ocl_gpu_rt_ver=21.04.18912
99
# Same GPU driver supports Level Zero and OpenCL
10-
# https://downloadmirror.intel.com/30066/a08/igfx_win10_100.9030.zip
11-
ocl_gpu_rt_ver_win=27.20.100.9030
10+
# https://downloadmirror.intel.com/30148/a08/igfx_win10_100.9168.zip
11+
ocl_gpu_rt_ver_win=27.20.100.9168
1212
intel_sycl_ver=build
1313

1414
# TBB binaries can be built from sources following instructions under
@@ -25,13 +25,13 @@ ocl_fpga_emu_ver=2020.11.11.0.04
2525
ocl_fpga_emu_ver_win=2020.11.11.0.04
2626
fpga_ver=20201021_000005
2727
fpga_ver_win=20201022_000005
28-
ocloc_ver_win=27.20.100.8935
28+
ocloc_ver_win=27.20.100.9168
2929

3030
[DRIVER VERSIONS]
3131
cpu_driver_lin=2020.11.11.0.04
3232
cpu_driver_win=2020.11.11.0.04
33-
gpu_driver_lin=21.03.18857
34-
gpu_driver_win=27.20.100.9030
33+
gpu_driver_lin=21.04.18912
34+
gpu_driver_win=27.20.100.9168
3535
fpga_driver_lin=2020.11.11.0.04
3636
fpga_driver_win=2020.11.11.0.04
3737
# NVidia CUDA driver

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
156156
if (QS.DetailedASTOutput) {
157157
OS << "Binding for \"" << BI->first << "\":\n";
158158
const ASTContext &Ctx = AST->getASTContext();
159-
const SourceManager &SM = Ctx.getSourceManager();
160-
ASTDumper Dumper(OS, Ctx, SM.getDiagnostics().getShowColors());
159+
ASTDumper Dumper(OS, Ctx, AST->getDiagnostics().getShowColors());
161160
Dumper.SetTraversalKind(QS.TK);
162161
Dumper.Visit(BI->second);
163162
OS << "\n";

clang-tools-extra/clang-query/tool/ClangQuery.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ using namespace llvm;
4949
static cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
5050
static cl::OptionCategory ClangQueryCategory("clang-query options");
5151

52+
static cl::opt<bool>
53+
UseColor("use-color",
54+
cl::desc(
55+
R"(Use colors in detailed AST output. If not set, colors
56+
will be used if the terminal connected to
57+
standard output supports colors.)"),
58+
cl::init(false), cl::cat(ClangQueryCategory));
59+
5260
static cl::list<std::string> Commands("c", cl::desc("Specify command to run"),
5361
cl::value_desc("command"),
5462
cl::cat(ClangQueryCategory));
@@ -109,6 +117,19 @@ int main(int argc, const char **argv) {
109117

110118
ClangTool Tool(OptionsParser->getCompilations(),
111119
OptionsParser->getSourcePathList());
120+
121+
if (UseColor.getNumOccurrences() > 0) {
122+
ArgumentsAdjuster colorAdjustor = [](const CommandLineArguments &Args, StringRef /*unused*/) {
123+
CommandLineArguments AdjustedArgs = Args;
124+
if (UseColor)
125+
AdjustedArgs.push_back("-fdiagnostics-color");
126+
else
127+
AdjustedArgs.push_back("-fno-diagnostics-color");
128+
return AdjustedArgs;
129+
};
130+
Tool.appendArgumentsAdjuster(colorAdjustor);
131+
}
132+
112133
std::vector<std::unique_ptr<ASTUnit>> ASTs;
113134
int ASTStatus = 0;
114135
switch (Tool.buildASTs(ASTs)) {

clang-tools-extra/clangd/ClangdLSPServer.cpp

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,15 @@ class ClangdLSPServer::MessageHandler : public Transport::MessageHandler {
258258
};
259259
}
260260

261+
template <typename Result>
262+
void bind(const char *Method,
263+
void (ClangdLSPServer::*Handler)(Callback<Result>)) {
264+
Calls[Method] = [Handler, this](llvm::json::Value RawParams,
265+
ReplyOnce Reply) {
266+
(Server.*Handler)(std::move(Reply));
267+
};
268+
}
269+
261270
// Bind a reply callback to a request. The callback will be invoked when
262271
// clangd receives the reply from the LSP client.
263272
// Return a call id of the request.
@@ -301,6 +310,12 @@ class ClangdLSPServer::MessageHandler : public Transport::MessageHandler {
301310
};
302311
}
303312

313+
void bind(const char *Method, void (ClangdLSPServer::*Handler)()) {
314+
Notifications[Method] = [Handler, this](llvm::json::Value RawParams) {
315+
(Server.*Handler)();
316+
};
317+
}
318+
304319
private:
305320
// Function object to reply to an LSP call.
306321
// Each instance must be called exactly once, otherwise:
@@ -443,6 +458,14 @@ class ClangdLSPServer::MessageHandler : public Transport::MessageHandler {
443458
};
444459
constexpr int ClangdLSPServer::MessageHandler::MaxReplayCallbacks;
445460

461+
template <>
462+
void ClangdLSPServer::MessageHandler::bind<NoParams>(
463+
const char *Method, void (ClangdLSPServer::*Handler)(const NoParams &)) {
464+
Notifications[Method] = [Handler, this](llvm::json::Value RawParams) {
465+
(Server.*Handler)(NoParams{});
466+
};
467+
}
468+
446469
// call(), notify(), and reply() wrap the Transport, adding logging and locking.
447470
void ClangdLSPServer::callRaw(StringRef Method, llvm::json::Value Params,
448471
Callback<llvm::json::Value> CB) {
@@ -487,6 +510,11 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
487510
"semanticTokens request, choosing the latter (no notifications).");
488511
Opts.TheiaSemanticHighlighting = false;
489512
}
513+
if (Opts.TheiaSemanticHighlighting) {
514+
log("Using legacy semanticHighlights notification, which will be removed "
515+
"in clangd 13. Clients should use the standard semanticTokens "
516+
"request instead.");
517+
}
490518

491519
if (Params.rootUri && *Params.rootUri)
492520
Opts.WorkspaceRoot = std::string(Params.rootUri->file());
@@ -500,6 +528,7 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
500528
if (Opts.UseDirBasedCDB) {
501529
DirectoryBasedGlobalCompilationDatabase::Options CDBOpts(TFS);
502530
CDBOpts.CompileCommandsDir = Opts.CompileCommandsDir;
531+
CDBOpts.ContextProvider = Opts.ContextProvider;
503532
BaseCDB =
504533
std::make_unique<DirectoryBasedGlobalCompilationDatabase>(CDBOpts);
505534
BaseCDB = getQueryDriverDatabase(llvm::makeArrayRef(Opts.QueryDriverGlobs),
@@ -647,17 +676,15 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
647676

648677
void ClangdLSPServer::onInitialized(const InitializedParams &Params) {}
649678

650-
void ClangdLSPServer::onShutdown(const ShutdownParams &Params,
651-
Callback<std::nullptr_t> Reply) {
679+
void ClangdLSPServer::onShutdown(Callback<std::nullptr_t> Reply) {
652680
// Do essentially nothing, just say we're ready to exit.
653681
ShutdownRequestReceived = true;
654682
Reply(nullptr);
655683
}
656684

657685
// sync is a clangd extension: it blocks until all background work completes.
658686
// It blocks the calling thread, so no messages are processed until it returns!
659-
void ClangdLSPServer::onSync(const NoParams &Params,
660-
Callback<std::nullptr_t> Reply) {
687+
void ClangdLSPServer::onSync(Callback<std::nullptr_t> Reply) {
661688
if (Server->blockUntilIdleForTest(/*TimeoutSeconds=*/60))
662689
Reply(nullptr);
663690
else
@@ -1445,8 +1472,7 @@ void ClangdLSPServer::onSemanticTokensDelta(
14451472
});
14461473
}
14471474

1448-
void ClangdLSPServer::onMemoryUsage(const NoParams &,
1449-
Callback<MemoryTree> Reply) {
1475+
void ClangdLSPServer::onMemoryUsage(Callback<MemoryTree> Reply) {
14501476
llvm::BumpPtrAllocator DetailAlloc;
14511477
MemoryTree MT(&DetailAlloc);
14521478
profile(MT);

clang-tools-extra/clangd/ClangdLSPServer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ class ClangdLSPServer : private ClangdServer::Callbacks {
9393
// Calls have signature void(const Params&, Callback<Response>).
9494
void onInitialize(const InitializeParams &, Callback<llvm::json::Value>);
9595
void onInitialized(const InitializedParams &);
96-
void onShutdown(const ShutdownParams &, Callback<std::nullptr_t>);
97-
void onSync(const NoParams &, Callback<std::nullptr_t>);
96+
void onShutdown(Callback<std::nullptr_t>);
97+
void onSync(Callback<std::nullptr_t>);
9898
void onDocumentDidOpen(const DidOpenTextDocumentParams &);
9999
void onDocumentDidChange(const DidChangeTextDocumentParams &);
100100
void onDocumentDidClose(const DidCloseTextDocumentParams &);
@@ -161,7 +161,7 @@ class ClangdLSPServer : private ClangdServer::Callbacks {
161161
Callback<SemanticTokensOrDelta>);
162162
/// This is a clangd extension. Provides a json tree representing memory usage
163163
/// hierarchy.
164-
void onMemoryUsage(const NoParams &, Callback<MemoryTree>);
164+
void onMemoryUsage(Callback<MemoryTree>);
165165

166166
std::vector<Fix> getFixes(StringRef File, const clangd::Diagnostic &D);
167167

clang-tools-extra/clangd/ClangdServer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ void ClangdServer::formatOnType(PathRef File, llvm::StringRef Code,
407407
Result.push_back(replacementToEdit(Code, R));
408408
return CB(Result);
409409
};
410-
WorkScheduler.run("FormatOnType", File, std::move(Action));
410+
WorkScheduler.runQuick("FormatOnType", File, std::move(Action));
411411
}
412412

413413
void ClangdServer::prepareRename(PathRef File, Position Pos,
@@ -635,7 +635,7 @@ void ClangdServer::formatCode(PathRef File, llvm::StringRef Code,
635635
tooling::calculateRangesAfterReplacements(IncludeReplaces, Ranges),
636636
File)));
637637
};
638-
WorkScheduler.run("Format", File, std::move(Action));
638+
WorkScheduler.runQuick("Format", File, std::move(Action));
639639
}
640640

641641
void ClangdServer::findDocumentHighlights(

clang-tools-extra/clangd/CodeComplete.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,9 @@ bool semaCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer,
11231123
// skip all includes in this case; these completions are really simple.
11241124
PreambleBounds PreambleRegion =
11251125
ComputePreambleBounds(*CI->getLangOpts(), *ContentsBuffer, 0);
1126-
bool CompletingInPreamble = PreambleRegion.Size > Input.Offset;
1126+
bool CompletingInPreamble = Input.Offset < PreambleRegion.Size ||
1127+
(!PreambleRegion.PreambleEndsAtStartOfLine &&
1128+
Input.Offset == PreambleRegion.Size);
11271129
if (Input.Patch)
11281130
Input.Patch->apply(*CI);
11291131
// NOTE: we must call BeginSourceFile after prepareCompilerInstance. Otherwise

0 commit comments

Comments
 (0)