Skip to content

Commit d5b4c66

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web' (intel#47)
2 parents e4d1da9 + a61ac0f commit d5b4c66

File tree

242 files changed

+9574
-2623
lines changed

Some content is hidden

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

242 files changed

+9574
-2623
lines changed

.github/CODEOWNERS

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
clang/ @erichkeane, @Fznamznon
2+
3+
clang/**/Driver @mdtoguchi @AGindinson
4+
5+
llvm-spirv/ @AlexeySotkin, @AlexeySachkov
6+
7+
opencl-aot/ @dm-vodopyanov, @AlexeySachkov, @romanovvlad
8+
9+
libdevice/ @asavonic, @vzakhari
10+
11+
sycl/doc/extensions/ @mkinsner, @jbrodman
12+
13+
sycl/doc/ @pvchupin, @kbobrovs
14+
15+
sycl/ @romanovvlad, @bader
16+
17+
xpti/ @tovinkere, @andykaylor
18+
19+
* @bader

.github/workflows/gh_pages.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ jobs:
1313
ref: sycl
1414
path: repo
1515
- name: Install deps
16-
run: sudo apt-get install -y doxygen graphviz ssh ninja-build
16+
run: |
17+
sudo apt-get install -y doxygen graphviz ssh ninja-build
18+
sudo pip3 install sphinx recommonmark sphinx_markdown_tables
1719
- name: Build Docs
1820
run: |
1921
mkdir -p $GITHUB_WORKSPACE/build
2022
cd $GITHUB_WORKSPACE/build
2123
python $GITHUB_WORKSPACE/repo/buildbot/configure.py -w $GITHUB_WORKSPACE \
2224
-s $GITHUB_WORKSPACE/repo -o $GITHUB_WORKSPACE/build -t Release --docs
2325
cmake --build . --target doxygen-sycl
26+
cmake --build . --target docs-sycl-html
2427
- name: Deploy
2528
env:
2629
SSH_KEY: ${{secrets.ACTIONS_DEPLOY_KEY}}
@@ -32,7 +35,11 @@ jobs:
3235
ssh-add -k ~/.ssh/id_rsa
3336
git clone [email protected]:intel/llvm-docs.git docs
3437
cd $GITHUB_WORKSPACE/docs
35-
yes | \cp -rf $GITHUB_WORKSPACE/build/tools/sycl/doc/doxygen/html/* .
38+
git rm -rf .
39+
touch .nojekyll
40+
yes | \cp -rf $GITHUB_WORKSPACE/build/tools/sycl/doc/html/* .
41+
mkdir doxygen
42+
yes | \cp -rf $GITHUB_WORKSPACE/build/tools/sycl/doc/doxygen/html/* doxygen/
3643
git config --global user.name "iclsrc"
3744
git config --global user.email "[email protected]"
3845
git add .

buildbot/configure.py

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def do_configure(args):
2020
sycl_build_pi_cuda = 'OFF'
2121
llvm_enable_assertions = 'ON'
2222
llvm_enable_doxygen = 'OFF'
23+
llvm_enable_sphinx = 'OFF'
2324
llvm_build_shared_libs = 'OFF'
2425

2526
if platform.system() == 'Linux':
@@ -38,6 +39,7 @@ def do_configure(args):
3839

3940
if args.docs:
4041
llvm_enable_doxygen = 'ON'
42+
llvm_enable_sphinx = 'ON'
4143

4244
if args.shared_libs:
4345
llvm_build_shared_libs = 'ON'
@@ -63,6 +65,7 @@ def do_configure(args):
6365
"-DCMAKE_INSTALL_PREFIX={}".format(install_dir),
6466
"-DSYCL_INCLUDE_TESTS=ON", # Explicitly include all kinds of SYCL tests.
6567
"-DLLVM_ENABLE_DOXYGEN={}".format(llvm_enable_doxygen),
68+
"-DLLVM_ENABLE_SPHINX={}".format(llvm_enable_sphinx),
6669
"-DBUILD_SHARED_LIBS={}".format(llvm_build_shared_libs),
6770
"-DSYCL_ENABLE_XPTI_TRACING=ON", # Explicitly turn on XPTI tracing
6871
llvm_dir

clang/CMakeLists.txt

+1-8
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,7 @@ set(ENABLE_X86_RELAX_RELOCATIONS OFF CACHE BOOL
237237
set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER FALSE CACHE BOOL
238238
"Enable the experimental new pass manager by default.")
239239

240-
# Clang tool executes cc1 commands in the same process after b4a99a0
241-
# It causes increasing memory consumption for compilations where several
242-
# source files are passed (for C++ application) or several build steps (e.g.
243-
# for SYCL application we have host, device and integration header step
244-
# per source file). Memory is not freed for all cc1 commands until end
245-
# This change forces clang driver use old behavior untill memory issue
246-
# is fixed.
247-
set(CLANG_SPAWN_CC1 ON CACHE BOOL
240+
set(CLANG_SPAWN_CC1 OFF CACHE BOOL
248241
"Whether clang should use a new process for the CC1 invocation")
249242

250243
# TODO: verify the values against LangStandards.def?

clang/include/clang/Basic/Attr.td

+62-4
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ class DefaultIntArgument<string name, int default> : IntArgument<name, 1> {
236236
int Default = default;
237237
}
238238

239+
class DefaultUnsignedArgument<string name, int default> : UnsignedArgument<name, 1> {
240+
int Default = default;
241+
}
242+
239243
// This argument is more complex, it includes the enumerator type name,
240244
// a list of strings to accept, and a list of enumerators to map them to.
241245
class EnumArgument<string name, string type, list<string> values,
@@ -1676,6 +1680,57 @@ def SYCLIntelFPGAMaxConcurrency : Attr {
16761680
let Documentation = [SYCLIntelFPGAMaxConcurrencyAttrDocs];
16771681
}
16781682

1683+
def SYCLIntelFPGALoopCoalesce : Attr {
1684+
let Spellings = [CXX11<"intelfpga","loop_coalesce">];
1685+
let Args = [ExprArgument<"NExpr">];
1686+
let LangOpts = [SYCLIsDevice, SYCLIsHost];
1687+
let HasCustomTypeTransform = 1;
1688+
let AdditionalMembers = [{
1689+
static const char *getName() {
1690+
return "loop_coalesce";
1691+
}
1692+
}];
1693+
let Documentation = [SYCLIntelFPGALoopCoalesceAttrDocs];
1694+
}
1695+
1696+
def SYCLIntelFPGADisableLoopPipelining : Attr {
1697+
let Spellings = [CXX11<"intelfpga","disable_loop_pipelining">];
1698+
let LangOpts = [SYCLIsDevice, SYCLIsHost];
1699+
let HasCustomTypeTransform = 1;
1700+
let AdditionalMembers = [{
1701+
static const char *getName() {
1702+
return "disable_loop_pipelining";
1703+
}
1704+
}];
1705+
let Documentation = [SYCLIntelFPGADisableLoopPipeliningAttrDocs];
1706+
}
1707+
1708+
def SYCLIntelFPGAMaxInterleaving : Attr {
1709+
let Spellings = [CXX11<"intelfpga","max_interleaving">];
1710+
let Args = [ExprArgument<"NExpr">];
1711+
let LangOpts = [SYCLIsDevice, SYCLIsHost];
1712+
let HasCustomTypeTransform = 1;
1713+
let AdditionalMembers = [{
1714+
static const char *getName() {
1715+
return "max_interleaving";
1716+
}
1717+
}];
1718+
let Documentation = [SYCLIntelFPGAMaxInterleavingAttrDocs];
1719+
}
1720+
1721+
def SYCLIntelFPGASpeculatedIterations : Attr {
1722+
let Spellings = [CXX11<"intelfpga","speculated_iterations">];
1723+
let Args = [ExprArgument<"NExpr">];
1724+
let LangOpts = [SYCLIsDevice, SYCLIsHost];
1725+
let HasCustomTypeTransform = 1;
1726+
let AdditionalMembers = [{
1727+
static const char *getName() {
1728+
return "speculated_iterations";
1729+
}
1730+
}];
1731+
let Documentation = [SYCLIntelFPGASpeculatedIterationsAttrDocs];
1732+
}
1733+
16791734
def IntelFPGALocalNonConstVar : SubsetSubject<Var,
16801735
[{S->hasLocalStorage() &&
16811736
S->getKind() != Decl::ImplicitParam &&
@@ -2471,13 +2526,16 @@ def NoDeref : TypeAttr {
24712526
let Documentation = [NoDerefDocs];
24722527
}
24732528

2529+
// Default arguments in ReqWorkGroupSize can be used only with
2530+
// intel::reqd_work_group_size spelling.
24742531
def ReqdWorkGroupSize : InheritableAttr {
24752532
let Spellings = [GNU<"reqd_work_group_size">,
2476-
CXX11<"cl","reqd_work_group_size">];
2477-
let Args = [UnsignedArgument<"XDim">, UnsignedArgument<"YDim">,
2478-
UnsignedArgument<"ZDim">];
2533+
CXX11<"intel","reqd_work_group_size">,
2534+
CXX11<"cl","reqd_work_group_size">];
2535+
let Args = [UnsignedArgument<"XDim">, DefaultUnsignedArgument<"YDim", 1>,
2536+
DefaultUnsignedArgument<"ZDim", 1>];
24792537
let Subjects = SubjectList<[Function], ErrorDiag>;
2480-
let Documentation = [Undocumented];
2538+
let Documentation = [ReqdWorkGroupSizeAttrDocs];
24812539
}
24822540

24832541
def WorkGroupSizeHint : InheritableAttr {

clang/include/clang/Basic/AttrDocs.td

+77
Original file line numberDiff line numberDiff line change
@@ -2003,6 +2003,36 @@ device kernel, the attribute is ignored and it is not propagated to a kernel.
20032003
}];
20042004
}
20052005

2006+
def ReqdWorkGroupSizeAttrDocs : Documentation {
2007+
let Category = DocCatFunction;
2008+
let Heading = "reqd_work_group_size";
2009+
let Content = [{
2010+
This attribute is documented by both OpenCL and SYCL standards
2011+
and allows to specify exact *local_work_size* which must be used as
2012+
argument to **clEnqueueNDRangeKernel** (in OpenCL) or to
2013+
**parallel_for** in SYCL. This allows the compiler to optimize the
2014+
generated code appropriately for the kernel to which attribute is applied.
2015+
2016+
While semantic of this attribute is the same between OpenCL and SYCL,
2017+
spelling is a bit different:
2018+
2019+
SYCL 1.2.1 describes ``[[cl::reqd_work_group_size(X, Y, Z)]]`` spelling: this
2020+
attribute is legal on device functions and is propagated down to any caller of
2021+
those device functions, such that the kernel attributes are the sum of all
2022+
attributes of all device functions called in this kernel.
2023+
See section 6.7 Attributes for more details.
2024+
2025+
As Intel extension, ``[[intel::reqd_work_group_size(X, Y, Z)]]`` spelling is allowed
2026+
which features optional arguments `Y` and `Z`, those simplifies its usage if
2027+
only 1- or 2-dimensional ND-range is assumed by a programmer. These arguments
2028+
defaults to ``1``.
2029+
2030+
In OpenCL C, this attribute is available in GNU spelling
2031+
(``__attribute__((reqd_work_group_size(X, Y, Z)))``), see section
2032+
6.7.2 Optional Attribute Qualifiers of OpenCL 1.2 specification for details.
2033+
}];
2034+
}
2035+
20062036
def SYCLIntelMaxWorkGroupSizeAttrDocs : Documentation {
20072037
let Category = DocCatFunction;
20082038
let Heading = "max_work_group_size (IntelFPGA)";
@@ -2110,6 +2140,53 @@ be applied multiple times to the same loop.
21102140
}];
21112141
}
21122142

2143+
def SYCLIntelFPGALoopCoalesceAttrDocs : Documentation {
2144+
let Category = DocCatVariable;
2145+
let Heading = "loop_coalesce";
2146+
let Content = [{
2147+
This attribute applies to a loop. Indicates that the loop nest should be
2148+
coalesced into a single loop without affecting functionality. Parameter N is
2149+
optional. If specified, it shall be a positive integer, and indicates how many
2150+
of the nested loop levels should be coalesced.
2151+
}];
2152+
}
2153+
2154+
def SYCLIntelFPGADisableLoopPipeliningAttrDocs : Documentation {
2155+
let Category = DocCatVariable;
2156+
let Heading = "disable_loop_pipelining";
2157+
let Content = [{
2158+
This attribute applies to a loop. Disables pipelining of the loop data path,
2159+
causing the loop to be executed serially. Cannot be used on the same loop in
2160+
conjunction with max_interleaving, speculated_iterations, max_concurrency, ii
2161+
or ivdep.
2162+
}];
2163+
}
2164+
2165+
def SYCLIntelFPGAMaxInterleavingAttrDocs : Documentation {
2166+
let Category = DocCatVariable;
2167+
let Heading = "max_interleaving";
2168+
let Content = [{
2169+
This attribute applies to a loop. Places a maximum limit N on the number of
2170+
interleaved invocations of an inner loop by an outer loop (note, this does not
2171+
mean that this attribute can only be applied to inner loops in user code - outer
2172+
loops in user code may still be contained in an implicit loop due to NDRange).
2173+
Parameter N is mandatory, and shall be non-negative integer. Cannot be
2174+
used on the same loop in conjunction with disable_loop_pipelining.
2175+
}];
2176+
}
2177+
2178+
def SYCLIntelFPGASpeculatedIterationsAttrDocs : Documentation {
2179+
let Category = DocCatVariable;
2180+
let Heading = "speculated_iterations";
2181+
let Content = [{
2182+
This attribute applies to a loop. Specifies the number of concurrent speculated
2183+
iterations that will be in flight for a loop invocation (i.e. the exit
2184+
condition for these iterations will not have been evaluated yet).
2185+
Parameter N is mandatory, and may either be 0, or a positive integer. Cannot be
2186+
used on the same loop in conjunction with disable_loop_pipelining.
2187+
}];
2188+
}
2189+
21132190
def SYCLDeviceIndirectlyCallableDocs : Documentation {
21142191
let Category = DocCatFunction;
21152192
let Heading = "intel::device_indirectly_callable";

clang/include/clang/Basic/DiagnosticSemaKinds.td

+3-3
Original file line numberDiff line numberDiff line change
@@ -10666,9 +10666,9 @@ def err_builtin_launder_invalid_arg : Error<
1066610666
// SYCL-specific diagnostics
1066710667
def err_sycl_attribute_address_space_invalid : Error<
1066810668
"address space is outside the valid range of values">;
10669-
def err_sycl_kernel_name_class_not_top_level : Error<
10670-
"kernel name class and its template argument classes' declarations can only "
10671-
"nest in a namespace: %0">;
10669+
def err_sycl_kernel_incorrectly_named : Error<
10670+
"kernel %select{name is missing"
10671+
"|needs to have a globally-visible name}0">;
1067210672
def err_sycl_restrict : Error<
1067310673
"SYCL kernel cannot "
1067410674
"%select{use a non-const global variable"

clang/include/clang/Driver/Action.h

+51-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "llvm/ADT/SmallVector.h"
1818
#include "llvm/ADT/StringRef.h"
1919
#include "llvm/ADT/iterator_range.h"
20+
#include <initializer_list>
2021
#include <string>
2122

2223
namespace llvm {
@@ -78,9 +79,10 @@ class Action {
7879
SYCLPostLinkJobClass,
7980
PartialLinkJobClass,
8081
BackendCompileJobClass,
82+
FileTableTformJobClass,
8183

8284
JobClassFirst = PreprocessJobClass,
83-
JobClassLast = BackendCompileJobClass
85+
JobClassLast = FileTableTformJobClass
8486
};
8587

8688
// The offloading kind determines if this action is binded to a particular
@@ -679,6 +681,13 @@ class SYCLPostLinkJobAction : public JobAction {
679681
static bool classof(const Action *A) {
680682
return A->getKind() == SYCLPostLinkJobClass;
681683
}
684+
685+
void setRTSetsSpecConstants(bool Val) { RTSetsSpecConsts = Val; }
686+
687+
bool getRTSetsSpecConstants() const { return RTSetsSpecConsts; }
688+
689+
private:
690+
bool RTSetsSpecConsts = true;
682691
};
683692

684693
class PartialLinkJobAction : public JobAction {
@@ -705,6 +714,47 @@ class BackendCompileJobAction : public JobAction {
705714
}
706715
};
707716

717+
// Represents a file table transformation action. The order of inputs to a
718+
// FileTableTformJobAction at construction time must accord with the tforms
719+
// added later - some tforms "consume" inputs. For example, "replace column"
720+
// needs another file to read the replacement column from.
721+
class FileTableTformJobAction : public JobAction {
722+
void anchor() override;
723+
724+
public:
725+
struct Tform {
726+
enum Kind { EXTRACT, EXTRACT_DROP_TITLE, REPLACE };
727+
728+
Tform() = default;
729+
Tform(Kind K, std::initializer_list<StringRef> Args) : TheKind(K) {
730+
for (auto A : Args)
731+
TheArgs.emplace_back(A.str());
732+
}
733+
734+
Kind TheKind;
735+
SmallVector<std::string, 2> TheArgs;
736+
};
737+
738+
FileTableTformJobAction(Action *Input, types::ID OutputType);
739+
FileTableTformJobAction(ActionList &Inputs, types::ID OutputType);
740+
741+
// Deletes all columns except the one with given name.
742+
void addExtractColumnTform(StringRef ColumnName, bool WithColTitle = true);
743+
744+
// Replaces a column with title <From> in this table with a column with title
745+
// <To> from another file table passed as input to this action.
746+
void addReplaceColumnTform(StringRef From, StringRef To);
747+
748+
static bool classof(const Action *A) {
749+
return A->getKind() == FileTableTformJobClass;
750+
}
751+
752+
const ArrayRef<Tform> getTforms() const { return Tforms; }
753+
754+
private:
755+
SmallVector<Tform, 2> Tforms; // transformation actions requested
756+
};
757+
708758
} // namespace driver
709759
} // namespace clang
710760

clang/include/clang/Driver/CC1Options.td

+2
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,8 @@ def fsycl_std_layout_kernel_params: Flag<["-"], "fsycl-std-layout-kernel-params"
919919
def fsycl_allow_func_ptr : Flag<["-"], "fsycl-allow-func-ptr">,
920920
HelpText<"Allow function pointers in SYCL device.">;
921921
def fno_sycl_allow_func_ptr : Flag<["-"], "fno-sycl-allow-func-ptr">;
922+
def fsycl_enable_optimizations: Flag<["-"], "fsycl-enable-optimizations">,
923+
HelpText<"Experimental flag enabling standard optimization in the front-end.">;
922924

923925
} // let Flags = [CC1Option]
924926

clang/include/clang/Driver/ToolChain.h

+2
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ class ToolChain {
147147
mutable std::unique_ptr<Tool> SYCLPostLink;
148148
mutable std::unique_ptr<Tool> PartialLink;
149149
mutable std::unique_ptr<Tool> BackendCompiler;
150+
mutable std::unique_ptr<Tool> FileTableTform;
150151

151152
Tool *getClang() const;
152153
Tool *getFlang() const;
@@ -161,6 +162,7 @@ class ToolChain {
161162
Tool *getSYCLPostLink() const;
162163
Tool *getPartialLink() const;
163164
Tool *getBackendCompiler() const;
165+
Tool *getTableTform() const;
164166

165167
mutable std::unique_ptr<SanitizerArgs> SanitizerArguments;
166168
mutable std::unique_ptr<XRayArgs> XRayArguments;

0 commit comments

Comments
 (0)