Skip to content

Commit adf882f

Browse files
author
Pavel Chupin
authored
Merge branch 'sycl' into opencl-cmake1
2 parents eb1d87a + 7d3e836 commit adf882f

File tree

90 files changed

+2917
-529
lines changed

Some content is hidden

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

90 files changed

+2917
-529
lines changed

.github/workflows/clang-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Get clang-format first
13-
run: sudo apt-get install -yqq clang-format-9
13+
run: sudo apt-get install -yqq clang-format
1414

1515
- uses: actions/checkout@v2
1616
with:

.github/workflows/sync-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: automatic sync main branch from llvm-project to llvm
22

33
on:
44
schedule:
5-
- cron: '*/10 * * * *'
5+
- cron: '0 */1 * * *'
66
jobs:
77
sync:
88
runs-on: ubuntu-latest

buildbot/dependency.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ ocl_cpu_rt_ver=2021.11.3.0.09
44
# https://github.com/intel/llvm/releases/download/2021-WW11/win-oclcpuexp-2021.11.3.0.09_rel.zip
55
ocl_cpu_rt_ver_win=2021.11.3.0.09
66
# Same GPU driver supports Level Zero and OpenCL
7-
# https://github.com/intel/compute-runtime/releases/tag/21.09.19150
8-
ocl_gpu_rt_ver=21.09.19150
7+
# https://github.com/intel/compute-runtime/releases/tag/21.12.19358
8+
ocl_gpu_rt_ver=21.12.19358
99
# Same GPU driver supports Level Zero and OpenCL
1010
# https://downloadmirror.intel.com/30266/a08/igfx_win10_100.9316.zip
1111
ocl_gpu_rt_ver_win=27.20.100.9316
@@ -30,7 +30,7 @@ ocloc_ver_win=27.20.100.9168
3030
[DRIVER VERSIONS]
3131
cpu_driver_lin=2021.11.3.0.09
3232
cpu_driver_win=2021.11.3.0.09
33-
gpu_driver_lin=21.09.19150
33+
gpu_driver_lin=21.12.19358
3434
gpu_driver_win=27.20.100.9316
3535
fpga_driver_lin=2021.11.3.0.09
3636
fpga_driver_win=2021.11.3.0.09

clang/include/clang/Basic/Attr.td

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,7 @@ def SYCLSimd : InheritableAttr {
12131213
let Subjects = SubjectList<[Function, GlobalVar]>;
12141214
let Documentation = [SYCLSimdDocs];
12151215
let SupportsNonconformingLambdaSyntax = 1;
1216+
let SimpleHandler = 1;
12161217
}
12171218

12181219
// Available in SYCL explicit SIMD extension. Binds a file scope private
@@ -1431,15 +1432,32 @@ def LoopUnrollHint : StmtAttr {
14311432
}
14321433

14331434
def IntelReqdSubGroupSize: InheritableAttr {
1434-
let Spellings = [GNU<"intel_reqd_sub_group_size">,
1435-
CXX11<"intel", "reqd_sub_group_size">];
1435+
let Spellings = [
1436+
GNU<"intel_reqd_sub_group_size">, CXX11<"intel", "reqd_sub_group_size">,
1437+
CXX11<"intel", "sub_group_size"> // SYCL2020 spelling.
1438+
];
14361439
let Args = [ExprArgument<"Value">];
14371440
let Subjects = SubjectList<[Function], ErrorDiag>;
14381441
let Documentation = [IntelReqdSubGroupSizeDocs];
14391442
let LangOpts = [OpenCL, SYCLIsDevice, SilentlyIgnoreSYCLIsHost];
14401443
let SupportsNonconformingLambdaSyntax = 1;
1444+
let Accessors =
1445+
[Accessor<"isSYCL2020Spelling", [CXX11<"intel", "sub_group_size">]>];
14411446
}
14421447

