Skip to content

Commit 7d2f600

Browse files
committed
Resolving merge conflicts
Signed-off-by: Gail Lyons <[email protected]>
2 parents bc2b9ef + da6d1dc commit 7d2f600

Some content is hidden

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

48 files changed

+819
-97
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,9 @@ def LoopUnrollHint : InheritableAttr {
12881288
}
12891289

12901290
def IntelReqdSubGroupSize: InheritableAttr {
1291-
let Spellings = [GNU<"intel_reqd_sub_group_size">, CXX11<"cl", "intel_reqd_sub_group_size">];
1291+
let Spellings = [GNU<"intel_reqd_sub_group_size">,
1292+
CXX11<"cl", "intel_reqd_sub_group_size">,
1293+
CXX11<"intel", "reqd_sub_group_size">];
12921294
let Args = [ExprArgument<"SubGroupSize">];
12931295
let Subjects = SubjectList<[Function, CXXMethod], ErrorDiag>;
12941296
let Documentation = [IntelReqdSubGroupSizeDocs];

clang/include/clang/Basic/AttrDocs.td

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3472,9 +3472,10 @@ code. See `cl_intel_required_subgroup_size
34723472
for details.
34733473

34743474
SYCL documentation:
3475-
The [[cl::intel_reqd_sub_group_size(n)]] attribute indicates that the kernel
3476-
must be compiled and executed with a sub-group of size n. The value of n must be
3477-
set to a sub-group size supported by the device, or device compilation will fail.
3475+
The [[cl::intel_reqd_sub_group_size(n)]] and [[intel::reqd_sub_group_size(n)]]
3476+
attribute indicates that the kernel must be compiled and executed with a
3477+
sub-group of size n. The value of n must be set to a sub-group size supported
3478+
by the device, or device compilation will fail.
34783479

34793480
In addition to device functions, the required sub-group size attribute may also
34803481
be specified in the definition of a named functor object and lambda functions,
@@ -3495,6 +3496,19 @@ as in the examples below:
34953496
/* kernel code */
34963497
});
34973498

3499+
class Functor
3500+
{
3501+
[[intel::reqd_sub_group_size(16)]] void operator()(item<1> item)
3502+
{
3503+
/* kernel code */
3504+
}
3505+
}
3506+
3507+
kernel<class kernel_name>(
3508+
[]() [[intel::reqd_sub_group_size(n)]] {
3509+
/* kernel code */
3510+
});
3511+
34983512
See Sub-groups for NDRange Parallelism proposal in sycl/doc/extensions/sub_group_ndrange/sub_group_ndrange.md
34993513
}];
35003514
}

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10979,6 +10979,9 @@ def warn_sycl_implicit_decl
1097910979
"declaration for a kernel type name; your program may not "
1098010980
"be portable">,
1098110981
InGroup<SyclStrict>, DefaultIgnore;
10982+
def warn_sycl_restrict_recursion
10983+
: Warning<"SYCL kernel cannot call a recursive function">,
10984+
InGroup<SyclStrict>, DefaultError;
1098210985
def err_ivdep_duplicate_arg : Error<
1098310986
"duplicate argument to 'ivdep'. attribute requires one or both of a safelen "
1098410987
"and array">;
@@ -10990,6 +10993,11 @@ def err_ivdep_declrefexpr_arg : Error<
1099010993
def warn_ivdep_redundant : Warning <"ignoring redundant Intel FPGA loop "
1099110994
"attribute 'ivdep': safelen %select{INF|%1}0 >= safelen %select{INF|%3}2">,
1099210995
InGroup<IgnoredAttributes>;
10996+
def warn_attribute_spelling_deprecated : Warning<
10997+
"attribute %0 is deprecated">,
10998+
InGroup<DeprecatedAttributes>;
10999+
def note_spelling_suggestion : Note<
11000+
"did you mean to use %0 instead?">;
1099311001

1099411002
// errors of expect.with.probability
1099511003
def err_probability_not_constant_float : Error<

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "llvm/CodeGen/RegAllocRegistry.h"
2828
#include "llvm/CodeGen/SchedulerRegistry.h"
2929
#include "llvm/CodeGen/TargetSubtargetInfo.h"
30+
#include "llvm/GenXIntrinsics/GenXSPIRVWriterAdaptor.h"
3031
#include "llvm/IR/DataLayout.h"
3132
#include "llvm/IR/IRPrintingPasses.h"
3233
#include "llvm/IR/LegacyPassManager.h"
@@ -890,6 +891,9 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
890891
if (LangOpts.SYCLIsDevice && CodeGenOpts.DisableLLVMPasses)
891892
PerModulePasses.add(createDeadCodeEliminationPass());
892893

894+
if (LangOpts.SYCLIsDevice && LangOpts.SYCLExplicitSIMD)
895+
PerModulePasses.add(createGenXSPIRVWriterAdaptorPass());
896+
893897
switch (Action) {
894898
case Backend_EmitNothing:
895899
break;

clang/lib/CodeGen/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ if (MSVC)
3131
set_source_files_properties(CodeGenModule.cpp PROPERTIES COMPILE_FLAGS /bigobj)
3232
endif()
3333

34+
get_property(LLVMGenXIntrinsics_SOURCE_DIR GLOBAL PROPERTY LLVMGenXIntrinsics_SOURCE_PROP)
35+
get_property(LLVMGenXIntrinsics_BINARY_DIR GLOBAL PROPERTY LLVMGenXIntrinsics_BINARY_PROP)
36+
37+
include_directories(
38+
${LLVMGenXIntrinsics_SOURCE_DIR}/GenXIntrinsics/include
39+
${LLVMGenXIntrinsics_BINARY_DIR}/GenXIntrinsics/include)
40+
3441
add_clang_library(clangCodeGen
3542
BackendUtil.cpp
3643
CGAtomic.cpp
@@ -91,8 +98,14 @@ add_clang_library(clangCodeGen
9198
TargetInfo.cpp
9299
VarBypassDetector.cpp
93100

101+
ADDITIONAL_HEADER_DIRS
102+
${LLVMGenXIntrinsics_SOURCE_DIR}/GenXIntrinsics/include
103+
${LLVMGenXIntrinsics_BINARY_DIR}/GenXIntrinsics/include
104+
94105
DEPENDS
106+
${codegen_deps}
95107
intrinsics_gen
108+
LLVMGenXIntrinsics
96109

97110
LINK_LIBS
98111
clangAnalysis
@@ -102,4 +115,5 @@ add_clang_library(clangCodeGen
102115
clangFrontend
103116
clangLex
104117
clangSerialization
118+
LLVMGenXIntrinsics
105119
)

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,12 +641,12 @@ void CodeGenModule::Release() {
641641
SPIRVerMD->addOperand(llvm::MDNode::get(Ctx, SPIRVerElts));
642642
// We are trying to look like OpenCL C++ for SPIR-V translator.
643643
// 4 - OpenCL_CPP, 100000 - OpenCL C++ version 1.0
644-
// 6 - ESIMD, if any kernel or function is an explicit SIMD one
644+
// 0 - ESIMD, if any kernel or function is an explicit SIMD one
645645
int Lang = llvm::any_of(TheModule,
646646
[](const auto &F) {
647647
return F.getMetadata("sycl_explicit_simd");
648648
})
649-
? 6
649+
? 0
650650
: 4;
651651

652652
llvm::Metadata *SPIRVSourceElts[] = {

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7658,6 +7658,8 @@ void SPIRVTranslator::ConstructJob(Compilation &C, const JobAction &JA,
76587658
if (getToolChain().getTriple().isSYCLDeviceEnvironment()) {
76597659
TranslatorArgs.push_back("-spirv-max-version=1.1");
76607660
std::string ExtArg("-spirv-ext=+all");
7661+
if (C.getArgs().hasArg(options::OPT_fsycl_esimd))
7662+
TranslatorArgs.push_back("-spirv-allow-unknown-intrinsics");
76617663
// Disable SPV_INTEL_usm_storage_classes by default since it adds new
76627664
// storage classes that represent global_device and global_host address
76637665
// spaces, which are not supported for all targets. With the extension

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ const char *SYCL::Linker::constructLLVMSpirvCommand(Compilation &C,
4242
} else {
4343
CmdArgs.push_back("-spirv-max-version=1.1");
4444
CmdArgs.push_back("-spirv-ext=+all");
45+
if (C.getArgs().hasArg(options::OPT_fsycl_esimd))
46+
CmdArgs.push_back("-spirv-allow-unknown-intrinsics");
4547
CmdArgs.push_back("-o");
4648
CmdArgs.push_back(Output.getFilename());
4749
}

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,6 +3014,13 @@ static void handleSubGroupSize(Sema &S, Decl *D, const ParsedAttr &AL) {
30143014
if (D->getAttr<IntelReqdSubGroupSizeAttr>())
30153015
S.Diag(AL.getLoc(), diag::warn_duplicate_attribute) << AL;
30163016

3017+
if (AL.getAttributeSpellingListIndex() ==
3018+
IntelReqdSubGroupSizeAttr::CXX11_cl_intel_reqd_sub_group_size) {
3019+
S.Diag(AL.getLoc(), diag::warn_attribute_spelling_deprecated) << AL;
3020+
S.Diag(AL.getLoc(), diag::note_spelling_suggestion)
3021+
<< "'intel::reqd_sub_group_size'";
3022+
}
3023+
30173024
S.addIntelReqdSubGroupSizeAttr(D, AL, E);
30183025
}
30193026

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,7 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
354354
// all functions used by kernel have already been parsed and have
355355
// definitions.
356356
if (RecursiveSet.count(Callee) && !ConstexprDepth) {
357-
SemaRef.Diag(e->getExprLoc(), diag::err_sycl_restrict)
358-
<< Sema::KernelCallRecursiveFunction;
357+
SemaRef.Diag(e->getExprLoc(), diag::warn_sycl_restrict_recursion);
359358
SemaRef.Diag(Callee->getSourceRange().getBegin(),
360359
diag::note_sycl_recursive_function_declared_here)
361360
<< Sema::KernelCallRecursiveFunction;

0 commit comments

Comments
 (0)