Skip to content

Commit 614a0c4

Browse files
author
Alexander Batashev
committed
Merge branch 'sycl' into group_barrier
* sycl: (320 commits) [SYCL] Silence a "local variable is initialized but not referenced" warning; NFC (intel#3870) [SYCL] Improve SYCL_DEVICE_ALLOWLIST (intel#3826) [SPIR-V] Change return value of mapType function (intel#3871) [SYCL] Fix post-commit failure in handler.hpp from unused-parameters. (intel#3874) [Driver][SYCL] Do not imply defaultlib msvcrt for Linux based driver on Windows (intel#3827) [SYCL] Unique stable name rebase (intel#3835) [SYCL] Align behavior of empty command groups with SYCL2020 (intel#3822) [SYCL][ESIMD] Make typenames and constants consistent with SYCL API style. (intel#3850) [SYCL] Allow __failed_assertion to support libstdc++-11 (intel#3774) [SYCL] Refactor stream class handing implementation (intel#3646) [SYCL] Fix syntax error introduced in intel#3401 (intel#3861) [SYCL] SYCL 2020 sub_group algorithms (intel#3786) [Buildbot][NFC] Add option to use LLD as linker (intel#3866) Revert "Emit correct location lists with basic block sections." [SPIRITTAnnotations] Fix debug info for ITT calls. (intel#3829) [SYCL][Doc] Fix build of Sphinx docs (intel#3863) [SYCL][FPGA][NFC] Tidy up intel_fpga_reg codegen test (intel#3810) [CODEOWNERS] Fix SPIRITTAnnnotations tests ownership (intel#3859) [SYCL][ESIMD] Host-compile simd.cpp test, fix errors & warnings. (intel#3846) [SYCL] Store pointers to memory allocations instead of iterators (intel#3860) ...
2 parents 6f98d16 + ce1c5a4 commit 614a0c4

File tree

1,909 files changed

+115648
-87340
lines changed

Some content is hidden

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

1,909 files changed

+115648
-87340
lines changed

.github/CODEOWNERS

+3-2
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,6 @@ sycl/include/sycl/ext/intel/experimental/esimd.hpp @kbobrovs @DenisBakhvalov
105105
sycl/doc/extensions/ExplicitSIMD/ @kbobrovs
106106

107107
# ITT annotations
108-
llvm/lib/Transforms/Instrumentation/SPIRITTAnnotations.cpp @MrSidims
109-
llvm/include/llvm/Transforms/Instrumentation/SPIRITTAnnotations.h @MrSidims
108+
llvm/lib/Transforms/Instrumentation/SPIRITTAnnotations.cpp @MrSidims @vzakhari
109+
llvm/include/llvm/Transforms/Instrumentation/SPIRITTAnnotations.h @MrSidims @vzakhari
110+
llvm/test/Transforms/SPIRITTAnnotations/* @MrSidims @vzakhari

buildbot/configure.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def do_configure(args):
3030
llvm_enable_doxygen = 'OFF'
3131
llvm_enable_sphinx = 'OFF'
3232
llvm_build_shared_libs = 'OFF'
33+
llvm_enable_lld = 'OFF'
3334

3435
sycl_enable_xpti_tracing = 'ON'
3536

@@ -56,6 +57,9 @@ def do_configure(args):
5657
if args.shared_libs:
5758
llvm_build_shared_libs = 'ON'
5859

60+
if args.use_lld:
61+
llvm_enable_lld = 'ON'
62+
5963
install_dir = os.path.join(abs_obj_dir, "install")
6064

6165
cmake_cmd = [
@@ -81,7 +85,8 @@ def do_configure(args):
8185
"-DLLVM_ENABLE_DOXYGEN={}".format(llvm_enable_doxygen),
8286
"-DLLVM_ENABLE_SPHINX={}".format(llvm_enable_sphinx),
8387
"-DBUILD_SHARED_LIBS={}".format(llvm_build_shared_libs),
84-
"-DSYCL_ENABLE_XPTI_TRACING={}".format(sycl_enable_xpti_tracing)
88+
"-DSYCL_ENABLE_XPTI_TRACING={}".format(sycl_enable_xpti_tracing),
89+
"-DLLVM_ENABLE_LLD={}".format(llvm_enable_lld)
8590
]
8691

8792
if args.l0_headers and args.l0_loader:
@@ -151,6 +156,7 @@ def main():
151156
parser.add_argument("--use-libcxx", action="store_true", help="build sycl runtime with libcxx")
152157
parser.add_argument("--libcxx-include", metavar="LIBCXX_INCLUDE_PATH", help="libcxx include path")
153158
parser.add_argument("--libcxx-library", metavar="LIBCXX_LIBRARY_PATH", help="libcxx library path")
159+
parser.add_argument("--use-lld", action="store_true", help="Use LLD linker for build")
154160
args = parser.parse_args()
155161

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

clang-tools-extra/clangd/ClangdServer.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ struct UpdateIndexCallbacks : public ParsingCallbacks {
7575
const CanonicalIncludes &CanonIncludes) override {
7676
if (FIndex)
7777
FIndex->updatePreamble(Path, Version, Ctx, std::move(PP), CanonIncludes);
78-
if (ServerCallbacks)
79-
ServerCallbacks->onSemanticsMaybeChanged(Path);
8078
}
8179

8280
void onMainAST(PathRef Path, ParsedAST &AST, PublishFn Publish) override {
@@ -105,6 +103,11 @@ struct UpdateIndexCallbacks : public ParsingCallbacks {
105103
ServerCallbacks->onFileUpdated(File, Status);
106104
}
107105

106+
void onPreamblePublished(PathRef File) override {
107+
if (ServerCallbacks)
108+
ServerCallbacks->onSemanticsMaybeChanged(File);
109+
}
110+
108111
private:
109112
FileIndex *FIndex;
110113
ClangdServer::Callbacks *ServerCallbacks;

clang-tools-extra/clangd/TUScheduler.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,7 @@ void PreambleThread::build(Request Req) {
909909
ASTPeer.updatePreamble(std::move(Req.CI), std::move(Req.Inputs),
910910
LatestBuild, std::move(Req.CIDiags),
911911
std::move(Req.WantDiags));
912+
Callbacks.onPreamblePublished(FileName);
912913
});
913914

914915
if (!LatestBuild || Inputs.ForceRebuild) {

clang-tools-extra/clangd/TUScheduler.h

+5
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ class ParsingCallbacks {
169169

170170
/// Called whenever the TU status is updated.
171171
virtual void onFileUpdated(PathRef File, const TUStatus &Status) {}
172+
173+
/// Preamble for the TU have changed. This might imply new semantics (e.g.
174+
/// different highlightings). Any actions on the file are guranteed to see new
175+
/// preamble after the callback.
176+
virtual void onPreamblePublished(PathRef File) {}
172177
};
173178

174179
/// Handles running tasks for ClangdServer and managing the resources (e.g.,

clang/cmake/caches/Fuchsia-stage2.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ if(FUCHSIA_SDK)
145145
set(FUCHSIA_x86_64-unknown-fuchsia_NAME x64)
146146
set(FUCHSIA_riscv64-unknown-fuchsia_NAME riscv64)
147147
foreach(target i386-unknown-fuchsia;x86_64-unknown-fuchsia;aarch64-unknown-fuchsia;riscv64-unknown-fuchsia)
148-
set(FUCHSIA_${target}_COMPILER_FLAGS "--target=${target} -I${FUCHSIA_SDK}/pkg/fdio/include")
148+
set(FUCHSIA_${target}_COMPILER_FLAGS "--target=${target} -I${FUCHSIA_SDK}/pkg/sync/include -I${FUCHSIA_SDK}/pkg/fdio/include")
149149
set(FUCHSIA_${target}_LINKER_FLAGS "-L${FUCHSIA_SDK}/arch/${FUCHSIA_${target}_NAME}/lib")
150150
set(FUCHSIA_${target}_SYSROOT "${FUCHSIA_SDK}/arch/${FUCHSIA_${target}_NAME}/sysroot")
151151
endforeach()

clang/docs/LanguageExtensions.rst

+29-19
Original file line numberDiff line numberDiff line change
@@ -1794,7 +1794,7 @@ correctly in any circumstances. It can be used if:
17941794
metaprogramming algorithms to be able to specify/detect types generically.
17951795
17961796
- the generated kernel binary does not contain indirect calls because they
1797-
are eliminated using compiler optimizations e.g. devirtualization.
1797+
are eliminated using compiler optimizations e.g. devirtualization.
17981798
17991799
- the selected target supports the function pointer like functionality e.g.
18001800
most CPU targets.
@@ -2404,29 +2404,39 @@ argument.
24042404
int *pb =__builtin_preserve_access_index(&v->c[3].b);
24052405
__builtin_preserve_access_index(v->j);
24062406
2407-
``__builtin_unique_stable_name``
2408-
--------------------------------
2407+
``__builtin_sycl_unique_stable_name``
2408+
-------------------------------------
24092409
2410-
``__builtin_unique_stable_name()`` is a builtin that takes a type or expression and
2411-
produces a string literal containing a unique name for the type (or type of the
2412-
expression) that is stable across split compilations.
2410+
``__builtin_sycl_unique_stable_name()`` is a builtin that takes a type and
2411+
produces a string literal containing a unique name for the type that is stable
2412+
across split compilations, mainly to support SYCL/Data Parallel C++ language.
24132413
24142414
In cases where the split compilation needs to share a unique token for a type
24152415
across the boundary (such as in an offloading situation), this name can be used
2416-
for lookup purposes.
2416+
for lookup purposes, such as in the SYCL Integration Header.
2417+
2418+
The value of this builtin is computed entirely at compile time, so it can be
2419+
used in constant expressions. This value encodes lambda functions based on a
2420+
stable numbering order in which they appear in their local declaration contexts.
2421+
Once this builtin is evaluated in a constexpr context, it is erroneous to use
2422+
it in an instantiation which changes its value.
2423+
2424+
In order to produce the unique name, the current implementation of the bultin
2425+
uses Itanium mangling even if the host compilation uses a different name
2426+
mangling scheme at runtime. The mangler marks all the lambdas required to name
2427+
the SYCL kernel and emits a stable local ordering of the respective lambdas,
2428+
starting from ``10000``. The initial value of ``10000`` serves as an obvious
2429+
differentiator from ordinary lambda mangling numbers but does not serve any
2430+
other purpose and may change in the future. The resulting pattern is
2431+
demanglable. When non-lambda types are passed to the builtin, the mangler emits
2432+
their usual pattern without any special treatment.
2433+
2434+
**Syntax**:
24172435
2418-
This builtin is superior to RTTI for this purpose for two reasons. First, this
2419-
value is computed entirely at compile time, so it can be used in constant
2420-
expressions. Second, this value encodes lambda functions based on line-number
2421-
rather than the order in which it appears in a function. This is valuable
2422-
because it is stable in cases where an unrelated lambda is introduced
2423-
conditionally in the same function.
2436+
.. code-block:: c
24242437
2425-
The current implementation of this builtin uses a slightly modified Itanium
2426-
Mangler to produce the unique name. The lambda ordinal is replaced with one or
2427-
more line/column pairs in the format ``LINE->COL``, separated with a ``~``
2428-
character. Typically, only one pair will be included, however in the case of
2429-
macro expansions the entire macro expansion stack is expressed.
2438+
// Computes a unique stable name for the given type.
2439+
constexpr const char * __builtin_sycl_unique_stable_name( type-id );
24302440
24312441
Multiprecision Arithmetic Builtins
24322442
----------------------------------
@@ -2622,7 +2632,7 @@ Guaranteed inlined copy
26222632
``__builtin_memcpy_inline`` has been designed as a building block for efficient
26232633
``memcpy`` implementations. It is identical to ``__builtin_memcpy`` but also
26242634
guarantees not to call any external functions. See LLVM IR `llvm.memcpy.inline
2625-
<https://llvm.org/docs/LangRef.html#llvm-memcpy-inline-intrinsic>`_ intrinsic
2635+
<https://llvm.org/docs/LangRef.html#llvm-memcpy-inline-intrinsic>`_ intrinsic
26262636
for more information.
26272637
26282638
This is useful to implement a custom version of ``memcpy``, implement a

clang/docs/SanitizerCoverage.rst

+9-3
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,17 @@ will not be instrumented.
312312
// for every non-constant array index.
313313
void __sanitizer_cov_trace_gep(uintptr_t Idx);
314314

315-
Partially disabling instrumentation
316-
===================================
315+
Disabling instrumentation with ``__attribute__((no_sanitize("coverage")))``
316+
===========================================================================
317+
318+
It is possible to disable coverage instrumentation for select functions via the
319+
function attribute ``__attribute__((no_sanitize("coverage")))``.
320+
321+
Disabling instrumentation without source modification
322+
=====================================================
317323

318324
It is sometimes useful to tell SanitizerCoverage to instrument only a subset of the
319-
functions in your target.
325+
functions in your target without modifying source files.
320326
With ``-fsanitize-coverage-allowlist=allowlist.txt``
321327
and ``-fsanitize-coverage-blocklist=blocklist.txt``,
322328
you can specify such a subset through the combination of an allowlist and a blocklist.

clang/include/clang/AST/ASTContext.h

+28
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class DynTypedNode;
103103
class DynTypedNodeList;
104104
class Expr;
105105
class GlobalDecl;
106+
class ItaniumMangleContext;
106107
class MangleContext;
107108
class MangleNumberingContext;
108109
class MaterializeTemporaryExpr;
@@ -2360,6 +2361,12 @@ class ASTContext : public RefCountedBase<ASTContext> {
23602361
/// If \p T is null pointer, assume the target in ASTContext.
23612362
MangleContext *createMangleContext(const TargetInfo *T = nullptr);
23622363

2364+
/// Creates a device mangle context to correctly mangle lambdas in a mixed
2365+
/// architecture compile by setting the lambda mangling number source to the
2366+
/// DeviceLambdaManglingNumber. Currently this asserts that the TargetInfo
2367+
/// (from the AuxTargetInfo) is a an itanium target.
2368+
MangleContext *createDeviceMangleContext(const TargetInfo &T);
2369+
23632370
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass,
23642371
SmallVectorImpl<const ObjCIvarDecl*> &Ivars) const;
23652372

@@ -3163,10 +3170,31 @@ OPT_LIST(V)
31633170

31643171
StringRef getCUIDHash() const;
31653172

3173+
void AddSYCLKernelNamingDecl(const CXXRecordDecl *RD);
3174+
bool IsSYCLKernelNamingDecl(const NamedDecl *RD) const;
3175+
unsigned GetSYCLKernelNamingIndex(const NamedDecl *RD);
3176+
/// A SourceLocation to store whether we have evaluated a kernel name already,
3177+
/// and where it happened. If so, we need to diagnose an illegal use of the
3178+
/// builtin.
3179+
llvm::MapVector<const SYCLUniqueStableNameExpr *, std::string>
3180+
SYCLUniqueStableNameEvaluatedValues;
3181+
31663182
private:
31673183
/// All OMPTraitInfo objects live in this collection, one per
31683184
/// `pragma omp [begin] declare variant` directive.
31693185
SmallVector<std::unique_ptr<OMPTraitInfo>, 4> OMPTraitInfoVector;
3186+
3187+
/// A list of the (right now just lambda decls) declarations required to
3188+
/// name all the SYCL kernels in the translation unit, so that we can get the
3189+
/// correct kernel name, as well as implement
3190+
/// __builtin_sycl_unique_stable_name.
3191+
llvm::DenseMap<const DeclContext *,
3192+
llvm::SmallPtrSet<const CXXRecordDecl *, 4>>
3193+
SYCLKernelNamingTypes;
3194+
std::unique_ptr<ItaniumMangleContext> SYCLKernelFilterContext;
3195+
void FilterSYCLKernelNamingDecls(
3196+
const CXXRecordDecl *RD,
3197+
llvm::SmallVectorImpl<const CXXRecordDecl *> &Decls);
31703198
};
31713199

31723200
/// Insertion operator for diagnostics.

clang/include/clang/AST/ComputeDependence.h

+2
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 SYCLUniqueStableNameExpr;
8182
class PredefinedExpr;
8283
class CallExpr;
8384
class OffsetOfExpr;
@@ -165,6 +166,7 @@ ExprDependence computeDependence(TypeTraitExpr *E);
165166
ExprDependence computeDependence(ConceptSpecializationExpr *E,
166167
bool ValueDependent);
167168

169+
ExprDependence computeDependence(SYCLUniqueStableNameExpr *E);
168170
ExprDependence computeDependence(PredefinedExpr *E);
169171
ExprDependence computeDependence(CallExpr *E, llvm::ArrayRef<Expr *> PreArgs);
170172
ExprDependence computeDependence(OffsetOfExpr *E);

0 commit comments

Comments
 (0)