Skip to content

Commit 6234a2e

Browse files
committed
Merge from 'sycl' to 'sycl-web' (#2)
CONFLICT (content): Merge conflict in clang/include/clang/Driver/Options.td
2 parents e666744 + d52d72e commit 6234a2e

25 files changed

+295
-61
lines changed

buildbot/configure.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ def do_configure(args):
1313
if not os.path.isdir(abs_obj_dir):
1414
os.makedirs(abs_obj_dir)
1515

16+
llvm_external_projects = 'sycl;llvm-spirv;opencl-aot;libdevice'
17+
if not args.use_libcxx:
18+
llvm_external_projects += ';xpti;xptifw'
19+
1620
llvm_dir = os.path.join(abs_src_dir, "llvm")
1721
sycl_dir = os.path.join(abs_src_dir, "sycl")
1822
spirv_dir = os.path.join(abs_src_dir, "llvm-spirv")
@@ -22,14 +26,15 @@ def do_configure(args):
2226
ocl_header_dir = os.path.join(abs_obj_dir, "OpenCL-Headers")
2327
icd_loader_lib = os.path.join(abs_obj_dir, "OpenCL-ICD-Loader", "build")
2428
llvm_targets_to_build = 'X86'
25-
llvm_enable_projects = 'clang;llvm-spirv;sycl;opencl-aot;xpti;xptifw;libdevice'
29+
llvm_enable_projects = 'clang;' + llvm_external_projects
2630
libclc_targets_to_build = ''
2731
sycl_build_pi_cuda = 'OFF'
2832
sycl_werror = 'ON'
2933
llvm_enable_assertions = 'ON'
3034
llvm_enable_doxygen = 'OFF'
3135
llvm_enable_sphinx = 'OFF'
3236
llvm_build_shared_libs = 'OFF'
37+
sycl_enable_xpti_tracing = 'OFF' if args.use_libcxx else 'ON'
3338

3439
icd_loader_lib = os.path.join(icd_loader_lib, "libOpenCL.so" if platform.system() == 'Linux' else "OpenCL.lib")
3540

@@ -64,7 +69,7 @@ def do_configure(args):
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),
67-
"-DLLVM_EXTERNAL_PROJECTS=sycl;llvm-spirv;opencl-aot;xpti;xptifw;libdevice",
72+
"-DLLVM_EXTERNAL_PROJECTS={}".format(llvm_external_projects),
6873
"-DLLVM_EXTERNAL_SYCL_SOURCE_DIR={}".format(sycl_dir),
6974
"-DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR={}".format(spirv_dir),
7075
"-DLLVM_EXTERNAL_XPTI_SOURCE_DIR={}".format(xpti_dir),
@@ -81,7 +86,7 @@ def do_configure(args):
8186
"-DLLVM_ENABLE_DOXYGEN={}".format(llvm_enable_doxygen),
8287
"-DLLVM_ENABLE_SPHINX={}".format(llvm_enable_sphinx),
8388
"-DBUILD_SHARED_LIBS={}".format(llvm_build_shared_libs),
84-
"-DSYCL_ENABLE_XPTI_TRACING=ON" # Explicitly turn on XPTI tracing
89+
"-DSYCL_ENABLE_XPTI_TRACING={}".format(sycl_enable_xpti_tracing)
8590
]
8691

8792
if args.system_ocl:
@@ -104,6 +109,15 @@ def do_configure(args):
104109
# Add path to root CMakeLists.txt
105110
cmake_cmd.append(llvm_dir)
106111

112+
if args.use_libcxx:
113+
if not (args.libcxx_include and args.libcxx_library):
114+
sys.exit("Please specify include and library path of libc++ when building sycl "
115+
"runtime with it")
116+
cmake_cmd.extend([
117+
"-DSYCL_USE_LIBCXX=ON",
118+
"-DSYCL_LIBCXX_INCLUDE_PATH={}".format(args.libcxx_include),
119+
"-DSYCL_LIBCXX_LIBRARY_PATH={}".format(args.libcxx_library)])
120+
107121
print("[Cmake Command]: {}".format(" ".join(cmake_cmd)))
108122

109123
try:
@@ -143,7 +157,9 @@ def main():
143157
parser.add_argument("--shared-libs", action='store_true', help="Build shared libraries")
144158
parser.add_argument("--cmake-opt", action='append', help="Additional CMake option not configured via script parameters")
145159
parser.add_argument("--cmake-gen", default="Ninja", help="CMake generator")
146-
160+
parser.add_argument("--use-libcxx", action="store_true", help="build sycl runtime with libcxx")
161+
parser.add_argument("--libcxx-include", metavar="LIBCXX_INCLUDE_PATH", help="libcxx include path")
162+
parser.add_argument("--libcxx-library", metavar="LIBCXX_LIBRARY_PATH", help="libcxx library path")
147163
args = parser.parse_args()
148164