1448+
def IntelNamedSubGroupSize : InheritableAttr {
1449+
let Spellings = [CXX11<"intel", "named_sub_group_size">];
1450+
let Args = [EnumArgument<"Type", "SubGroupSizeType", ["automatic", "primary"],
1451+
["Automatic", "Primary"]>];
1452+
let Subjects = SubjectList<[Function], ErrorDiag>;
1453+
let Documentation = [IntelNamedSubGroupSizeDocs];
1454+
let LangOpts = [OpenCL, SYCLIsDevice, SilentlyIgnoreSYCLIsHost];
1455+
let SupportsNonconformingLambdaSyntax = 1;
1456+
}
1457+
1458+
def :
1459+
MutualExclusions<[IntelReqdSubGroupSize, IntelNamedSubGroupSize, SYCLSimd]>;
1460+
14431461
// This attribute is both a type attribute, and a declaration attribute (for
14441462
// parameter variables).
14451463
def OpenCLAccess : Attr {
@@ -1952,6 +1970,13 @@ def SYCLIntelFPGADisableLoopPipelining : DeclOrStmtAttr {
19521970
}
19531971
def : MutualExclusions<[SYCLIntelFPGAInitiationInterval,
19541972
SYCLIntelFPGADisableLoopPipelining]>;
1973+
def : MutualExclusions<[SYCLIntelFPGAIVDep,
1974+
SYCLIntelFPGADisableLoopPipelining]>;
1975+
def : MutualExclusions<[SYCLIntelFPGAMaxConcurrency,
1976+
SYCLIntelFPGADisableLoopPipelining]>;
1977+
1978+
def : MutualExclusions<[SYCLIntelFPGAMaxConcurrency,
1979+
SYCLIntelFPGADisableLoopPipelining]>;
19551980

19561981
def SYCLIntelFPGAMaxInterleaving : StmtAttr {
19571982
let Spellings = [CXX11<"intelfpga","max_interleaving">,
@@ -1963,6 +1988,8 @@ def SYCLIntelFPGAMaxInterleaving : StmtAttr {
19631988
let HasCustomTypeTransform = 1;
19641989
let Documentation = [SYCLIntelFPGAMaxInterleavingAttrDocs];
19651990
}
1991+
def : MutualExclusions<[SYCLIntelFPGADisableLoopPipelining,
1992+
SYCLIntelFPGAMaxInterleaving]>;
19661993

19671994
def SYCLIntelFPGASpeculatedIterations : StmtAttr {
19681995
let Spellings = [CXX11<"intelfpga","speculated_iterations">,
@@ -1974,6 +2001,8 @@ def SYCLIntelFPGASpeculatedIterations : StmtAttr {
19742001
let HasCustomTypeTransform = 1;
19752002
let Documentation = [SYCLIntelFPGASpeculatedIterationsAttrDocs];
19762003
}
2004+
def : MutualExclusions<[SYCLIntelFPGADisableLoopPipelining,
2005+
SYCLIntelFPGASpeculatedIterations]>;
19772006

19782007
def SYCLIntelFPGANofusion : StmtAttr {
19792008
let Spellings = [CXX11<"intel","nofusion">];

clang/include/clang/Basic/AttrDocs.td

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2869,7 +2869,7 @@ This attribute applies to a loop or a function. It indicates that the
28692869
loop/function should allow no more than N threads or iterations to execute it
28702870
simultaneously. N must be a non negative integer. '0' indicates the
28712871
max_concurrency case to be unbounded. Cannot be applied multiple times to the
2872-
same loop.
2872+
same loop or function, or in conjunction with ``disable_loop_pipelining``.
28732873

28742874
.. code-block:: c++
28752875

@@ -2935,17 +2935,18 @@ def SYCLIntelFPGADisableLoopPipeliningAttrDocs : Documentation {
29352935
This attribute applies to a loop or a function. Takes no arguments and
29362936
disables pipelining of the loop or function data path, causing the loop
29372937
or function to be executed serially. Cannot be used on the same loop or
2938-
function in conjunction with max_interleaving, speculated_iterations,
2939-
max_concurrency, initiation_interval, or ivdep.
2938+
function, or in conjunction with ``max_interleaving``,
2939+
``speculated_iterations``, ``max_concurrency``, ``initiation_interval``,
2940+
or ``ivdep``.
29402941

29412942
.. code-block:: c++
29422943

29432944
void foo() {
29442945
int var = 0;
2945-
[[intel::disable_loop_pipelining] for (int i = 0; i < 10; ++i) var++;
2946+
[[intel::disable_loop_pipelining]] for (int i = 0; i < 10; ++i) var++;
29462947
}
29472948

2948-
[[intel::disable_loop_pipelining] void foo1() { }
2949+
[[intel::disable_loop_pipelining]] void foo1() { }
29492950

29502951
}];
29512952
}
@@ -4353,9 +4354,9 @@ This attribute can be used in both OpenCL and SYCL.
43534354

43544355
OpenCL documentation:
43554356
The optional attribute intel_reqd_sub_group_size can be used to indicate that
4356-
the kernel must be compiled and executed with the specified subgroup size. When
4357+
the kernel must be compiled and executed with the specified sub group size. When
43574358
this attribute is present, get_max_sub_group_size() is guaranteed to return the
4358-
specified integer value. This is important for the correctness of many subgroup
4359+
specified integer value. This is important for the correctness of many sub group
43594360
algorithms, and in some cases may be used by the compiler to generate more optimal
43604361
code. See `cl_intel_required_subgroup_size
43614362
<https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_required_subgroup_size.txt>`
@@ -4366,6 +4367,13 @@ The [[intel::reqd_sub_group_size(n)]] attribute indicates that the kernel must
43664367
be compiled and executed with a sub-group of size n. The value of n must be set
43674368
to a sub-group size supported by the device, or device compilation will fail.
43684369

4370+
The ``[[intel::sub_group_size(n)]]`` attribute has the same effect as the other
4371+
attribute spellings, except that it follows the SYCL 2020 Attribute Rules. See
4372+
the ``[[intel::named_sub_group_size(NAME)]]`` documentation for clarification.
4373+
4374+
This attribute is mutually exclusive with ``[[intel::named_sub_group_size(NAME)]]``
4375+
and ``[[intel::sycl_explicit_simd]]``.
4376+
43694377
In addition to device functions, the required sub-group size attribute may also
43704378
be specified in the definition of a named functor object and lambda functions,
43714379
as in the examples below:
@@ -4389,6 +4397,47 @@ See Sub-groups for NDRange Parallelism proposal in sycl/doc/extensions/sub_group
43894397
}];
43904398
}
43914399

4400+
def IntelNamedSubGroupSizeDocs : Documentation {
4401+
let Category = DocCatFunction;
4402+
let Content = [{
4403+
The ``[[intel::named_sub_group_size(NAME)]]`` attribute works similar to
4404+
``[[intel::sub_group_size(N)]]`` attribute in that it defines the specific
4405+
sub group size for the kernel. The ``[[intel::named_sub_group_size(NAME)]]``
4406+
form accepts a required parameter of either ``automatic`` or ``primary``.
4407+
4408+
``automatic`` specifies that the implementation is free to select any of the
4409+
valid sub-group sizes associated with the device to which the kernel is
4410+
submitted. ``primary`` specifies that the implementation should select the
4411+
device's primary sub-group size as reported by
4412+
``info::device::primary_sub_group_size``.
4413+
4414+
This attribute may not be combined with ``[[intel::sub_group_size(N)]]``, as
4415+
the two attributes have different meanings. It is also mutually exclusive with
4416+
``[[intel::sycl_explicit_simd]]``.
4417+
4418+
In addition to the attributes, a default sub-group size strategy may be
4419+
specified by the ``-fsycl-default-sub-group-size`` command line option, which
4420+
accepts either ``automatic``, ``primary``, or a default size as an integer.
4421+
These values match and have the same behavior as the ``automatic``, ``primary``,
4422+
and ``[[intel::sub_group_size(N)]]`` values respectively.
4423+
4424+
SYCL 2020 Attribute Rules:
4425+
SYCL 2020 specifies that kernel-type attributes should only be specified on the
4426+
kernel or a ``SYCL_EXTERNAL`` function. This implementation permits these
4427+
attributes to appear on all function declarations for the purposes of
4428+
self-documenting declarations. However, these attributes must match the kernel's
4429+
sub-group size as configured by the command line, or via an attribute
4430+
specifically.
4431+
4432+
In addition to the SYCL 2020 Attribute Rules, this attribute and the
4433+
``[[intel::sub_group_size(N)]]`` attribute also require that any
4434+
``SYCL_EXTERNAL`` functions defined in a different translation unit must have a
4435+
matching sub-group size specification, so ``SYCL_EXTERNAL`` functions not
4436+
defined in this translation unit must also have a matching sub-group
4437+
specification to the kernel function that calls it.
4438+
}];
4439+
}
4440+
43924441
def OpenCLAccessDocs : Documentation {
43934442
let Category = DocCatStmt;
43944443
let Heading = "__read_only, __write_only, __read_write (read_only, write_only, read_write)";

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ def err_drv_invalid_Xsycl_frontend_with_args : Error<
134134
"invalid -Xsycl-target-frontend argument: '%0', options requiring arguments are unsupported">;
135135
def err_drv_bad_fpga_device_count : Error<
136136
"More than one FPGA specific device binary found in input objects">;
137+
def warn_drv_mismatch_fpga_archive : Warning<
138+
"FPGA archive '%0' does not contain matching emulation/hardware expectancy">,
139+
InGroup<SyclFPGAMismatch>;
137140
def err_drv_unsupported_opt_dpcpp : Error<"option '%0' unsupported with DPC++">;
138141
def err_drv_argument_only_allowed_with : Error<
139142
"invalid argument '%0' only allowed with '%1'">;

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,7 @@ def Sycl2017Compat : DiagGroup<"sycl-2017-compat">;
11821182
def Sycl2020Compat : DiagGroup<"sycl-2020-compat">;
11831183
def SyclStrict : DiagGroup<"sycl-strict", [ Sycl2017Compat, Sycl2020Compat]>;
11841184
def SyclTarget : DiagGroup<"sycl-target">;
1185+
def SyclFPGAMismatch : DiagGroup<"sycl-fpga-mismatch">;
11851186

11861187
// Backend warnings.
11871188
def BackendInlineAsm : DiagGroup<"inline-asm">;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11317,6 +11317,11 @@ def note_spelling_suggestion : Note<
1131711317
"did you mean to use %0 instead?">;
1131811318
def warn_attribute_requires_non_negative_integer_argument :
1131911319
Warning<warn_impcast_integer_sign.Text>, InGroup<AcceptedAttributes>;
11320+
def err_sycl_mismatch_group_size
11321+
: Error<"%select{kernel-called|undefined 'SYCL_EXTERNAL'}0 function must "
11322+
"have a sub group size that matches the size specified for the "
11323+
"kernel">;
11324+
def note_sycl_kernel_declared_here : Note<"kernel declared here">;
1132011325

1132111326
// errors of expect.with.probability
1132211327
def err_probability_not_constant_float : Error<

clang/include/clang/Basic/LangOptions.def

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,14 @@ LANGOPT(RelativeCXXABIVTables, 1, 0,
423423

424424
LANGOPT(ArmSveVectorBits, 32, 0, "SVE vector size in bits")
425425

426+
ENUM_LANGOPT(DefaultSubGroupSizeType, SubGroupSizeType, 2,
427+
SubGroupSizeType::None,
428+
"Strategy via which sub group is assigned for SYCL kernel "
429+
"types if not overridden via attributes")
430+
431+
VALUE_LANGOPT(DefaultSubGroupSize, 32, 0,
432+
"If DefaultSubGroupSizeType is Integer contains the value")
433+
426434
#undef LANGOPT
427435
#undef COMPATIBLE_LANGOPT
428436
#undef BENIGN_LANGOPT

clang/include/clang/Basic/LangOptions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ class LangOptions : public LangOptionsBase {
264264
Single
265265
};
266266

267+
enum class SubGroupSizeType { None, Auto, Primary, Integer };
268+
267269
public:
268270
/// The used language standard.
269271
LangStandard::Kind LangStd;

0 commit comments

Comments
 (0)