Skip to content

Commit ca2ca82

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web'
2 parents 1ccc436 + d703f57 commit ca2ca82

File tree

303 files changed

+13833
-8787
lines changed

Some content is hidden

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

303 files changed

+13833
-8787
lines changed

.github/CODEOWNERS

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ sycl/doc/extensions/ @intel/dpcpp-specification-reviewers
2828

2929
# Sub-groups
3030
sycl/include/CL/sycl/detail/spirv.hpp @Pennycook @AlexeySachkov
31-
sycl/include/CL/sycl/intel/group_algorithm.hpp @Pennycook @AlexeySachkov
32-
sycl/include/CL/sycl/intel/sub_group.hpp @Pennycook @AlexeySachkov
33-
sycl/include/CL/sycl/intel/sub_group_host.hpp @Pennycook @AlexeySachkov
31+
sycl/include/sycl/ext/intel/group_algorithm.hpp @Pennycook @AlexeySachkov
32+
sycl/include/sycl/ext/intel/sub_group.hpp @Pennycook @AlexeySachkov
33+
sycl/include/sycl/ext/intel/sub_group_host.hpp @Pennycook @AlexeySachkov
3434

3535
# PI API
3636
sycl/include/CL/sycl/detail/pi.def @smaslov-intel
@@ -53,17 +53,17 @@ sycl/source/detail/stream_impl.cpp @againull
5353
sycl/source/stream.cpp @againull
5454

5555
# FPGA extensions
56-
sycl/include/CL/sycl/intel/fpga_device_selector.hpp @MrSidims
57-
sycl/include/CL/sycl/intel/fpga_extensions.hpp @MrSidims
58-
sycl/include/CL/sycl/intel/fpga_reg.hpp @MrSidims
59-
sycl/include/CL/sycl/intel/pipes.hpp @MrSidims
56+
sycl/include/sycl/ext/intel/fpga_device_selector.hpp @MrSidims
57+
sycl/include/sycl/ext/intel/fpga_extensions.hpp @MrSidims
58+
sycl/include/sycl/ext/intel/fpga_reg.hpp @MrSidims
59+
sycl/include/sycl/ext/intel/pipes.hpp @MrSidims
6060
sycl/include/CL/sycl/pipes.hpp @MrSidims
6161

6262
# Reduction extension
63-
sycl/include/CL/sycl/intel/reduction.hpp @v-klochkov
63+
sycl/include/sycl/ext/intel/reduction.hpp @v-klochkov
6464

6565
# Function pointers
66-
sycl/include/CL/sycl/intel/function_pointer.hpp @AlexeySachkov
66+
sycl/include/sycl/ext/intel/function_pointer.hpp @AlexeySachkov
6767
sycl/source/function_pointer.cpp @AlexeySachkov
6868

6969
# Half Type

clang/include/clang/Basic/Attr.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,14 @@ def SYCLSimdAccessorPtr : InheritableAttr {
12611261
let Documentation = [Undocumented];
12621262
}
12631263

1264+
// Used to mark readonly accessors. It is not to be used directly in the source.
1265+
def SYCLAccessorReadonly : Attr {
1266+
// This attribute has no spellings as it is only ever created implicitly.
1267+
let Spellings = [];
1268+
let SemaHandler = 0;
1269+
let Documentation = [Undocumented];
1270+
}
1271+
12641272
// The attribute denotes that it is a function written in a scalar fashion, which
12651273
// is used in ESIMD context and needs to be vectorized by a vector backend compiler.
12661274
// For now, this attribute will be used only in internal implementation of

clang/include/clang/Basic/AttrDocs.td

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,10 @@ def SYCLSimdDocs : Documentation {
415415
The compiler may decide to compile such functions using different optimization
416416
and code generation pipeline. Also, this attribute is used to distinguish
417417
ESIMD private globals from regular SYCL global variables.
418+
419+
In SYCL 1.2.1 mode, the ``intel::sycl_explicit_simd`` attribute is propagated
420+
from the function it is applied to onto the kernel which calls the function.
421+
In SYCL 2020 mode, the attribute is not propagated to the kernel.
418422
}];
419423
}
420424

