Skip to content

Commit a7ecb95

Browse files
author
Sergey Kanaev
committed
Merge branch 'sycl' into private/s-kanaev/fix
2 parents 5268837 + ee21d66 commit a7ecb95

File tree

1,928 files changed

+74419
-27813
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,928 files changed

+74419
-27813
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: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,28 @@
55
import platform
66

77
# TODO:
8-
# 1. Add support for relative paths (e.g. relative path to source directory)
8+
# 1. Make all required options optional
99
# 2. Create obj_dir from the script if it doesn't exist
1010

1111
def do_configure(args):
1212
ret = False
1313

14-
llvm_dir = os.path.join(args.src_dir, "llvm")
15-
sycl_dir = os.path.join(args.src_dir, "sycl")
16-
spirv_dir = os.path.join(args.src_dir, "llvm-spirv")
17-
xpti_dir = os.path.join(args.src_dir, "xpti")
18-
libdevice_dir = os.path.join(args.src_dir, "libdevice")
19-
ocl_header_dir = os.path.join(args.obj_dir, "OpenCL-Headers")
20-
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")
2125
llvm_targets_to_build = 'X86'
2226
llvm_enable_projects = 'clang;llvm-spirv;sycl;opencl-aot;xpti;libdevice'
2327
libclc_targets_to_build = ''
2428
sycl_build_pi_cuda = 'OFF'
29+
sycl_werror = 'ON'
2530
llvm_enable_assertions = 'ON'
2631
llvm_enable_doxygen = 'OFF'
2732
llvm_enable_sphinx = 'OFF'
@@ -38,8 +43,11 @@ def do_configure(args):
3843
libclc_targets_to_build = 'nvptx64--;nvptx64--nvidiacl'
3944
sycl_build_pi_cuda = 'ON'
4045

41-
if args.assertions:
42-
llvm_enable_assertions = 'ON'
46+
if args.no_werror:
47+
sycl_werror = 'OFF'
48+
49+
if args.no_assertions:
50+
llvm_enable_assertions = 'OFF'
4351

4452
if args.docs:
4553
llvm_enable_doxygen = 'ON'
@@ -48,7 +56,7 @@ def do_configure(args):
4856
if args.shared_libs:
4957
llvm_build_shared_libs = 'ON'
5058

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

5361
cmake_cmd = [
5462
"cmake",
@@ -65,31 +73,36 @@ def do_configure(args):
6573
"-DLIBCLC_TARGETS_TO_BUILD={}".format(libclc_targets_to_build),
6674
"-DSYCL_BUILD_PI_CUDA={}".format(sycl_build_pi_cuda),
6775
"-DLLVM_BUILD_TOOLS=ON",
68-
"-DSYCL_ENABLE_WERROR=ON",
76+
"-DSYCL_ENABLE_WERROR={}".format(sycl_werror),
6977
"-DCMAKE_INSTALL_PREFIX={}".format(install_dir),
7078
"-DSYCL_INCLUDE_TESTS=ON", # Explicitly include all kinds of SYCL tests.
7179
"-DLLVM_ENABLE_DOXYGEN={}".format(llvm_enable_doxygen),
7280
"-DLLVM_ENABLE_SPHINX={}".format(llvm_enable_sphinx),
7381
"-DBUILD_SHARED_LIBS={}".format(llvm_build_shared_libs),
74-
"-DSYCL_ENABLE_XPTI_TRACING=ON", # Explicitly turn on XPTI tracing
75-
"{}".format(args.cmake_opts),
76-
llvm_dir
82+
"-DSYCL_ENABLE_XPTI_TRACING=ON" # Explicitly turn on XPTI tracing
7783
]
7884

79-
if not args.no_ocl:
85+
if args.system_ocl:
8086
cmake_cmd.extend([
8187
"-DOpenCL_INCLUDE_DIR={}".format(ocl_header_dir),
8288
"-DOpenCL_LIBRARY={}".format(icd_loader_lib)])
8389

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+
8497
print(cmake_cmd)
8598

8699
try:
87-
subprocess.check_call(cmake_cmd, cwd=args.obj_dir)
100+
subprocess.check_call(cmake_cmd, cwd=abs_obj_dir)
88101
except subprocess.CalledProcessError:
89-
cmake_cache = os.path.join(args.obj_dir, "CMakeCache.txt")
102+
cmake_cache = os.path.join(abs_obj_dir, "CMakeCache.txt")
90103
if os.path.isfile(cmake_cache):
91104
os.remove(cmake_cache)
92-
subprocess.check_call(cmake_cmd, cwd=args.obj_dir)
105+
subprocess.check_call(cmake_cmd, cwd=abs_obj_dir)
93106

94107
ret = True
95108
return ret
@@ -109,11 +122,12 @@ def main():
109122
parser.add_argument("-t", "--build-type",
110123
metavar="BUILD_TYPE", required=True, help="build type, debug or release")
111124
parser.add_argument("--cuda", action='store_true', help="switch from OpenCL to CUDA")
112-
parser.add_argument("--assertions", action='store_true', help="build with assertions")
125+
parser.add_argument("--no-assertions", action='store_true', help="build without assertions")
113126
parser.add_argument("--docs", action='store_true', help="build Doxygen documentation")
114-
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")
115129
parser.add_argument("--shared-libs", action='store_true', help="Build shared libraries")
116-
parser.add_argument("--cmake-opts", metavar="CMAKE_OPTS", help="Additional CMake options not configured via script parameters")
130+
parser.add_argument("--cmake-opt", action='append', help="Additional CMake option not configured via script parameters")
117131

118132
args = parser.parse_args()
119133

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)