Skip to content

Commit b393637

Browse files
committed
Merge remote-tracking branch 'upstream/sycl' into sycl
2 parents 3216a58 + f836604 commit b393637

File tree

1,936 files changed

+74742
-27873
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,936 files changed

+74742
-27873
lines changed

.github/CODEOWNERS

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
clang/ @erichkeane, @Fznamznon
1+
* @bader
22

3-
clang/**/Driver @mdtoguchi @AGindinson
3+
clang/ @erichkeane @Fznamznon
44

5-
llvm-spirv/ @AlexeySotkin, @AlexeySachkov
5+
clang/**/Driver @mdtoguchi @AGindinson
66

7-
opencl-aot/ @dm-vodopyanov, @AlexeySachkov, @romanovvlad
7+
llvm-spirv/ @AlexeySotkin @AlexeySachkov
88

9-
libdevice/ @asavonic, @vzakhari
9+
opencl-aot/ @dm-vodopyanov @AlexeySachkov @romanovvlad
1010

11-
sycl/doc/extensions/ @mkinsner, @jbrodman
11+
libdevice/ @asavonic @vzakhari
1212

13-
sycl/doc/ @pvchupin, @kbobrovs
13+
sycl/ @romanovvlad @bader
1414

15-
sycl/ @romanovvlad, @bader
15+
sycl/doc/ @pvchupin @kbobrovs
1616

17-
xpti/ @tovinkere, @andykaylor
17+
sycl/doc/extensions/ @mkinsner @jbrodman
1818

19-
* @bader
19+
xpti/ @tovinkere @andykaylor

.github/workflows/linux_post_commit.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
config: ["Default", "SharedLibs", "Assertions"]
13+
config: ["Default", "SharedLibs", "NoAssertions"]
1414

1515
steps:
1616
- uses: actions/checkout@v2
@@ -28,14 +28,14 @@ jobs:
2828
SharedLibs)
2929
export ARGS="--shared-libs"
3030
;;
31-
Assertiosn)
32-
export ARGS="--assertions"
31+
NoAssertions)
32+
export ARGS="--no-assertions"
3333
;;
3434
esac
3535
mkdir -p $GITHUB_WORKSPACE/build
3636
cd $GITHUB_WORKSPACE/build
3737
python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \
38-
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t Release --no-ocl $ARGS
38+
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t Release $ARGS
3939
- name: Compile
4040
run: |
4141
python3 $GITHUB_WORKSPACE/src/buildbot/compile.py -w $GITHUB_WORKSPACE \

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
# Nested build directory
2525
/build*
26+
!buildbot
2627

2728
#==============================================================================#
2829
# Explicit files to ignore (only matches one).

CONTRIBUTING.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,41 @@ commit automatically with `git commit -s`.
6969

7070
### Development
7171