149165
print("args:{}".format(args))

clang/include/clang/Basic/AttrDocs.td

Lines changed: 185 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,6 +2219,15 @@ program is ill-formed and no diagnostic is required.
22192219

22202220
The ``intel::kernel_args_restrict`` attribute has an effect when applied to a
22212221
function, and no effect otherwise.
2222+
2223+
.. code-block:: c++
2224+
2225+
[[intel::kernel_args_restrict]] void func() {}
2226+
2227+
struct bar {
2228+
[[intel::kernel_args_restrict]] void operator()() const {}
2229+
};
2230+
22222231
}];
22232232
}
22242233

@@ -2230,6 +2239,25 @@ Applies to a device function/lambda function. Indicates the number of work
22302239
items that should be processed in parallel. Valid values are positive integers.
22312240
If ``intel::num_simd_work_items`` is applied to a function called from a
22322241
device kernel, the attribute is not ignored and it is propagated to the kernel.
2242+
2243+
.. code-block:: c++
2244+
2245+
[[intel::num_simd_work_items(4)]] void foo() {}
2246+
2247+
template<int N>
2248+
[[intel::num_simd_work_items(N)]] void bar() {}
2249+
2250+
class Foo {
2251+
public:
2252+
[[intel::num_simd_work_items(6)]] void operator()() const {}
2253+
};
2254+
2255+
template <int N>
2256+
class Functor {
2257+
public:
2258+
[[intel::num_simd_work_items(N)]] void operator()() const {}
2259+
};
2260+
22332261
}];
22342262
}
22352263

@@ -2285,14 +2313,64 @@ those device functions, such that the kernel attributes are the sum of all
22852313
attributes of all device functions called in this kernel.
22862314
See section 6.7 Attributes for more details.
22872315

2288-
As Intel extension, ``[[intel::reqd_work_group_size(X, Y, Z)]]`` spelling is allowed
2289-
which features optional arguments `Y` and `Z`, those simplifies its usage if
2290-
only 1- or 2-dimensional ND-range is assumed by a programmer. These arguments
2291-
defaults to ``1``.
2316+
.. code-block:: c++
2317+
2318+
[[cl::reqd_work_group_size(4, 4, 4)]] void foo() {}
2319+
2320+
class Foo {
2321+
public:
2322+
[[cl::reqd_work_group_size(2, 2, 2)]] void operator()() const {}
2323+
};
2324+
2325+
template <int N, int N1, int N2>
2326+
class Functor {
2327+
public:
2328+
[[cl::reqd_work_group_size(N, N1, N2)]] void operator()() const {}
2329+
};
2330+
2331+
template <int N, int N1, int N2>
2332+
[[cl::reqd_work_group_size(N, N1, N2)]] void func() {}
2333+
2334+
As an Intel extension, the ``[[intel::reqd_work_group_size(X, Y, Z)]]``
2335+
spelling is supported. This spelling allows the Y and Z arguments to be
2336+
optional. If not provided by the user, the value of Y and Z defaults to 1.
2337+
This simplifies usage of the attribute when a 1- or 2-dimensional ND-range
2338+
is assumed.
2339+
2340+
.. code-block:: c++
2341+
2342+
[[intel::reqd_work_group_size(5)]]
2343+
// identical to [[intel::reqd_work_group_size(5, 1, 1)]]
2344+
void quux() {}
2345+
2346+
[[intel::reqd_work_group_size(5, 5)]]
2347+
// identical to [[intel::reqd_work_group_size(5, 5, 1)]]
2348+
void qux() {}
2349+
2350+
[[intel::reqd_work_group_size(4, 4, 4)]] void foo() {}
2351+
2352+
class Foo {
2353+
public:
2354+
[[intel::reqd_work_group_size(2, 2, 2)]] void operator()() const {}
2355+
};
2356+
2357+
template <int X, int Y, int Z>
2358+
class Functor {
2359+
public:
2360+
[[intel::reqd_work_group_size(X, Y, Z)]] void operator()() const {}
2361+
};
2362+
2363+
template <int X, int Y, int Z>
2364+
[[intel::reqd_work_group_size(X, Y, Z)]] void func() {}
22922365

