Skip to content

Commit 0032e53

Browse files
author
Alexander Batashev
committed
Merge remote-tracking branch 'origin/sycl' into private/abatashe/scheduler_docs
* origin/sycl: (26 commits) [Driver][SYCL] Move include/sycl header before other system header locations (intel#1492) [BuildBot] Improve usability of buildbot scripts (intel#1472) [NFC] Add GitHub actions badges to README file (intel#1496) [SYCL] Improve error handling for kernel invocation (intel#1209) [SYCL][Driver] Fix SYCL standards' handling for '-fsycl -fsycl-device-only' invocations (intel#1371) [SYCL] Move type checks to later in Semantic Analysis lifecycle (intel#1465) [CI] Download fixed versions of Python tools (intel#1485) [SYCL] Fix sub_group::broadcast (intel#1482) [SYCL][Test] Disable spec_const_redefine.cpp on all devices but HOST (intel#1488) [SYCL] Only export public API (intel#1456) [SYCL][CUDA] Fix selected_binary argument in piextDeviceSelectBinary (intel#1475) [SYCL] Enable LIT testing with CUDA BE (intel#1458) [SYCL] Fix float to half-type conversion (intel#1395) [NFC] Cleanup unneded macro from builtins implementation (intel#1445) Enable cfg-printer LLVM lit tests only if LLVM linked statically (intel#1479) [SYCL][NFC] Reflect the "allowlist" renaming in the code (intel#1480) [SYCL][Doc] Update prerequisites in GetStartedGuide (intel#1466) [SYCL][USM] Remove vestigial dead code (intel#1474) [SYCL-PTX] Fix __spirv_GroupAsyncCopy stride computation (intel#1451) [Driver][SYCL] Emit an error if c compilation is forced (intel#1438) ...
2 parents f6eb8ff + 2b88867 commit 0032e53

File tree

157 files changed

+2244
-2132
lines changed

Some content is hidden

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

157 files changed

+2244
-2132
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/gh_pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Install deps
1616
run: |
1717
sudo apt-get install -y doxygen graphviz ssh ninja-build
18-
sudo pip3 install sphinx recommonmark sphinx_markdown_tables
18+
sudo pip3 install 'sphinx==3.0.0' 'recommonmark==0.6.0' 'sphinx_markdown_tables==0.0.12'
1919
- name: Build Docs
2020
run: |
2121
mkdir -p $GITHUB_WORKSPACE/build

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Home for Intel LLVM-based projects:
77
- oneAPI Data Parallel C++ compiler - see **sycl** branch. More information on
88
oneAPI and DPC++ is available at
99
([https://www.oneapi.com/](https://www.oneapi.com/))
10+
- [![Linux Post Commit Checks](https://github.com/intel/llvm/workflows/Linux%20Post%20Commit%20Checks/badge.svg)](https://github.com/intel/llvm/actions?query=workflow%3A%22Linux+Post+Commit+Checks%22) [![Generate Doxygen documentation](https://github.com/intel/llvm/workflows/Generate%20Doxygen%20documentation/badge.svg)](https://github.com/intel/llvm/actions?query=workflow%3A%22Generate+Doxygen+documentation%22)
11+
12+
1013

1114
## License
1215
See [LICENSE.txt](sycl/LICENSE.TXT) for details.

buildbot/check.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,41 @@
11
import argparse
22
import os
3+
import multiprocessing
34
import subprocess
45
import sys
56

67
DEFAULT_CPU_COUNT = 4
78

89
def do_check(args):
9-
ret = False
10-
11-
cpu_count = os.cpu_count()
12-
if cpu_count is None:
10+
try:
11+
cpu_count = multiprocessing.cpu_count()
12+
except NotImplementedError:
1313
cpu_count = DEFAULT_CPU_COUNT
1414

15+
# Get absolute path to source directory
16+
if args.src_dir:
17+
abs_src_dir = os.path.abspath(args.src_dir)
18+
else:
19+
abs_src_dir = os.path.abspath(os.path.join(__file__, "../.."))
20+
# Get absolute path to build directory
21+
if args.obj_dir:
22+
abs_obj_dir = os.path.abspath(args.obj_dir)
23+
else:
24+
abs_obj_dir = os.path.join(abs_src_dir, "build")
25+
26+
cmake_cmd = [
27+
"cmake",
28+
"--build", abs_obj_dir,
29+
"--",
30+
args.test_suite,
31+
"-j", str(cpu_count)]
32+
33+
print(cmake_cmd)
34+
1535
env_tmp=os.environ
1636
env_tmp["LIT_ARGS"]="\"{}\"".format("-v")
1737

18-
make_cmd = ["ninja", args.test_suite, "-j", str(cpu_count)]
19-
print(make_cmd)
20-
21-
subprocess.check_call(make_cmd, cwd=args.obj_dir, env=env_tmp)
38+
subprocess.check_call(cmake_cmd, cwd=abs_obj_dir, env=env_tmp)
2239

2340
ret = True
2441
return ret
@@ -34,8 +51,8 @@ def main():
3451
parser.add_argument("-w", "--builder-dir", metavar="BUILDER_DIR",
3552
help="builder directory, which is the directory contains source and build directories")
3653
parser.add_argument("-s", "--src-dir", metavar="SRC_DIR", help="source directory")
37-
parser.add_argument("-o", "--obj-dir", metavar="OBJ_DIR", required=True, help="build directory")
38-
parser.add_argument("-t", "--test-suite", metavar="TEST_SUITE", required=True, help="check-xxx target")
54+
parser.add_argument("-o", "--obj-dir", metavar="OBJ_DIR", help="build directory")
55+
parser.add_argument("-t", "--test-suite", metavar="TEST_SUITE", default="check-all", help="check-xxx target")
3956

4057
args = parser.parse_args()
4158

@@ -47,4 +64,3 @@ def main():
4764
ret = main()
4865
exit_code = 0 if ret else 1
4966
sys.exit(exit_code)
50-

buildbot/compile.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import multiprocessing
33
import subprocess
44
import sys
5+
import os
56

67
DEFAULT_CPU_COUNT = 4
78

@@ -12,10 +13,28 @@ def do_compile(args):
1213
except NotImplementedError:
1314
cpu_count = DEFAULT_CPU_COUNT
1415

15-
make_cmd = ["ninja", "-j", str(cpu_count), "deploy-sycl-toolchain", "deploy-opencl-aot"]
16-
print(make_cmd)
16+
# Get absolute path to source directory
17+
if args.src_dir:
18+
abs_src_dir = os.path.abspath(args.src_dir)
19+
else:
20+
abs_src_dir = os.path.abspath(os.path.join(__file__, "../.."))
21+
# Get absolute path to build directory
22+
if args.obj_dir:
23+
abs_obj_dir = os.path.abspath(args.obj_dir)
24+
else:
25+
abs_obj_dir = os.path.join(abs_src_dir, "build")
1726

18-
subprocess.check_call(make_cmd, cwd=args.obj_dir)
27+
cmake_cmd = [
28+
"cmake",
29+
"--build", abs_obj_dir,
30+
"--",
31+
"deploy-sycl-toolchain",
32+
"deploy-opencl-aot",
33+
"-j", str(cpu_count)]
34+
35+
print(cmake_cmd)
36+
37+
subprocess.check_call(cmake_cmd, cwd=abs_obj_dir)
1938

2039
return True
2140

@@ -31,7 +50,7 @@ def main():
3150
parser.add_argument("-w", "--builder-dir", metavar="BUILDER_DIR",
3251
help="builder directory, which is the directory contains source and build directories")
3352
parser.add_argument("-s", "--src-dir", metavar="SRC_DIR", help="source directory")
34-
parser.add_argument("-o", "--obj-dir", metavar="OBJ_DIR", required=True, help="build directory")
53+
parser.add_argument("-o", "--obj-dir", metavar="OBJ_DIR", help="build directory")
3554

3655
args = parser.parse_args()
3756

@@ -44,4 +63,3 @@ def main():
4463
ret = main()
4564
exit_code = 0 if ret else 1
4665
sys.exit(exit_code)
47-

buildbot/configure.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@
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-
117
def do_configure(args):
128
ret = False
139

14-
# Get absolute paths
15-
abs_src_dir = os.path.abspath(args.src_dir)
16-
abs_obj_dir = os.path.abspath(args.obj_dir)
10+
# Get absolute path to source directory
11+
if args.src_dir:
12+
abs_src_dir = os.path.abspath(args.src_dir)
13+
else:
14+
abs_src_dir = os.path.abspath(os.path.join(__file__, "../.."))
15+
# Get absolute path to build directory
16+
if args.obj_dir:
17+
abs_obj_dir = os.path.abspath(args.obj_dir)
18+
else:
19+
abs_obj_dir = os.path.join(abs_src_dir, "build")
20+
if not os.path.isdir(abs_obj_dir):
21+
os.makedirs(abs_obj_dir)
1722

1823
llvm_dir = os.path.join(abs_src_dir, "llvm")
1924
sycl_dir = os.path.join(abs_src_dir, "sycl")
@@ -60,7 +65,7 @@ def do_configure(args):
6065

6166
cmake_cmd = [
6267
"cmake",
63-
"-G", "Ninja",
68+
"-G", args.cmake_gen,
6469
"-DCMAKE_BUILD_TYPE={}".format(args.build_type),
6570
"-DLLVM_ENABLE_ASSERTIONS={}".format(llvm_enable_assertions),
6671
"-DLLVM_TARGETS_TO_BUILD={}".format(llvm_targets_to_build),
@@ -117,17 +122,18 @@ def main():
117122
parser.add_argument("-r", "--pr-number", metavar="PR_NUM", help="pull request number")
118123
parser.add_argument("-w", "--builder-dir", metavar="BUILDER_DIR",
119124
help="builder directory, which is the directory contains source and build directories")
120-
parser.add_argument("-s", "--src-dir", metavar="SRC_DIR", required=True, help="source directory")
121-
parser.add_argument("-o", "--obj-dir", metavar="OBJ_DIR", required=True, help="build directory")
125+
parser.add_argument("-s", "--src-dir", metavar="SRC_DIR", help="source directory (autodetected by default)")
126+
parser.add_argument("-o", "--obj-dir", metavar="OBJ_DIR", help="build directory. (<src>/build by default)")
122127
parser.add_argument("-t", "--build-type",
123-
metavar="BUILD_TYPE", required=True, help="build type, debug or release")
128+
metavar="BUILD_TYPE", default="Release", help="build type: Debug, Release")
124129
parser.add_argument("--cuda", action='store_true', help="switch from OpenCL to CUDA")
125130
parser.add_argument("--no-assertions", action='store_true', help="build without assertions")
126131
parser.add_argument("--docs", action='store_true', help="build Doxygen documentation")
127132
parser.add_argument("--system-ocl", action='store_true', help="use OpenCL deps from system (no download)")
128133
parser.add_argument("--no-werror", action='store_true', help="Don't treat warnings as errors")
129134
parser.add_argument("--shared-libs", action='store_true', help="Build shared libraries")
130135
parser.add_argument("--cmake-opt", action='append', help="Additional CMake option not configured via script parameters")
136+
parser.add_argument("--cmake-gen", default="Ninja", help="CMake generator")
131137

132138
args = parser.parse_args()
133139

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ def err_drv_expecting_fopenmp_with_fopenmp_targets : Error<
255255
"The option -fopenmp-targets must be used in conjunction with a -fopenmp option compatible with offloading, please use -fopenmp=libomp or -fopenmp=libiomp5.">;
256256
def err_drv_expecting_fsycl_with_sycl_opt : Error<
257257
"The option %0 must be used in conjunction with -fsycl to enable offloading.">;
258+
def err_drv_fsycl_with_c_type : Error<
259+
"The option %0%1 must not be used in conjunction with -fsycl which expects C++ source.">;
258260
def warn_drv_omp_offload_target_duplicate : Warning<
259261
"The OpenMP offloading target '%0' is similar to target '%1' already specified - will be ignored.">,
260262
InGroup<OpenMPTarget>;

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12455,6 +12455,7 @@ class Sema final {
1245512455
};
1245612456

1245712457
bool isKnownGoodSYCLDecl(const Decl *D);
12458+
void checkSYCLDeviceVarDecl(VarDecl *Var);
1245812459
void ConstructOpenCLKernel(FunctionDecl *KernelCallerFunc, MangleContext &MC);
1245912460
void MarkDevice();
1246012461

clang/lib/Driver/Driver.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,15 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
769769
}
770770
return SYCLArg;
771771
};
772+
773+
// Emit an error if c-compilation is forced in -fsycl mode
774+
if (HasValidSYCLRuntime)
775+
for (StringRef XValue : C.getInputArgs().getAllArgValues(options::OPT_x)) {
776+
if (XValue == "c" || XValue == "c-header")
777+
C.getDriver().Diag(clang::diag::err_drv_fsycl_with_c_type)
778+
<< "-x " << XValue;
779+
}
780+
772781
Arg *SYCLTargets = getArgRequiringSYCLRuntime(options::OPT_fsycl_targets_EQ);
773782
Arg *SYCLLinkTargets =
774783
getArgRequiringSYCLRuntime(options::OPT_fsycl_link_targets_EQ);

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,9 +1217,9 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
12171217
if (JA.isOffloading(Action::OFK_Cuda))
12181218
getToolChain().AddCudaIncludeArgs(Args, CmdArgs);
12191219

1220-
if (Args.hasArg(options::OPT_fsycl_device_only)) {
1220+
if (JA.isOffloading(Action::OFK_SYCL) ||
1221+
Args.hasArg(options::OPT_fsycl_device_only))
12211222
toolchains::SYCLToolChain::AddSYCLIncludeArgs(D, Args, CmdArgs);
1222-
}
12231223

12241224
// If we are offloading to a target via OpenMP we need to include the
12251225
// openmp_wrappers folder which contains alternative system headers.
@@ -4115,6 +4115,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
41154115
CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
41164116
}
41174117

4118+
Arg *SYCLStdArg = Args.getLastArg(options::OPT_sycl_std_EQ);
4119+
41184120
if (UseSYCLTriple) {
41194121
// We want to compile sycl kernels.
41204122
CmdArgs.push_back("-fsycl");
@@ -4147,21 +4149,24 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
41474149
options::OPT_fno_sycl_allow_func_ptr, false)) {
41484150
CmdArgs.push_back("-fsycl-allow-func-ptr");
41494151
}
4150-
}
41514152