72+
**NB**: For any changes not related to DPC++, but rather to LLVM in general, it
73+
is strongly encouraged that you submit the patch to https://llvm.org/ directly.
74+
See [LLVM contribution guidelines](https://llvm.org/docs/Contributing.html)
75+
for more information.
76+
7277
- Create a personal fork of the project on GitHub
7378
- For the DPC++ Compiler project, use **sycl** branch as baseline for your
7479
changes. See [Get Started Guide](sycl/doc/GetStartedGuide.md).
7580
- Prepare your patch (follow
76-
[LLVM coding standards](https://llvm.org/docs/CodingStandards.html))
77-
- Build the project and run all tests
81+
[LLVM coding standards](https://llvm.org/docs/CodingStandards.html)).
82+
[clang-format](https://clang.llvm.org/docs/ClangFormat.html) and [clang-tidy](
83+
https://clang.llvm.org/extra/clang-tidy/) tools can be integrated into your
84+
workflow to ensure formatting and stylistic compliance of your changes.
85+
- Build the project and run all tests.
86+
87+
### Commit message
88+
89+
- When writing your commit message, please make sure to follow
90+
[LLVM developer policies](
91+
https://llvm.org/docs/DeveloperPolicy.html#commit-messages) on the subject.
92+
- For any DPC++-related commit, the `[SYCL]` tag should be present in the
93+
commit message title. To a reasonable extent, additional tags can be used
94+
to signify the component changed, e.g.: `[PI]`, `[CUDA]`, `[Doc]`.
7895

7996
### Review and acceptance testing
8097

8198
- Create a pull request for your changes following [Creating a pull request
82-
instructions](https://help.github.com/articles/creating-a-pull-request/)
83-
- CI will run signed-off check as soon as PR is created, see **check_pr** CI
84-
check for results
85-
- CI will run build and functional testing check as soon as PR is approved by
86-
Intel representative
87-
- New approval is needed if PR was updated (e.g. during code review)
88-
- Once PR is approved and all checks pass, the pull request is ready for merge
99+
instructions](https://help.github.com/articles/creating-a-pull-request/).
100+
- CI will run a signed-off check as soon as your PR is created - see the
101+
**check_pr** CI action results.
102+
- CI will run several build and functional testing checks as soon as the PR is
103+
approved by an Intel representative.
104+
- A new approval is needed if the PR was updated (e.g. during code review).
105+
- Once the PR is approved and all checks have passed, the pull request is
106+
ready for merge.
89107

90108
### Merge
91109

@@ -98,4 +116,3 @@ commits pulled from the LLVM community repository
98116

99117

100118
*Other names and brands may be claimed as the property of others.
101-

buildbot/compile.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import argparse
2-
import os
2+
import multiprocessing
33
import subprocess
44
import sys
55

66
DEFAULT_CPU_COUNT = 4
77

88

99
def do_compile(args):
10-
cpu_count = os.cpu_count()
11-
if cpu_count is None:
10+
try:
11+
cpu_count = multiprocessing.cpu_count()
12+
except NotImplementedError:
1213
cpu_count = DEFAULT_CPU_COUNT
1314

1415
make_cmd = ["ninja", "-j", str(cpu_count), "deploy-sycl-toolchain", "deploy-opencl-aot"]

buildbot/configure.py

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,29 @@
44
import sys
55
import platform
66

7+
# TODO:
8+
# 1. Make all required options optional
9+
# 2. Create obj_dir from the script if it doesn't exist
10+
711
def do_configure(args):
812
ret = False
913

10-
llvm_dir = os.path.join(args.src_dir, "llvm")
11-
sycl_dir = os.path.join(args.src_dir, "sycl")
12-
spirv_dir = os.path.join(args.src_dir, "llvm-spirv")
13-
xpti_dir = os.path.join(args.src_dir, "xpti")
14-
libdevice_dir = os.path.join(args.src_dir, "libdevice")
15-
ocl_header_dir = os.path.join(args.obj_dir, "OpenCL-Headers")
16-
icd_loader_lib = os.path.join(args.obj_dir, "OpenCL-ICD-Loader", "build")
14+
# Get absolute paths
15+
abs_src_dir = os.path.abspath(args.src_dir)
16+
abs_obj_dir = os.path.abspath(args.obj_dir)
17+
18+
llvm_dir = os.path.join(abs_src_dir, "llvm")
19+
sycl_dir = os.path.join(abs_src_dir, "sycl")
20+
spirv_dir = os.path.join(abs_src_dir, "llvm-spirv")
21+
xpti_dir = os.path.join(abs_src_dir, "xpti")
22+
libdevice_dir = os.path.join(abs_src_dir, "libdevice")
23+
ocl_header_dir = os.path.join(abs_obj_dir, "OpenCL-Headers")
24+
icd_loader_lib = os.path.join(abs_obj_dir, "OpenCL-ICD-Loader", "build")
1725
llvm_targets_to_build = 'X86'
1826
llvm_enable_projects = 'clang;llvm-spirv;sycl;opencl-aot;xpti;libdevice'
1927
libclc_targets_to_build = ''
2028
sycl_build_pi_cuda = 'OFF'
29+
sycl_werror = 'ON'
2130
llvm_enable_assertions = 'ON'
2231
llvm_enable_doxygen = 'OFF'
2332
llvm_enable_sphinx = 'OFF'
@@ -34,8 +43,11 @@ def do_configure(args):
3443
libclc_targets_to_build = 'nvptx64--;nvptx64--nvidiacl'
3544
sycl_build_pi_cuda = 'ON'
3645

37-
if args.assertions:
38-
llvm_enable_assertions = 'ON'
46+
if args.no_werror:
47+
sycl_werror = 'OFF'
48+
49+
if args.no_assertions:
50+
llvm_enable_assertions = 'OFF'
3951

4052
if args.docs:
4153
llvm_enable_doxygen = 'ON'
@@ -44,7 +56,7 @@ def do_configure(args):
4456
if args.shared_libs:
4557
llvm_build_shared_libs = 'ON'
4658

47-
install_dir = os.path.join(args.obj_dir, "install")
59+
install_dir = os.path.join(abs_obj_dir, "install")
4860

4961
cmake_cmd = [
5062
"cmake",
@@ -61,37 +73,43 @@ def do_configure(args):
6173
"-DLIBCLC_TARGETS_TO_BUILD={}".format(libclc_targets_to_build),
6274
"-DSYCL_BUILD_PI_CUDA={}".format(sycl_build_pi_cuda),
6375
"-DLLVM_BUILD_TOOLS=ON",
64-
"-DSYCL_ENABLE_WERROR=ON",
76+
"-DSYCL_ENABLE_WERROR={}".format(sycl_werror),
6577
"-DCMAKE_INSTALL_PREFIX={}".format(install_dir),
6678
"-DSYCL_INCLUDE_TESTS=ON", # Explicitly include all kinds of SYCL tests.
6779
"-DLLVM_ENABLE_DOXYGEN={}".format(llvm_enable_doxygen),
6880
"-DLLVM_ENABLE_SPHINX={}".format(llvm_enable_sphinx),
6981
"-DBUILD_SHARED_LIBS={}".format(llvm_build_shared_libs),
70-
"-DSYCL_ENABLE_XPTI_TRACING=ON", # Explicitly turn on XPTI tracing
71-
llvm_dir
82+
"-DSYCL_ENABLE_XPTI_TRACING=ON" # Explicitly turn on XPTI tracing
7283
]
7384

74-
if not args.no_ocl:
85+
if args.system_ocl:
7586
cmake_cmd.extend([
7687
"-DOpenCL_INCLUDE_DIR={}".format(ocl_header_dir),
7788
"-DOpenCL_LIBRARY={}".format(icd_loader_lib)])
7889

90+
# Add additional CMake options if provided
91+
if args.cmake_opt:
92+
cmake_cmd += args.cmake_opt
93+
94+
# Add path to root CMakeLists.txt
95+
cmake_cmd.append(llvm_dir)
96+
7997
print(cmake_cmd)
8098

8199
try:
82-
subprocess.check_call(cmake_cmd, cwd=args.obj_dir)
100+
subprocess.check_call(cmake_cmd, cwd=abs_obj_dir)
83101
except subprocess.CalledProcessError:
84-
cmake_cache = os.path.join(args.obj_dir, "CMakeCache.txt")
102+
cmake_cache = os.path.join(abs_obj_dir, "CMakeCache.txt")
85103
if os.path.isfile(cmake_cache):
86104
os.remove(cmake_cache)
87-
subprocess.check_call(cmake_cmd, cwd=args.obj_dir)
105+
subprocess.check_call(cmake_cmd, cwd=abs_obj_dir)
88106

89107
ret = True
90108
return ret
91109

92110
def main():
93111
parser = argparse.ArgumentParser(prog="configure.py",
94-
description="script to do configure",
112+
description="Generate build files from CMake configuration files",
95113
formatter_class=argparse.RawTextHelpFormatter)
96114
parser.add_argument("-n", "--build-number", metavar="BUILD_NUM", help="build number")
97115
parser.add_argument("-b", "--branch", metavar="BRANCH", help="pull request branch")
@@ -104,10 +122,12 @@ def main():
104122
parser.add_argument("-t", "--build-type",
105123
metavar="BUILD_TYPE", required=True, help="build type, debug or release")
106124
parser.add_argument("--cuda", action='store_true', help="switch from OpenCL to CUDA")
107-
parser.add_argument("--assertions", action='store_true', help="build with assertions")
125+
parser.add_argument("--no-assertions", action='store_true', help="build without assertions")
108126
parser.add_argument("--docs", action='store_true', help="build Doxygen documentation")
109-
parser.add_argument("--no-ocl", action='store_true', help="download OpenCL deps via CMake")
127+
parser.add_argument("--system-ocl", action='store_true', help="use OpenCL deps from system (no download)")
128+
parser.add_argument("--no-werror", action='store_true', help="Don't treat warnings as errors")
110129
parser.add_argument("--shared-libs", action='store_true', help="Build shared libraries")
130+
parser.add_argument("--cmake-opt", action='append', help="Additional CMake option not configured via script parameters")
111131

112132
args = parser.parse_args()
113133

clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,26 @@ groupReplacements(const TUReplacements &TUs, const TUDiagnostics &TUDs,
143143
llvm::DenseMap<const FileEntry *, std::vector<tooling::Replacement>>
144144
GroupedReplacements;
145145

146-
// Deduplicate identical replacements in diagnostics.
146+
// Deduplicate identical replacements in diagnostics unless they are from the
147+
// same TU.
147148
// FIXME: Find an efficient way to deduplicate on diagnostics level.
148-
llvm::DenseMap<const FileEntry *, std::set<tooling::Replacement>>
149+
llvm::DenseMap<const FileEntry *,
150+
std::map<tooling::Replacement,
151+
const tooling::TranslationUnitDiagnostics *>>
149152
DiagReplacements;
150153

151-
auto AddToGroup = [&](const tooling::Replacement &R, bool FromDiag) {
154+
auto AddToGroup = [&](const tooling::Replacement &R,
155+
const tooling::TranslationUnitDiagnostics *SourceTU) {
152156
// Use the file manager to deduplicate paths. FileEntries are
153157
// automatically canonicalized.
154158
if (auto Entry = SM.getFileManager().getFile(R.getFilePath())) {
155-
if (FromDiag) {
159+
if (SourceTU) {
156160
auto &Replaces = DiagReplacements[*Entry];
157-
if (!Replaces.insert(R).second)
161+
auto It = Replaces.find(R);
162+
if (It == Replaces.end())
163+
Replaces.emplace(R, SourceTU);
164+
else if (It->second != SourceTU)
165+
// This replacement is a duplicate of one suggested by another TU.
158166
return;
159167
}
160168
GroupedReplacements[*Entry].push_back(R);
@@ -166,14 +174,14 @@ groupReplacements(const TUReplacements &TUs, const TUDiagnostics &TUDs,
166174

167175
for (const auto &TU : TUs)
168176
for (const tooling::Replacement &R : TU.Replacements)
169-
AddToGroup(R, false);
177+
AddToGroup(R, nullptr);
170178

171179
for (const auto &TU : TUDs)
172180
for (const auto &D : TU.Diagnostics)
173181
if (const auto *ChoosenFix = tooling::selectFirstFix(D)) {
174182
for (const auto &Fix : *ChoosenFix)
175183
for (const tooling::Replacement &R : Fix.second)
176-
AddToGroup(R, true);
184+
AddToGroup(R, &TU);
177185
}
178186

179187
// Sort replacements per file to keep consistent behavior when

0 commit comments

Comments
 (0)