22932366
In OpenCL C, this attribute is available in GNU spelling
22942367
(``__attribute__((reqd_work_group_size(X, Y, Z)))``), see section
22952368
6.7.2 Optional Attribute Qualifiers of OpenCL 1.2 specification for details.
2369+
2370+
.. code-block:: c++
2371+
2372+
__kernel __attribute__((reqd_work_group_size(8, 16, 32))) void test() {}
2373+
22962374
}];
22972375
}
22982376

@@ -2306,6 +2384,25 @@ reqd_work_group_size, but allows work groups that are smaller or equal to the
23062384
specified sizes.
23072385
If ``intel::max_work_group_size`` is applied to a function called from a
23082386
device kernel, the attribute is not ignored and it is propagated to the kernel.
2387+
2388+
.. code-block:: c++
2389+
2390+
[[intel::max_work_group_size(4, 4, 4)]] void foo() {}
2391+
2392+
class Foo {
2393+
public:
2394+
[[intel::max_work_group_size(2, 2, 2)]] void operator()() const {}
2395+
};
2396+
2397+
template <int N, int N1, int N2>
2398+
class Functor {
2399+
public:
2400+
[[intel::max_work_group_size(N, N1, N2)]] void operator()() const {}
2401+
};
2402+
2403+
template <int N, int N1, int N2>
2404+
[[intel::max_work_group_size(N, N1, N2)]] void func() {}
2405+
23092406
}];
23102407
}
23112408

@@ -2316,12 +2413,42 @@ def SYCLIntelMaxGlobalWorkDimAttrDocs : Documentation {
23162413
Applies to a device function/lambda function or function call operator (of a
23172414
function object). Indicates the largest valid global work dimension that will be
23182415
accepted when running the kernel on a device. Valid values are integers in a
2319-
range of [0, 3]. A kernel with max_global_work_dim(0) must be invoked with a
2416+
range of [0, 3].
2417+
If ``intel::max_global_work_dim`` is applied to a function called from a
2418+
device kernel, the attribute is not ignored and it is propagated to the kernel.
2419+
2420+
.. code-block:: c++
2421+
2422+
[[intel::max_global_work_dim(1)]] void foo() {}
2423+
2424+
template<int N>
2425+
[[intel::max_global_work_dim(N)]] void bar() {}
2426+
2427+
class Foo {
2428+
public:
2429+
[[intel::max_global_work_dim(1)]] void operator()() const {}
2430+
};
2431+
2432+
template <int N>
2433+
class Functor {
2434+
public:
2435+
[[intel::max_global_work_dim(N)]] void operator()() const {}
2436+
};
2437+
2438+
A kernel with ``intel::max_global_work_dim(0)`` must be invoked with a
23202439
'single_task' and if ``intel::max_work_group_size`` or
23212440
``cl::reqd_work_group_size`` are applied to the kernel as well - they shall
23222441
have arguments of (1, 1, 1).
2323-
If ``intel::max_global_work_dim`` is applied to a function called from a
2324-
device kernel, the attribute is not ignored and it is propagated to the kernel.
2442+
2443+
.. code-block:: c++
2444+
2445+
struct TRIFuncObjGood {
2446+
[[intel::max_global_work_dim(0)]]
2447+
[[intel::max_work_group_size(1, 1, 1)]]
2448+
[[cl::reqd_work_group_size(1, 1, 1)]]
2449+
void operator()() const {}
2450+
};
2451+
23252452
}];
23262453
}
23272454

@@ -2344,6 +2471,25 @@ This attribute enables communication of the desired maximum frequency of the
23442471
device operation, guiding the FPGA backend to insert the appropriate number of
23452472
registers to break-up the combinational logic circuit, and thereby controlling
23462473
the length of the longest combinational path.
2474+
2475+
.. code-block:: c++
2476+
2477+
[[intel::scheduler_target_fmax_mhz(4)]] void foo() {}
2478+
2479+
template<int N>
2480+
[[intel::scheduler_target_fmax_mhz(N)]] void bar() {}
2481+
2482+
class Foo {
2483+
public:
2484+
[[intel::scheduler_target_fmax_mhz(6)]] void operator()() const {}
2485+
};
2486+
2487+
template <int N>
2488+
class Functor {
2489+
public:
2490+
[[intel::scheduler_target_fmax_mhz(N)]] void operator()() const {}
2491+
};
2492+
23472493
}];
23482494
}
23492495