4152-
if (IsSYCL) {
4153-
if (Arg *A = Args.getLastArg(options::OPT_sycl_std_EQ)) {
4154-
A->render(Args, CmdArgs);
4155-
CmdArgs.push_back("-fsycl-std-layout-kernel-params");
4156-
} else {
4157-
// Ensure the default version in SYCL mode is 1.2.1 (aka 2017)
4158-
CmdArgs.push_back("-sycl-std=2017");
4153+
if (!SYCLStdArg) {
41594154
// The user had not pass SYCL version, thus we'll employ no-sycl-strict
41604155
// to allow address-space unqualified pointers in function params/return
41614156
// along with marking the same function with explicit SYCL_EXTERNAL
41624157
CmdArgs.push_back("-Wno-sycl-strict");
41634158
}
4159+
}
4160+
4161+
if (IsSYCL) {
4162+
if (SYCLStdArg) {
4163+
SYCLStdArg->render(Args, CmdArgs);
4164+
CmdArgs.push_back("-fsycl-std-layout-kernel-params");
4165+
} else {
4166+
// Ensure the default version in SYCL mode is 1.2.1 (aka 2017)
4167+
CmdArgs.push_back("-sycl-std=2017");
41644168
}
4169+
}
41654170

41664171
if (IsOpenMPDevice) {
41674172
// We have to pass the triple of the host if compiling for an OpenMP device.

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,6 @@ void SYCLToolChain::AddSYCLIncludeArgs(const clang::driver::Driver &Driver,
545545

546546
void SYCLToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
547547
ArgStringList &CC1Args) const {
548-
AddSYCLIncludeArgs(getDriver(), DriverArgs, CC1Args);
549548
HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args);
550549
}
551550

clang/lib/Sema/SemaDecl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12660,6 +12660,9 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
1266012660
}
1266112661
}
1266212662

12663+
if (getLangOpts().SYCLIsDevice)
12664+
checkSYCLDeviceVarDecl(var);
12665+
1266312666
// In Objective-C, don't allow jumps past the implicit initialization of a
1266412667
// local retaining variable.
1266512668
if (getLangOpts().ObjC &&

0 commit comments

Comments
 (0)