Skip to content

Commit 10d78e5

Browse files
committed
Merge remote-tracking branch 'origin/sycl' into memcpy_for_libdevice
2 parents 99c9cd2 + 9997cf8 commit 10d78e5

File tree

83 files changed

+1519
-622
lines changed

Some content is hidden

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

83 files changed

+1519
-622
lines changed

.github/workflows/gh_pages.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ jobs:
2424
python $GITHUB_WORKSPACE/repo/buildbot/configure.py -w $GITHUB_WORKSPACE \
2525
-s $GITHUB_WORKSPACE/repo -o $GITHUB_WORKSPACE/build -t Release --docs
2626
cmake --build . --target doxygen-sycl
27+
cmake --build . --target doxygen-clang
2728
cmake --build . --target docs-sycl-html
29+
cmake --build . --target docs-clang-html
2830
- name: Deploy
2931
env:
3032
SSH_KEY: ${{secrets.ACTIONS_DEPLOY_KEY}}
@@ -41,6 +43,10 @@ jobs:
4143
yes | \cp -rf $GITHUB_WORKSPACE/build/tools/sycl/doc/html/* .
4244
mkdir doxygen
4345
yes | \cp -rf $GITHUB_WORKSPACE/build/tools/sycl/doc/doxygen/html/* doxygen/
46+
mkdir clang
47+
yes | \cp -rf $GITHUB_WORKSPACE/build/tools/clang/docs/html/* clang/
48+
mkdir clang_doxygen
49+
yes | \cp -rf $GITHUB_WORKSPACE/build/tools/clang/docs/doxygen/html/* clang_doxygen/
4450
git config --global user.name "iclsrc"
4551
git config --global user.email "[email protected]"
4652
git add .

clang/docs/LanguageExtensions.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2452,6 +2452,27 @@ their usual pattern without any special treatment.
24522452
// Computes a unique stable name for the given type.
24532453
constexpr const char * __builtin_sycl_unique_stable_name( type-id );
24542454
2455+
``__builtin_sycl_unique_stable_id``
2456+
----------------------------------
2457+
2458+
Like ``__builtin_sycl_unique_stable_name``, this builtin generates a unique and
2459+
stable name as a string literal to support sharing it across split compliations.
2460+
2461+
However, this builtin takes the name of a variable with global storage and
2462+
provides the name for that. In the case of names with internal linkage, it
2463+
prepends an optional value if provided by ``-fsycl-unique-prefix`` on the command
2464+
line, which the driver will do for SYCL invocations.
2465+
2466+
This builtin produces a string that can be demangled, except when its argument has
2467+
internal linkage.
2468+
2469+
**Syntax**:
2470+
2471+
.. code-block:: c++
2472+
2473+
// Computes a unique stable name for a given variable.
2474+
constexpr bool __builtin_sycl_unique_stable_id( expr );
2475+
24552476
``__builtin_sycl_mark_kernel_name``
24562477
-----------------------------------
24572478

clang/include/clang/AST/ASTContext.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3175,8 +3175,9 @@ OPT_LIST(V)
31753175
unsigned GetSYCLKernelNamingIndex(const NamedDecl *RD);
31763176
/// A SourceLocation to store whether we have evaluated a kernel name already,
31773177
/// and where it happened. If so, we need to diagnose an illegal use of the
3178-
/// builtin.
3179-
llvm::MapVector<const SYCLUniqueStableNameExpr *, std::string>
3178+
/// builtin. This should only contain SYCLUniqueStableNameExprs and
3179+
/// SYCLUniqueStableIdExprs.
3180+
llvm::MapVector<const Expr *, std::string>
31803181
SYCLUniqueStableNameEvaluatedValues;
31813182

31823183
private:

clang/include/clang/AST/ComputeDependence.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class MaterializeTemporaryExpr;
7878
class CXXFoldExpr;
7979
class TypeTraitExpr;
8080
class ConceptSpecializationExpr;
81+
class SYCLUniqueStableIdExpr;
8182
class SYCLUniqueStableNameExpr;
8283
class PredefinedExpr;
8384
class CallExpr;
@@ -171,6 +172,7 @@ ExprDependence computeDependence(ConceptSpecializationExpr *E,
171172
bool ValueDependent);
172173

173174
ExprDependence computeDependence(SYCLUniqueStableNameExpr *E);
175+
ExprDependence computeDependence(SYCLUniqueStableIdExpr *E);
174176
ExprDependence computeDependence(PredefinedExpr *E);
175177
ExprDependence computeDependence(CallExpr *E, llvm::ArrayRef<Expr *> PreArgs);
176178
ExprDependence computeDependence(OffsetOfExpr *E);

clang/include/clang/AST/Expr.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,6 +2097,58 @@ class SYCLUniqueStableNameExpr final : public Expr {
20972097
static std::string ComputeName(ASTContext &Context, QualType Ty);
20982098
};
20992099

2100+
class SYCLUniqueStableIdExpr final : public Expr {
2101+
friend class ASTStmtReader;
2102+
SourceLocation OpLoc, LParen, RParen;
2103+
// A statement instead of an expression because otherwise implementing
2104+
// 'children' is awkward.
2105+
Stmt *DRE = nullptr;
2106+
2107+
SYCLUniqueStableIdExpr(EmptyShell Empty, QualType ResultTy);
2108+
SYCLUniqueStableIdExpr(SourceLocation OpLoc, SourceLocation LParen,
2109+
SourceLocation RParen, QualType ResultTy, Expr *E);
2110+
2111+
void setExpr(Expr *E) { DRE = E; }
2112+
2113+
void setLocation(SourceLocation L) { OpLoc = L; }
2114+
void setLParenLocation(SourceLocation L) { LParen = L; }
2115+
void setRParenLocation(SourceLocation L) { RParen = L; }
2116+
2117+
public:
2118+
Expr *getExpr() { return cast<Expr>(DRE); }
2119+
const Expr *getExpr() const { return cast<Expr>(DRE); }
2120+
2121+
static SYCLUniqueStableIdExpr *Create(const ASTContext &Ctx,
2122+
SourceLocation OpLoc,
2123+
SourceLocation LParen,
2124+
SourceLocation RParen, Expr *E);
2125+
2126+
static SYCLUniqueStableIdExpr *CreateEmpty(const ASTContext &Ctx);
2127+
2128+
SourceLocation getBeginLoc() const { return getLocation(); }
2129+
SourceLocation getEndLoc() const { return RParen; }
2130+
SourceLocation getLocation() const { return OpLoc; }
2131+
SourceLocation getLParenLocation() const { return LParen; }
2132+
SourceLocation getRParenLocation() const { return RParen; }
2133+
2134+
static bool classof(const Stmt *T) {
2135+
return T->getStmtClass() == SYCLUniqueStableIdExprClass;
2136+
}
2137+
2138+
// Iterators
2139+
child_range children() { return child_range(&DRE, &DRE + 1); }
2140+
const_child_range children() const {
2141+
return const_child_range(&DRE, &DRE + 1);
2142+
}
2143+
2144+
// Convenience function to generate the name of the currently stored type.
2145+
std::string ComputeName(ASTContext &Context) const;
2146+
2147+
// Get the generated name of the type. Note that this only works after all
2148+
// kernels have been instantiated.
2149+
static std::string ComputeName(ASTContext &Context, const VarDecl *VD);
2150+
};
2151+
21002152
/// ParenExpr - This represents a parethesized expression, e.g. "(1)". This
21012153
/// AST node is only formed if full location information is requested.
21022154
class ParenExpr : public Expr {

clang/include/clang/AST/JSONNodeDumper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ class JSONNodeDumper
264264

265265
void VisitDeclRefExpr(const DeclRefExpr *DRE);
266266
void VisitSYCLUniqueStableNameExpr(const SYCLUniqueStableNameExpr *E);
267+
void VisitSYCLUniqueStableIdExpr(const SYCLUniqueStableIdExpr *E);
267268
void VisitPredefinedExpr(const PredefinedExpr *PE);
268269
void VisitUnaryOperator(const UnaryOperator *UO);
269270
void VisitBinaryOperator(const BinaryOperator *BO);

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,6 +2679,7 @@ DEF_TRAVERSE_STMT(ParenListExpr, {})
26792679
DEF_TRAVERSE_STMT(SYCLUniqueStableNameExpr, {
26802680
TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
26812681
})
2682+
DEF_TRAVERSE_STMT(SYCLUniqueStableIdExpr, {})
26822683
DEF_TRAVERSE_STMT(PredefinedExpr, {})
26832684
DEF_TRAVERSE_STMT(ShuffleVectorExpr, {})
26842685
DEF_TRAVERSE_STMT(ConvertVectorExpr, {})

clang/include/clang/AST/TextNodeDumper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ class TextNodeDumper
250250
void VisitImplicitCastExpr(const ImplicitCastExpr *Node);
251251
void VisitDeclRefExpr(const DeclRefExpr *Node);
252252
void VisitSYCLUniqueStableNameExpr(const SYCLUniqueStableNameExpr *Node);
253+
void VisitSYCLUniqueStableIdExpr(const SYCLUniqueStableIdExpr *Node);
253254
void VisitPredefinedExpr(const PredefinedExpr *Node);
254255
void VisitCharacterLiteral(const CharacterLiteral *Node);
255256
void VisitIntegerLiteral(const IntegerLiteral *Node);

clang/include/clang/Basic/AttrDocs.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4543,6 +4543,7 @@ used to specify full unrolling or partial unrolling by a specified amount.
45434543

45444544
def IntelReqdSubGroupSizeDocs : Documentation {
45454545
let Category = DocCatStmt;
4546+
let Heading = "intel_reqd_sub_group_size";
45464547
let Content = [{
45474548
This attribute can be used in both OpenCL and SYCL.
45484549

@@ -4563,7 +4564,7 @@ to a sub-group size supported by the device, or device compilation will fail.
45634564

45644565
The ``[[intel::sub_group_size(n)]]`` attribute has the same effect as the other
45654566
attribute spellings, except that it follows the SYCL 2020 Attribute Rules. See
4566-
the ``[[intel::named_sub_group_size(NAME)]]`` documentation for clarification.
4567+
the ``[[intel::named_sub_group_size(NAME)]]`` documentation for clarification.
45674568

45684569
This attribute is mutually exclusive with ``[[intel::named_sub_group_size(NAME)]]``
45694570
and ``[[intel::sycl_explicit_simd]]``.

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6411,9 +6411,13 @@ def warn_gnu_null_ptr_arith : Warning<
64116411
InGroup<NullPointerArithmetic>, DefaultIgnore;
64126412
def err_kernel_invalidates_sycl_unique_stable_name
64136413
: Error<"kernel %select{naming|instantiation}0 changes the result of an "
6414-
"evaluated '__builtin_sycl_unique_stable_name'">;
6414+
"evaluated '__builtin_sycl_unique_stable_%select{name|id}1'">;
64156415
def note_sycl_unique_stable_name_evaluated_here
6416-
: Note<"'__builtin_sycl_unique_stable_name' evaluated here">;
6416+
: Note<"'__builtin_sycl_unique_stable_%select{name|id}0' evaluated here">;
6417+
def err_unique_stable_id_expected_var : Error<"expected variable name">;
6418+
def err_unique_stable_id_global_storage
6419+
: Error<"argument passed to '__builtin_sycl_unique_stable_id' must have "
6420+
"global storage">;
64176421

64186422
def warn_floatingpoint_eq : Warning<
64196423
"comparing floating point with == or != is unsafe">,

0 commit comments

Comments
 (0)