@@ -2355,6 +2501,29 @@ Applies to a device function/lambda function or function call operator (of a
23552501
function object). If 1, compiler doesn't use the global work offset values for
23562502
the device function. Valid values are 0 and 1. If used without argument, value
23572503
of 1 is set implicitly.
2504+
2505+
.. code-block:: c++
2506+
2507+
[[intel::no_global_work_offset]]
2508+
// identical to [[intel::no_global_work_offset(1)]]
2509+
void quux() {}
2510+
2511+
[[intel::no_global_work_offset(0)]] void foo() {}
2512+
2513+
class Foo {
2514+
public:
2515+
[[intel::no_global_work_offset(1)]] void operator()() const {}
2516+
};
2517+
2518+
template <int N>
2519+
class Functor {
2520+
public:
2521+
[[intel::no_global_work_offset(N)]] void operator()() const {}
2522+
};
2523+
2524+
template <int N>
2525+
[[intel::no_global_work_offset(N)]] void func() {}
2526+
23582527
}];
23592528
}
23602529

@@ -2645,6 +2814,15 @@ optimization.
26452814
This attribute allows to pass name and address of the function to a special
26462815
``cl::sycl::intel::get_device_func_ptr`` API call which extracts the device
26472816
function pointer for the specified function.
2817+
2818+
.. code-block:: c++
2819+
2820+
[[intel::device_indirectly_callable]] int func3() {}
2821+
2822+
class A {
2823+
[[intel::device_indirectly_callable]] A() {}
2824+
};
2825+
26482826
}];
26492827
}
26502828