@@ -2443,8 +2447,9 @@ lambda capture, or function object member, of the callable to which the
24432447
attribute was applied. This effect is equivalent to annotating restrict on
24442448
**all** kernel pointer arguments in an OpenCL or SPIR-V kernel.
24452449

2446-
If ``intel::kernel_args_restrict`` is applied to a function called from a device
2447-
kernel, the attribute is not ignored and it is propagated to the kernel.
2450+
In SYCL 1.2.1 mode, the ``intel::kernel_args_restrict`` attribute is propagated
2451+
from the function it is applied to onto the kernel which calls the function.
2452+
In SYCL 2020 mode, the attribute is not propagated to the kernel.
24482453

24492454
The attribute forms an unchecked assertion, in that implementations
24502455
do not need to check/confirm the pre-condition in any way. If a user applies
@@ -2482,8 +2487,10 @@ def SYCLIntelNumSimdWorkItemsAttrDocs : Documentation {
24822487
let Content = [{
24832488
Applies to a device function/lambda function. Indicates the number of work
24842489
items that should be processed in parallel. Valid values are positive integers.
2485-
If ``intel::num_simd_work_items`` is applied to a function called from a
2486-
device kernel, the attribute is not ignored and it is propagated to the kernel.
2490+
2491+
In SYCL 1.2.1 mode, the ``intel::num_simd_work_items`` attribute is propagated
2492+
from the function it is applied to onto the kernel which calls the function.
2493+
In SYCL 2020 mode, the attribute is not propagated to the kernel.
24872494

24882495
.. code-block:: c++
24892496

@@ -2656,6 +2663,11 @@ allows the Y and Z arguments to be optional. If not provided by the user, the
26562663
value of Y and Z defaults to 1. See section 5.8.1 Kernel Attributes for more
26572664
details.
26582665

2666+
In SYCL 1.2.1 mode, the ``intel::reqd_work_group_size``,
2667+
``cl::reqd_work_group_size``, and ``sycl::reqd_work_group_size`` attributes are
2668+
propagated from the function they are applied to onto the kernel which calls the
2669+
function. In SYCL 2020 mode, the attributes are not propagated to the kernel.
2670+
26592671
.. code-block:: c++
26602672

26612673
[[sycl::reqd_work_group_size(4, 4, 4)]] void foo() {}
@@ -2800,8 +2812,10 @@ Applies to a device function/lambda function. Indicates the maximum dimensions
28002812
of a work group. Values must be positive integers. This is similar to
28012813
reqd_work_group_size, but allows work groups that are smaller or equal to the
28022814
specified sizes.
2803-
If ``intel::max_work_group_size`` is applied to a function called from a
2804-
device kernel, the attribute is not ignored and it is propagated to the kernel.
2815+
2816+
In SYCL 1.2.1 mode, the ``intel::max_work_group_size`` attribute is propagated
2817+
from the function it is applied to onto the kernel which calls the function.
2818+
In SYCL 2020 mode, the attribute is not propagated to the kernel.
28052819

28062820
.. code-block:: c++
28072821

@@ -2832,8 +2846,10 @@ Applies to a device function/lambda function or function call operator (of a
28322846
function object). Indicates the largest valid global work dimension that will be
28332847
accepted when running the kernel on a device. Valid values are integers in a
28342848
range of [0, 3].
2835-
If ``intel::max_global_work_dim`` is applied to a function called from a
2836-
device kernel, the attribute is not ignored and it is propagated to the kernel.
2849+
2850+
In SYCL 1.2.1 mode, the ``intel::max_global_work_dim`` attribute is propagated
2851+
from the function it is applied to onto the kernel which calls the function.
2852+
In SYCL 2020 mode, the attribute is not propagated to the kernel.
28372853

28382854
.. code-block:: c++
28392855

@@ -2890,6 +2906,10 @@ device operation, guiding the FPGA backend to insert the appropriate number of
28902906
registers to break-up the combinational logic circuit, and thereby controlling
28912907
the length of the longest combinational path.
28922908

2909+
In SYCL 1.2.1 mode, the ``intel::scheduler_target_fmax_mhz`` attribute is
2910+
propagated from the function it is applied to onto the kernel which calls the
2911+
function. In SYCL 2020 mode, the attribute is not propagated to the kernel.
2912+
28932913
.. code-block:: c++
28942914

28952915
[[intel::scheduler_target_fmax_mhz(4)]] void foo() {}
@@ -2920,6 +2940,10 @@ function object). If 1, compiler doesn't use the global work offset values for
29202940
the device function. Valid values are 0 and 1. If used without argument, value
29212941
of 1 is set implicitly.
29222942

2943+
In SYCL 1.2.1 mode, the ``intel::no_global_work_offset`` attribute is
2944+
propagated from the function it is applied to onto the kernel which calls the
2945+
function. In SYCL 2020 mode, the attribute is not propagated to the kernel.
2946+
29232947
.. code-block:: c++
29242948

29252949
[[intel::no_global_work_offset]]
@@ -4607,6 +4631,10 @@ the ``[[intel::named_sub_group_size(NAME)]]`` documentation for clarification.
46074631
This attribute is mutually exclusive with ``[[intel::named_sub_group_size(NAME)]]``
46084632
and ``[[intel::sycl_explicit_simd]]``.
46094633

4634+
In SYCL 1.2.1 mode, the ``intel::reqd_sub_group_size`` attribute is propagated
4635+
from the function it is applied to onto the kernel which calls the function.
4636+
In SYCL 2020 mode, the attribute is not propagated to the kernel.
4637+
46104638
In addition to device functions, the required sub-group size attribute may also
46114639
be specified in the definition of a named functor object and lambda functions,
46124640
as in the examples below:

clang/include/clang/Driver/Action.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,14 @@ class FileTableTformJobAction : public JobAction {
772772

773773
public:
774774
struct Tform {
775-
enum Kind { EXTRACT, EXTRACT_DROP_TITLE, REPLACE, RENAME };
775+
enum Kind {
776+
EXTRACT,
777+
EXTRACT_DROP_TITLE,
778+
REPLACE,
779+
REPLACE_CELL,
780+
RENAME,
781+
COPY_SINGLE_FILE
782+
};
776783

777784
Tform() = default;
778785
Tform(Kind K, std::initializer_list<StringRef> Args) : TheKind(K) {
@@ -794,10 +801,19 @@ class FileTableTformJobAction : public JobAction {
794801
// <To> from another file table passed as input to this action.
795802
void addReplaceColumnTform(StringRef From, StringRef To);
796803

804+
// Replaces a cell in this table with column title <ColumnName> and row <Row>
805+
// with the file name passed as input to this action.
806+
void addReplaceCellTform(StringRef ColumnName, int Row);
807+
797808
// Renames a column with title <From> in this table with a column with title
798809
// <To> passed as input to this action.
799810
void addRenameColumnTform(StringRef From, StringRef To);
800811

812+
// Specifies that, instead of generating a new table, the transformation
813+
// should copy the file at column <ColumnName> and row <Row> into the
814+
// output file.
815+
void addCopySingleFileTform(StringRef ColumnName, int Row);
816+
801817
static bool classof(const Action *A) {
802818
return A->getKind() == FileTableTformJobClass;
803819
}
@@ -806,6 +822,9 @@ class FileTableTformJobAction : public JobAction {
806822

807823
private:
808824
SmallVector<Tform, 2> Tforms; // transformation actions requested
825+
826+
// column to copy single file from if requested
827+
std::string CopySingleFileColumnName;
809828
};
810829

811830
class AppendFooterJobAction : public JobAction {

clang/lib/CodeGen/CGCall.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,6 +2672,9 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
26722672
unsigned FirstIRArg, NumIRArgs;
26732673
std::tie(FirstIRArg, NumIRArgs) = IRFunctionArgs.getIRArgs(ArgNo);
26742674

2675+
if (Arg->hasAttr<SYCLAccessorReadonlyAttr>())
2676+
Fn->getArg(FirstIRArg)->addAttr(llvm::Attribute::ReadOnly);
2677+
26752678
switch (ArgI.getKind()) {
26762679
case ABIArgInfo::InAlloca: {
26772680
assert(NumIRArgs == 0);

clang/lib/Driver/Action.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,23 @@ void FileTableTformJobAction::addReplaceColumnTform(StringRef From,
507507
Tforms.emplace_back(Tform(Tform::REPLACE, {From, To}));
508508
}
509509

510+
void FileTableTformJobAction::addReplaceCellTform(StringRef ColumnName,
511+
int Row) {
512+
Tforms.emplace_back(
513+
Tform(Tform::REPLACE_CELL, {ColumnName, std::to_string(Row)}));
514+
}
515+
510516
void FileTableTformJobAction::addRenameColumnTform(StringRef From,
511517
StringRef To) {
512518
Tforms.emplace_back(Tform(Tform::RENAME, {From, To}));
513519
}
514520

521+
void FileTableTformJobAction::addCopySingleFileTform(StringRef ColumnName,
522+
int Row) {
523+
Tforms.emplace_back(
524+
Tform(Tform::COPY_SINGLE_FILE, {ColumnName, std::to_string(Row)}));
525+
}
526+
515527
void AppendFooterJobAction::anchor() {}
516528

517529
AppendFooterJobAction::AppendFooterJobAction(Action *Input, types::ID Type)

clang/lib/Driver/Driver.cpp

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4378,33 +4378,33 @@ class OffloadingActionBuilder final {
43784378
// .--------------------------------------.
43794379
// | PostLink |
43804380
// .--------------------------------------.
4381-
// [.n] [+*] [+*]
4381+
// [+n] [+*] [+]
43824382
// | | |
4383-
// | .-----------------. |
4384-
// | | FileTableTform | |
4385-
// | | (extract "Code")| |
4386-
// | .-----------------. |
4387-
// | [-] |
4383+
// .----------------. .-----------------. |
4384+
// | FileTableTform | | FileTableTform | |
4385+
// | (copy "Code") | | (extract "Code")| |
4386+
// .----------------. .-----------------. |
4387+
// [.] [-] |
43884388
// | | |
4389-
// | [-*] |
4390-
// .-------------. .-------------------. |
4391-
// |finalizeNVPTX| | SPIRVTranslator | |
4392-
// .-------------. .-------------------. |
4393-
// | [-as] [-!a] |
4389+
// [.] [-*] |
4390+
// .---------------. .-------------------. |
4391+
// | finalizeNVPTX | | SPIRVTranslator | |
4392+
// .---------------. .-------------------. |
4393+
// [.] [-as] [-!a] |
43944394
// | | | |
43954395
// | [-s] | |
43964396
// | .----------------. | |
43974397
// | | BackendCompile | | |
43984398
// | .----------------. | |
43994399
// | [-s] | |
44004400
// | | | |
4401-
// | [-a] [-!a] [+]
4402-
// | .--------------------.
4403-
// | | FileTableTform |
4404-
// | | (replace "Code") |
4405-
// | .--------------------.
4406-
// | |
4407-
// [.n] [+*]
4401+
// [.] [-a] [-!a] [+]
4402+
// .------------------------------------.
4403+
// | FileTableTform |
4404+
// | (replace "Code") |
4405+
// .------------------------------------.
4406+
// |
4407+
// [+]
44084408
// .--------------------------------------.
44094409
// | OffloadWrapper |
44104410
// .--------------------------------------.
@@ -4451,24 +4451,40 @@ class OffloadingActionBuilder final {
44514451
ActionList WrapperInputs;
44524452
// post link is not optional - even if not splitting, always need to
44534453
// process specialization constants
4454-
types::ID PostLinkOutType =
4455-
isNVPTX || isAMDGCN ? types::TY_LLVM_BC : types::TY_Tempfiletable;
44564454
auto *PostLinkAction = C.MakeAction<SYCLPostLinkJobAction>(
4457-
FullDeviceLinkAction, PostLinkOutType);
4455+
FullDeviceLinkAction, types::TY_Tempfiletable);
44584456
PostLinkAction->setRTSetsSpecConstants(!isAOT);
44594457

4460-
if (isNVPTX) {
4461-
Action *FinAction =
4462-
finalizeNVPTXDependences(PostLinkAction, (*TC)->getTriple());
4463-
WrapperInputs.push_back(FinAction);
4464-
} else if (isAMDGCN) {
4465-
Action *FinAction =
4466-
finalizeAMDGCNDependences(PostLinkAction, (*TC)->getTriple());
4467-
WrapperInputs.push_back(FinAction);
4458+
constexpr char COL_CODE[] = "Code";
4459+
4460+
if (isNVPTX || isAMDGCN) {
4461+
// Make extraction copy the only remaining code file instead of
4462+
// creating a new table with a single entry.
4463+
// TODO: Process all PTX code files in file table to enable code
4464+
// splitting for PTX target.
4465+
auto *ExtractIRFilesAction = C.MakeAction<FileTableTformJobAction>(
4466+
PostLinkAction, types::TY_LLVM_BC);
4467+
ExtractIRFilesAction->addCopySingleFileTform(COL_CODE, 0);
4468+
4469+
Action *FinAction;
4470+
if (isNVPTX) {
4471+
FinAction = finalizeNVPTXDependences(ExtractIRFilesAction,
4472+
(*TC)->getTriple());
4473+
} else /* isAMDGCN */ {
4474+
FinAction = finalizeAMDGCNDependences(ExtractIRFilesAction,
4475+
(*TC)->getTriple());
4476+
}
4477+
ActionList TformInputs{PostLinkAction, FinAction};
4478+
4479+
// Replace the only code entry in the table, as confirmed by the
4480+
// previous transformation.
4481+
auto *ReplaceFilesAction = C.MakeAction<FileTableTformJobAction>(
4482+
TformInputs, types::TY_Tempfiletable);
4483+
ReplaceFilesAction->addReplaceCellTform(COL_CODE, 0);
4484+
WrapperInputs.push_back(ReplaceFilesAction);
44684485
} else {
44694486
// For SPIRV-based targets - translate to SPIRV then optionally
44704487
// compile ahead-of-time to native architecture
4471-
constexpr char COL_CODE[] = "Code";
44724488
auto *ExtractIRFilesAction = C.MakeAction<FileTableTformJobAction>(
44734489
PostLinkAction, types::TY_Tempfilelist);
44744490
// single column w/o title fits TY_Tempfilelist format
@@ -4513,6 +4529,7 @@ class OffloadingActionBuilder final {
45134529
ReplaceFilesAction->addReplaceColumnTform(COL_CODE, COL_CODE);
45144530
WrapperInputs.push_back(ReplaceFilesAction);
45154531
}
4532+
45164533
// After the Link, wrap the files before the final host link
45174534
auto *DeviceWrappingAction = C.MakeAction<OffloadWrapperJobAction>(
45184535
WrapperInputs, types::TY_Object);
@@ -5619,11 +5636,9 @@ Action *Driver::ConstructPhaseAction(
56195636
!Args.hasArg(options::OPT_fno_sycl_use_footer) &&
56205637
TargetDeviceOffloadKind == Action::OFK_None) {
56215638
// Performing a host compilation with -fsycl. Append the integration
5622-
// footer to the preprocessed source file. We then add another
5623-
// preprocessed step to complete the action chain.
5624-
auto *Preprocess = C.MakeAction<PreprocessJobAction>(Input, HostPPType);
5639+
// footer to the source file.
56255640
auto *AppendFooter =
5626-
C.MakeAction<AppendFooterJobAction>(Preprocess, types::TY_CXX);
5641+
C.MakeAction<AppendFooterJobAction>(Input, types::TY_CXX);
56275642
// FIXME: There are 2 issues with dependency generation in regards to
56285643
// the integration footer that need to be addressed.
56295644
// 1) Input file referenced on the RHS of a dependency is based on the

0 commit comments

Comments
 (0)