Skip to content

Commit 4877aad

Browse files
committed
Merge branch 'sycl' into oneapins
2 parents 8f04df7 + 13e8dae commit 4877aad

File tree

1,851 files changed

+62053
-20653
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,851 files changed

+62053
-20653
lines changed

.arclint

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"script-and-regex.regex": "/^(?P<severity>[[:alpha:]]+)\n(?P<message>[^\n]+)\n(====|(?P<line>\\d),(?P<char>\\d)\n(?P<original>.*)>>>>\n(?P<replacement>.*)<<<<\n)$/s",
77
"include": [
88
"(\\.(cc|cpp|h)$)"
9+
],
10+
"exclude": [
11+
"(^clang/test/)"
912
]
1013
}
1114
}

CONTRIBUTING.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,25 @@ for more information.
2424
- For the DPC++ Compiler project, use **sycl** branch as baseline for your
2525
changes. See [Get Started Guide](sycl/doc/GetStartedGuide.md).
2626
- Prepare your patch
27-
- follow [LLVM coding standards](https://llvm.org/docs/CodingStandards.html)
28-
- [clang-format](https://clang.llvm.org/docs/ClangFormat.html) and
29-
[clang-tidy](https://clang.llvm.org/extra/clang-tidy/) tools can be
30-
integrated into your workflow to ensure formatting and stylistic
31-
compliance of your changes.
32-
- use
33-
```
34-
./clang/tools/clang-format/git-clang-format `git merge-base origin/sycl HEAD`
35-
```
36-
to check the format of your current changes against the `origin/sycl`
37-
branch.
38-
- `-f` to also correct unstaged changes
39-
- `--diff` to only print the diff without applying
40-
- Build the project and run all tests.
41-
- complete test suite: `python buildbot/check.py`
42-
- sycl test suite `python buildbot/check.py -t test-sycl`
43-
- run only "mytest" test `python buildbot/check.py -t test-sycl-mytest`
44-
- if necessary, use `-o $LLVM_BUILD_DIR` to specify the llvm build directory
27+
- follow [LLVM coding standards](https://llvm.org/docs/CodingStandards.html)
28+
- [clang-format](https://clang.llvm.org/docs/ClangFormat.html) and
29+
[clang-tidy](https://clang.llvm.org/extra/clang-tidy/) tools can be
30+
integrated into your workflow to ensure formatting and stylistic
31+
compliance of your changes.
32+
- use
33+
34+
```bash
35+
./clang/tools/clang-format/git-clang-format `git merge-base origin/sycl HEAD`
36+
```
37+
38+
to check the format of your current changes against the `origin/sycl`
39+
branch.
40+
- `-f` to also correct unstaged changes
41+
- `--diff` to only print the diff without applying
42+
- Build the project following
43+
[Get Started Guide instructions](sycl/doc/GetStartedGuide.md#build-dpc-toolchain).
44+
- Run regression tests -
45+
[instructions](sycl/doc/GetStartedGuide.md#test-dpc-toolchain).
4546

4647
### Commit message
4748

@@ -67,6 +68,7 @@ ready for merge.
6768
### Merge
6869

6970
Project maintainers merge pull requests using one of the following options:
71+
7072
- [Rebase and merge] The preferable choice for PRs containing a single commit
7173
- [Squash and merge] Used when there are multiple commits in the PR
7274
- Squashing is done to make sure that the project is buildable on any commit

buildbot/compile.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ def do_compile(args):
1313
except NotImplementedError:
1414
cpu_count = DEFAULT_CPU_COUNT
1515

16+
if args.build_parallelism:
17+
cpu_count = int(args.build_parallelism)
18+
1619
# Get absolute path to source directory
1720
if args.src_dir:
1821
abs_src_dir = os.path.abspath(args.src_dir)
@@ -51,6 +54,7 @@ def main():
5154
help="builder directory, which is the directory contains source and build directories")
5255
parser.add_argument("-s", "--src-dir", metavar="SRC_DIR", help="source directory")
5356
parser.add_argument("-o", "--obj-dir", metavar="OBJ_DIR", help="build directory")
57+
parser.add_argument("-j", "--build-parallelism", metavar="BUILD_PARALLELISM", help="build parallelism")
5458

5559
args = parser.parse_args()
5660

buildbot/dependency.conf

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ ocl_gpu_rt_ver=20.29.17408
1010
# https://downloadmirror.intel.com/29674/a08/igfx_win10_100.8336.zip
1111
ocl_gpu_rt_ver_win=27.20.100.8336
1212
intel_sycl_ver=build
13-
# TODO provide URL for Linux TBB driver
13+
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.1-beta08/oneapi-tbb-2021.1-beta08-lin.tgz
1414
tbb_ver=2021.1.8.515
15-
# TODO provide URL for Windows TBB driver
15+
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.1-beta08/oneapi-tbb-2021.1-beta08-win.zip
1616
tbb_ver_win=2021.1.8.514
1717
# https://github.com/intel/llvm/releases/download/2020-WW31/fpgaemu-2020.10.7.0.15_rel.tar.gz
1818
ocl_fpga_emu_ver=2020.10.7.0.15
@@ -31,3 +31,16 @@ fpga_driver_win=2020.10.7.0.15
3131
# NVidia CUDA driver
3232
# TODO provide URL for CUDA driver
3333
nvidia_gpu_driver_lin=435.21
34+
35+
[DEPS ROOT]
36+
ocl_cpu_root={DEPS_ROOT}/opencl/runtime/linux/oclcpu
37+
ocl_gpu_root={DEPS_ROOT}/opencl/runtime/linux/oclgpu
38+
fpga_root={ARCHIVE_ROOT}/comp/oclfpga/linux
39+
ocl_fpga_emu_root={DEPS_ROOT}/opencl/runtime/linux/oclfpgaemu
40+
tbb_root={DEPS_ROOT}/tbb/lin
41+
42+
ocl_cpu_root_win={DEPS_ROOT}/opencl/runtime/win/oclcpu
43+
ocl_gpu_root_win=
44+
fpga_root_win={ARCHIVE_ROOT}/comp/oclfpga/win
45+
ocl_fpga_emu_root_win={DEPS_ROOT}/opencl/runtime/win/oclfpgaemu
46+
tbb_root_win={DEPS_ROOT}/tbb/win

buildbot/linux.vrd

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# For TBB
2+
:eadb LD_LIBRARY_PATH={TBBROOT}/{TBBVER}/lib/intel64/gcc4.8
3+
4+
# For CPU
5+
:eadb LD_LIBRARY_PATH={OCLCPUROOT}/{OCLCPUVER}/intel64_lin
6+
:eadb OCL_ICD_FILENAMES={OCLCPUROOT}/{OCLCPUVER}/intel64_lin/libintelocl.so
7+
8+
# For GPU
9+
:eade LD_LIBRARY_PATH={OCLGPUROOT}/{OCLGPUVER}
10+
:eade PATH={OCLGPUROOT}/{OCLGPUVER}
11+
:eade OCL_ICD_FILENAMES={OCLGPUROOT}/{OCLGPUVER}/libigdrcl.so
12+
13+
# For FPGA
14+
:eadb PATH={OCLFPGAROOT}/{OCLFPGAVER}/build/bin
15+
16+
# For FPGA EMU
17+
:eadb LD_LIBRARY_PATH={OCLFPGAEMUROOT}/{OCLFPGAEMUVER}
18+
:eadb LD_LIBRARY_PATH={OCLFPGAEMUROOT}/{OCLFPGAEMUVER}/intel64_lin
19+
:eadb PATH={OCLFPGAEMUROOT}/{OCLFPGAEMUVER}/bin
20+
:eadb OCL_ICD_FILENAMES={OCLFPGAEMUROOT}/{OCLFPGAEMUVER}/libintelocl_emu.so
21+
22+
# For Compiler
23+
:eadb PATH={COMP_ROOT}/bin
24+
:eadb LD_LIBRARY_PATH={COMP_ROOT}/lib
25+
:eadb PATH={COMP_ROOT}/install/bin
26+
:eadb LD_LIBRARY_PATH={COMP_ROOT}/install/lib

buildbot/windows.vrd

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# For TBB
2+
:eadb PATH={TBBROOT}/{TBBVER}/redist/intel64/vc14
3+
:eadb LIB={TBBROOT}/{TBBVER}/lib/intel64/vc14
4+
:eadb INCLUDE={TBBROOT}/{TBBVER}/include
5+
:eadb CPATH={TBBROOT}/{TBBVER}/include
6+
7+
# For CPU
8+
:eadb PATH={OCLCPUROOT}/{OCLCPUVER}/intel64_win
9+
:eadb OCL_ICD_FILENAMES={OCLCPUROOT}/{OCLCPUVER}/intel64_win/intelocl64.dll
10+
11+
# For FPGA
12+
:eadb PATH={OCLFPGAROOT}/{OCLFPGAVER}/build/bin
13+
14+
# For FPGA EMU
15+
:eadb PATH={OCLFPGAEMUROOT}/{OCLFPGAEMUVER}/bin
16+
:eadb PATH={OCLFPGAEMUROOT}/{OCLFPGAEMUVER}/intel64_win
17+
:eadb OCL_ICD_FILENAMES={OCLFPGAEMUROOT}/{OCLFPGAEMUVER}/intelocl64_emu.dll
18+
19+
# For Compiler
20+
:eadb PATH={COMP_ROOT}/bin
21+
:eadb PATH={COMP_ROOT}/lib
22+
:eadb PATH={COMP_ROOT}/install/bin
23+
:eadb PATH={COMP_ROOT}/install/lib

clang-tools-extra/clang-include-fixer/find-all-symbols/FindAllSymbols.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ CreateSymbolInfo(const NamedDecl *ND, const SourceManager &SM,
9999

100100
SourceLocation Loc = SM.getExpansionLoc(ND->getLocation());
101101
if (!Loc.isValid()) {
102-
llvm::errs() << "Declaration " << ND->getNameAsString() << "("
102+
llvm::errs() << "Declaration " << ND->getDeclName() << "("
103103
<< ND->getDeclKindName()
104104
<< ") has invalid declaration location.";
105105
return llvm::None;

clang-tools-extra/clang-move/HelperDeclRefGraph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void HelperDeclRGBuilder::run(
116116
const auto *DC = Result.Nodes.getNodeAs<Decl>("dc");
117117
assert(DC);
118118
LLVM_DEBUG(llvm::dbgs() << "Find helper function usage: "
119-
<< FuncRef->getDecl()->getNameAsString() << " ("
119+
<< FuncRef->getDecl()->getDeclName() << " ("
120120
<< FuncRef->getDecl() << ")\n");
121121
RG->addEdge(
122122
getOutmostClassOrFunDecl(DC->getCanonicalDecl()),
@@ -126,7 +126,7 @@ void HelperDeclRGBuilder::run(
126126
const auto *DC = Result.Nodes.getNodeAs<Decl>("dc");
127127
assert(DC);
128128
LLVM_DEBUG(llvm::dbgs()
129-
<< "Find helper class usage: " << UsedClass->getNameAsString()
129+
<< "Find helper class usage: " << UsedClass->getDeclName()
130130
<< " (" << UsedClass << ")\n");
131131
RG->addEdge(getOutmostClassOrFunDecl(DC->getCanonicalDecl()), UsedClass);
132132
}

clang-tools-extra/clang-move/Move.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -675,8 +675,8 @@ void ClangMoveTool::run(const ast_matchers::MatchFinder::MatchResult &Result) {
675675
Result.Nodes.getNodeAs<NamedDecl>("helper_decls")) {
676676
MovedDecls.push_back(ND);
677677
HelperDeclarations.push_back(ND);
678-
LLVM_DEBUG(llvm::dbgs() << "Add helper : " << ND->getNameAsString() << " ("
679-
<< ND << ")\n");
678+
LLVM_DEBUG(llvm::dbgs()
679+
<< "Add helper : " << ND->getDeclName() << " (" << ND << ")\n");
680680
} else if (const auto *UD = Result.Nodes.getNodeAs<NamedDecl>("using_decl")) {
681681
MovedDecls.push_back(UD);
682682
}
@@ -735,12 +735,12 @@ void ClangMoveTool::removeDeclsInOldFiles() {
735735
// We remove the helper declarations which are not used in the old.cc after
736736
// moving the given declarations.
737737
for (const auto *D : HelperDeclarations) {
738-
LLVM_DEBUG(llvm::dbgs() << "Check helper is used: "
739-
<< D->getNameAsString() << " (" << D << ")\n");
738+
LLVM_DEBUG(llvm::dbgs() << "Check helper is used: " << D->getDeclName()
739+
<< " (" << D << ")\n");
740740
if (!UsedDecls.count(HelperDeclRGBuilder::getOutmostClassOrFunDecl(
741741
D->getCanonicalDecl()))) {
742742
LLVM_DEBUG(llvm::dbgs() << "Helper removed in old.cc: "
743-
<< D->getNameAsString() << " (" << D << ")\n");
743+
<< D->getDeclName() << " (" << D << ")\n");
744744
RemovedDecls.push_back(D);
745745
}
746746
}
@@ -820,7 +820,7 @@ void ClangMoveTool::moveDeclsToNewFiles() {
820820
D->getCanonicalDecl())))
821821
continue;
822822

823-
LLVM_DEBUG(llvm::dbgs() << "Helper used in new.cc: " << D->getNameAsString()
823+
LLVM_DEBUG(llvm::dbgs() << "Helper used in new.cc: " << D->getDeclName()
824824
<< " " << D << "\n");
825825
ActualNewCCDecls.push_back(D);
826826
}

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

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "llvm/ADT/SmallString.h"
1111
#include "llvm/ADT/StringRef.h"
1212
#include "llvm/Support/Error.h"
13+
#include "llvm/Support/WithColor.h"
1314
#include "llvm/Support/raw_ostream.h"
1415

1516
namespace clang {
@@ -126,7 +127,7 @@ bool ClangTidyCheck::OptionsView::get<bool>(StringRef LocalName,
126127
llvm::Expected<bool> ValueOr = get<bool>(LocalName);
127128
if (ValueOr)
128129
return *ValueOr;
129-
logErrToStdErr(ValueOr.takeError());
130+
logIfOptionParsingError(ValueOr.takeError());
130131
return Default;
131132
}
132133

@@ -145,7 +146,7 @@ bool ClangTidyCheck::OptionsView::getLocalOrGlobal<bool>(StringRef LocalName,
145146
llvm::Expected<bool> ValueOr = getLocalOrGlobal<bool>(LocalName);
146147
if (ValueOr)
147148
return *ValueOr;
148-
logErrToStdErr(ValueOr.takeError());
149+
logIfOptionParsingError(ValueOr.takeError());
149150
return Default;
150151
}
151152

@@ -204,13 +205,33 @@ llvm::Expected<int64_t> ClangTidyCheck::OptionsView::getEnumInt(
204205
Iter->getValue().Value);
205206
}
206207

207-
void ClangTidyCheck::OptionsView::logErrToStdErr(llvm::Error &&Err) {
208-
llvm::logAllUnhandledErrors(
209-
llvm::handleErrors(std::move(Err),
210-
[](const MissingOptionError &) -> llvm::Error {
211-
return llvm::Error::success();
212-
}),
213-
llvm::errs(), "warning: ");
208+
void ClangTidyCheck::OptionsView::logIfOptionParsingError(llvm::Error &&Err) {
209+
if (auto RemainingErrors =
210+
llvm::handleErrors(std::move(Err), [](const MissingOptionError &) {}))
211+
llvm::logAllUnhandledErrors(std::move(RemainingErrors),
212+
llvm::WithColor::warning());
214213
}
214+
215+
template <>
216+
Optional<std::string> ClangTidyCheck::OptionsView::getOptional<std::string>(
217+
StringRef LocalName) const {
218+
if (auto ValueOr = get(LocalName))
219+
return *ValueOr;
220+
else
221+
consumeError(ValueOr.takeError());
222+
return llvm::None;
223+
}
224+
225+
template <>
226+
Optional<std::string>
227+
ClangTidyCheck::OptionsView::getOptionalLocalOrGlobal<std::string>(
228+
StringRef LocalName) const {
229+
if (auto ValueOr = getLocalOrGlobal(LocalName))
230+
return *ValueOr;
231+
else
232+
consumeError(ValueOr.takeError());
233+
return llvm::None;
234+
}
235+
215236
} // namespace tidy
216237
} // namespace clang

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

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
268268
if (llvm::Expected<T> ValueOr = get<T>(LocalName))
269269
return *ValueOr;
270270
else
271-
logErrToStdErr(ValueOr.takeError());
271+
logIfOptionParsingError(ValueOr.takeError());
272272
return Default;
273273
}
274274

@@ -314,7 +314,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
314314
if (llvm::Expected<T> ValueOr = getLocalOrGlobal<T>(LocalName))
315315
return *ValueOr;
316316
else
317-
logErrToStdErr(ValueOr.takeError());
317+
logIfOptionParsingError(ValueOr.takeError());
318318
return Default;
319319
}
320320

@@ -353,7 +353,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
353353
if (auto ValueOr = get<T>(LocalName, IgnoreCase))
354354
return *ValueOr;
355355
else
356-
logErrToStdErr(ValueOr.takeError());
356+
logIfOptionParsingError(ValueOr.takeError());
357357
return Default;
358358
}
359359

@@ -395,10 +395,35 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
395395
if (auto ValueOr = getLocalOrGlobal<T>(LocalName, IgnoreCase))
396396
return *ValueOr;
397397
else
398-
logErrToStdErr(ValueOr.takeError());
398+
logIfOptionParsingError(ValueOr.takeError());
399399
return Default;
400400
}
401401

402+
/// Returns the value for the option \p LocalName represented as a ``T``.
403+
/// If the option is missing returns None, if the option can't be parsed
404+
/// as a ``T``, log that to stderr and return None.
405+
template <typename T = std::string>
406+
llvm::Optional<T> getOptional(StringRef LocalName) const {
407+
if (auto ValueOr = get<T>(LocalName))
408+
return *ValueOr;
409+
else
410+
logIfOptionParsingError(ValueOr.takeError());
411+
return llvm::None;
412+
}
413+
414+
/// Returns the value for the local or global option \p LocalName
415+
/// represented as a ``T``.
416+
/// If the option is missing returns None, if the
417+
/// option can't be parsed as a ``T``, log that to stderr and return None.
418+
template <typename T = std::string>
419+
llvm::Optional<T> getOptionalLocalOrGlobal(StringRef LocalName) const {
420+
if (auto ValueOr = getLocalOrGlobal<T>(LocalName))
421+
return *ValueOr;
422+
else
423+
logIfOptionParsingError(ValueOr.takeError());
424+
return llvm::None;
425+
}
426+
402427
/// Stores an option with the check-local name \p LocalName with
403428
/// string value \p Value to \p Options.
404429
void store(ClangTidyOptions::OptionMap &Options, StringRef LocalName,
@@ -456,7 +481,8 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
456481
void storeInt(ClangTidyOptions::OptionMap &Options, StringRef LocalName,
457482
int64_t Value) const;
458483

459-
static void logErrToStdErr(llvm::Error &&Err);
484+
/// Logs an Error to stderr if a \p Err is not a MissingOptionError.
485+
static void logIfOptionParsingError(llvm::Error &&Err);
460486

461487
std::string NamePrefix;
462488
const ClangTidyOptions::OptionMap &CheckOptions;
@@ -524,6 +550,19 @@ void ClangTidyCheck::OptionsView::store<bool>(
524550
ClangTidyOptions::OptionMap &Options, StringRef LocalName,
525551
bool Value) const;
526552

553+
/// Returns the value for the option \p LocalName.
554+
/// If the option is missing returns None.
555+
template <>
556+
Optional<std::string> ClangTidyCheck::OptionsView::getOptional<std::string>(
557+
StringRef LocalName) const;
558+
559+
/// Returns the value for the local or global option \p LocalName.
560+
/// If the option is missing returns None.
561+
template <>
562+
Optional<std::string>
563+
ClangTidyCheck::OptionsView::getOptionalLocalOrGlobal<std::string>(
564+
StringRef LocalName) const;
565+
527566
} // namespace tidy
528567
} // namespace clang
529568

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct NOptionMap {
7070
NOptionMap(IO &, const ClangTidyOptions::OptionMap &OptionMap) {
7171
Options.reserve(OptionMap.size());
7272
for (const auto &KeyValue : OptionMap)
73-
Options.emplace_back(KeyValue.getKey(), KeyValue.getValue().Value);
73+
Options.emplace_back(std::string(KeyValue.getKey()), KeyValue.getValue().Value);
7474
}
7575
ClangTidyOptions::OptionMap denormalize(IO &) {
7676
ClangTidyOptions::OptionMap Map;

0 commit comments

Comments
 (0)