clang/include/clang/Driver/Options.td

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,12 +2394,7 @@ def fsycl_device_code_split_EQ : Joined<["-"], "fsycl-device-code-split=">,
23942394
def fsycl_device_code_split : Flag<["-"], "fsycl-device-code-split">, Alias<fsycl_device_code_split_EQ>,
23952395
AliasArgs<["auto"]>, Flags<[CC1Option, CoreOption]>,
23962396
HelpText<"Perform SYCL device code split in the 'auto' mode, i.e. use heuristic to distribute device code across modules">;
2397-
def fsycl_id_queries_fit_in_int : Flag<["-"], "fsycl-id-queries-fit-in-int">,
2398-
Flags<[CC1Option, CoreOption]>, HelpText<"Assume that SYCL ID queries fit "
2399-
"within MAX_INT.">;
2400-
def fno_sycl_id_queries_fit_in_int : Flag<["-"], "fno-sycl-id-queries-fit-in-int">,
2401-
Flags<[CC1Option, CoreOption]>, HelpText<"Do not assume that SYCL ID queries "
2402-
"fit within MAX_INT.">;
2397+
defm sycl_id_queries_fit_in_int: OptInFFlag<"sycl-id-queries-fit-in-int", "Assume", "Do not assume", " that SYCL ID queries fit within MAX_INT.", [CC1Option,CoreOption], LangOpts<"SYCLValueFitInMaxInt">>;
24032398
def fsycl_use_bitcode : Flag<["-"], "fsycl-use-bitcode">,
24042399
Flags<[CC1Option, CoreOption]>, HelpText<"Use LLVM bitcode instead of SPIR-V in fat objects">;
24052400
def fno_sycl_use_bitcode : Flag<["-"], "fno-sycl-use-bitcode">,
@@ -2410,7 +2405,8 @@ def fsycl_link : Flag<["-"], "fsycl-link">, Alias<fsycl_link_EQ>,
24102405
AliasArgs<["early"]>, Flags<[CC1Option, CoreOption]>,
24112406
HelpText<"Generate partially linked device object to be used with the host link">;
24122407
def fsycl_unnamed_lambda : Flag<["-"], "fsycl-unnamed-lambda">,
2413-
Flags<[CC1Option, CoreOption]>, HelpText<"Allow unnamed SYCL lambda kernels">;
2408+
Flags<[CC1Option, CoreOption]>, HelpText<"Allow unnamed SYCL lambda kernels">,
2409+
MarshallingInfoFlag<LangOpts<"SYCLUnnamedLambda">>;
24142410
def fsycl_help_EQ : Joined<["-"], "fsycl-help=">,
24152411
Flags<[NoXarchOption, CoreOption]>, HelpText<"Emit help information from the "
24162412
"related offline compilation tool. Valid values: all, fpga, gen, x86_64.">,
@@ -4272,10 +4268,7 @@ def sycl_std_EQ : Joined<["-"], "sycl-std=">, Group<sycl_Group>, Flags<[CC1Optio
42724268
HelpText<"SYCL language standard to compile for.">, Values<"2020,2017,121,1.2.1,sycl-1.2.1">,
42734269
NormalizedValues<["SYCL_2020", "SYCL_2017", "SYCL_2017", "SYCL_2017", "SYCL_2017"]>, NormalizedValuesScope<"LangOptions">,
42744270
MarshallingInfoString<LangOpts<"SYCLVersion">, "SYCL_None">, ShouldParseIf<fsycl.KeyPath>, AutoNormalizeEnum;
4275-
def fsycl_esimd : Flag<["-"], "fsycl-explicit-simd">, Group<sycl_Group>, Flags<[CC1Option, NoArgumentUnused, CoreOption]>,
4276-
HelpText<"Enable SYCL explicit SIMD extension">;
4277-
def fno_sycl_esimd : Flag<["-"], "fno-sycl-explicit-simd">, Group<sycl_Group>,
4278-
HelpText<"Disable SYCL explicit SIMD extension">, Flags<[NoArgumentUnused, CoreOption]>;
4271+
defm sycl_esimd: OptInFFlag<"sycl-explicit-simd", "Enable", "Disable", " SYCL explicit SIMD extension.", [CC1Option,CoreOption], LangOpts<"SYCLExplicitSIMD">>;
42794272
defm sycl_early_optimizations : OptOutFFlag<"sycl-early-optimizations", "Enable", "Disable", " standard optimization pipeline for SYCL device compiler", [CoreOption]>;
42804273
def fsycl_dead_args_optimization : Flag<["-"], "fsycl-dead-args-optimization">,
42814274
Group<sycl_Group>, Flags<[NoArgumentUnused, CoreOption]>, HelpText<"Enables "
@@ -5480,23 +5473,24 @@ def fopenmp_host_ir_file_path : Separate<["-"], "fopenmp-host-ir-file-path">,
54805473
// SYCL Options
54815474
//===----------------------------------------------------------------------===//
54825475

5476+
def fsycl_is_device : Flag<["-"], "fsycl-is-device">,
5477+
HelpText<"Generate code for SYCL device.">,
5478+
MarshallingInfoFlag<LangOpts<"SYCLIsDevice">>;
54835479
def fsycl_is_host : Flag<["-"], "fsycl-is-host">,
5484-
HelpText<"SYCL host compilation">;
5480+
HelpText<"SYCL host compilation">,
5481+
MarshallingInfoFlag<LangOpts<"SYCLIsHost">>;
54855482
def fsycl_int_header : Separate<["-"], "fsycl-int-header">,
5486-
HelpText<"Generate SYCL integration header into this file.">;
5483+
HelpText<"Generate SYCL integration header into this file.">,
5484+
MarshallingInfoString<LangOpts<"SYCLIntHeader">>;
54875485
def fsycl_int_header_EQ : Joined<["-"], "fsycl-int-header=">,
54885486
Alias<fsycl_int_header>;
54895487
def fsycl_std_layout_kernel_params: Flag<["-"], "fsycl-std-layout-kernel-params">,
5490-
HelpText<"Enable standard layout requirement for SYCL kernel parameters.">;
5491-
def fsycl_allow_func_ptr : Flag<["-"], "fsycl-allow-func-ptr">,
5492-
HelpText<"Allow function pointers in SYCL device.">;
5493-
def fno_sycl_allow_func_ptr : Flag<["-"], "fno-sycl-allow-func-ptr">;
5488+
HelpText<"Enable standard layout requirement for SYCL kernel parameters.">,
5489+
MarshallingInfoFlag<LangOpts<"SYCLStdLayoutKernelParams">>;
5490+
defm sycl_allow_func_ptr: OptInFFlag<"sycl-allow-func-ptr", "Allow", "Disallow", " function pointers in SYCL device.", [CC1Option,CoreOption], LangOpts<"SYCLAllowFuncPtr">>;
54945491
def fenable_sycl_dae : Flag<["-"], "fenable-sycl-dae">,
5495-
HelpText<"Enable Dead Argument Elimination in SPIR kernels">;
5496-
def fsycl_is_device : Flag<["-"], "fsycl-is-device">,
5497-
HelpText<"Generate code for SYCL device.">,
5498-
MarshallingInfoFlag<LangOpts<"SYCLIsDevice">>,
5499-
ShouldParseIf<fsycl.KeyPath>;
5492+
HelpText<"Enable Dead Argument Elimination in SPIR kernels">,
5493+
MarshallingInfoFlag<LangOpts<"EnableDAEInSpirKernels">>;
55005494

55015495
} // let Flags = [CC1Option, NoDriverOption]
55025496

0 commit comments

Comments
 (0)