Skip to content

Commit a0eeeff

Browse files
author
Alexander Batashev
committed
Merge branch 'sycl' into global_constructors_wrapper
* sycl: [SYCL] Fix test failure due to size discrepancy in 32 and 64 bit environment (intel#2594) [BuildBot] Linux GPU driver uplift to 20.39.17972 (intel#2600) [SYCL][NFC] Remove cyclic dependency in headers (intel#2601) [SYCL][Doc] Fix Sphinx docs index (intel#2599) [SYCL][PI][L0] Add an assert to piEnqueueKernelLaunch() when the GlobalWorkOffset!=0 (intel#2593) [SYCL][Driver] Turn on -spirv-allow-extra-diexpressions option (intel#2578) [SYCL] Serialize queue related PI API in the Level-Zero plugin (intel#2588) Added missing math APIs for devicelib. (intel#2558) [SYCL][DOC] Fix path to FPGA device selector (intel#2563) [SYCL][CUDA] Add basic sub-group functionality (intel#2587) [SYCL] Add specialization constant feature design doc. (intel#2572) [SYCL] Expand release lit test to CPU and ACC (intel#2589) [SYCL] Add clang support for FPGA kernel attribute scheduler_target_fmax_mhz (intel#2511) [SYCL][ESIMD] Fixed compiler crash in LowerESIMDVecArg pass (intel#2556)
2 parents 4eb4398 + c81828e commit a0eeeff

Some content is hidden

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

50 files changed

+1236
-146
lines changed

buildbot/dependency.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ ocl_cpu_rt_ver=2020.11.8.0.27
44
# https://github.com/intel/llvm/releases/download/2020-WW36/win-oclcpuexp-2020.11.8.0.27_rel.zip
55
ocl_cpu_rt_ver_win=2020.11.8.0.27
66
# Same GPU driver supports Level Zero and OpenCL:
7-
# https://github.com/intel/compute-runtime/releases/tag/20.37.17906
8-
ocl_gpu_rt_ver=20.37.17906
7+
# https://github.com/intel/compute-runtime/releases/tag/20.39.17972
8+
ocl_gpu_rt_ver=20.39.17972
99
# Same GPU driver supports Level Zero and OpenCL:
1010
# https://downloadmirror.intel.com/29879/a08/igfx_win10_100.8778.zip
1111
ocl_gpu_rt_ver_win=27.20.100.8778
@@ -24,7 +24,7 @@ fpga_ver_win=20200811_000006
2424
[DRIVER VERSIONS]
2525
cpu_driver_lin=2020.11.8.0.27
2626
cpu_driver_win=2020.11.8.0.27
27-
gpu_driver_lin=20.37.17906
27+
gpu_driver_lin=20.39.17972
2828
gpu_driver_win=27.20.100.8778
2929
fpga_driver_lin=2020.11.8.0.27
3030
fpga_driver_win=2020.11.8.0.27

clang/include/clang/Basic/Attr.td

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,24 @@ def SYCLIntelNumSimdWorkItems : InheritableAttr {
12251225
let PragmaAttributeSupport = 0;
12261226
}
12271227

1228+
def SYCLIntelSchedulerTargetFmaxMhz : InheritableAttr {
1229+
let Spellings = [CXX11<"intelfpga","scheduler_target_fmax_mhz">];
1230+
let Args = [ExprArgument<"Value">];
1231+
let LangOpts = [SYCLIsDevice, SYCLIsHost];
1232+
let Subjects = SubjectList<[Function], ErrorDiag>;
1233+
let Documentation = [SYCLIntelSchedulerTargetFmaxMhzAttrDocs];
1234+
let PragmaAttributeSupport = 0;
1235+
let AdditionalMembers = [{
1236+
static unsigned getMinValue() {
1237+
return 0;
1238+
}
1239+
static unsigned getMaxValue() {
1240+
return 1048576;
1241+
}
1242+
}];
1243+
1244+
}
1245+
12281246
def SYCLIntelMaxWorkGroupSize : InheritableAttr {
12291247
let Spellings = [CXX11<"intelfpga","max_work_group_size">];
12301248
let Args = [UnsignedArgument<"XDim">,

clang/include/clang/Basic/AttrDocs.td

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,6 +2223,28 @@ device kernel, the attribute is ignored and it is not propagated to a kernel.
22232223
}];
22242224
}
22252225

2226+
def SYCLIntelSchedulerTargetFmaxMhzAttrDocs : Documentation {
2227+
let Category = DocCatFunction;
2228+
let Heading = "scheduler_target_fmax_mhz (IntelFPGA)";
2229+
let Content = [{
2230+
Applies to a device function/lambda function. Indicates that the kernel should
2231+
be pipelined so as to achieve the specified target clock frequency (Fmax) of N
2232+
MHz. The argument N may be a template parameter. This attribute should be
2233+
ignored for the FPGA emulator device.
2234+
2235+
``[[intelfpga::scheduler_target_fmax_mhz(N)]]``
2236+
Valid values of N are integers in the range [0, 1048576]. The upper limit,
2237+
although too high to be a realistic value for frequency, is chosen to be future
2238+
proof. The FPGA backend emits a diagnostic message if the passed value is
2239+
unachievable by the device.
2240+
2241+
This attribute enables communication of the desired maximum frequency of the
2242+
device operation, guiding the FPGA backend to insert the appropriate number of
2243+
registers to break-up the combinational logic circuit, and thereby controlling
2244+
the length of the longest combinational path.
2245+
}];
2246+
}
2247+
22262248
def SYCLIntelNoGlobalWorkOffsetAttrDocs : Documentation {
22272249
let Category = DocCatFunction;
22282250
let Heading = "no_global_work_offset (IntelFPGA)";

clang/include/clang/Basic/AttributeCommonInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ class AttributeCommonInfo {
162162
(ParsedAttr == AT_ReqdWorkGroupSize && isCXX11Attribute()) ||
163163
(ParsedAttr == AT_IntelReqdSubGroupSize && isCXX11Attribute()) ||
164164
ParsedAttr == AT_SYCLIntelNumSimdWorkItems ||
165+
ParsedAttr == AT_SYCLIntelSchedulerTargetFmaxMhz ||
165166
ParsedAttr == AT_SYCLIntelMaxWorkGroupSize ||
166167
ParsedAttr == AT_SYCLIntelMaxGlobalWorkDim ||
167168
ParsedAttr == AT_SYCLIntelNoGlobalWorkOffset)

clang/include/clang/Sema/Sema.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10060,6 +10060,11 @@ class Sema final {
1006010060
bool checkAllowedSYCLInitializer(VarDecl *VD,
1006110061
bool CheckValueDependent = false);
1006210062

10063+
// Adds a scheduler_target_fmax_mhz attribute to a particular declaration.
10064+
void addSYCLIntelSchedulerTargetFmaxMhzAttr(Decl *D,
10065+
const AttributeCommonInfo &CI,
10066+
Expr *E);
10067+
1006310068
//===--------------------------------------------------------------------===//
1006410069
// C++ Coroutines TS
1006510070
//

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,17 @@ void CodeGenFunction::EmitOpenCLKernelMetadata(const FunctionDecl *FD,
641641
llvm::MDNode::get(Context, AttrMDArgs));
642642
}
643643

644+
if (const SYCLIntelSchedulerTargetFmaxMhzAttr *A =
645+
FD->getAttr<SYCLIntelSchedulerTargetFmaxMhzAttr>()) {
646+
Optional<llvm::APSInt> ArgVal =
647+
A->getValue()->getIntegerConstantExpr(FD->getASTContext());
648+
assert(ArgVal.hasValue() && "Not an integer constant expression");
649+
llvm::Metadata *AttrMDArgs[] = {llvm::ConstantAsMetadata::get(
650+
Builder.getInt32(ArgVal->getSExtValue()))};
651+
Fn->setMetadata("scheduler_target_fmax_mhz",
652+
llvm::MDNode::get(Context, AttrMDArgs));
653+
}
654+
644655
if (const SYCLIntelMaxWorkGroupSizeAttr *A =
645656
FD->getAttr<SYCLIntelMaxWorkGroupSizeAttr>()) {
646657
llvm::Metadata *AttrMDArgs[] = {

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7826,6 +7826,9 @@ void SPIRVTranslator::ConstructJob(Compilation &C, const JobAction &JA,
78267826
if (getToolChain().getTriple().isSYCLDeviceEnvironment()) {
78277827
TranslatorArgs.push_back("-spirv-max-version=1.1");
78287828
TranslatorArgs.push_back("-spirv-debug-info-version=legacy");
7829+
// Prevent crash in the translator if input IR contains DIExpression
7830+
// operations which don't have mapping to OpenCL.DebugInfo.100 spec.
7831+
TranslatorArgs.push_back("-spirv-allow-extra-diexpressions");
78297832
if (C.getArgs().hasArg(options::OPT_fsycl_esimd))
78307833
TranslatorArgs.push_back("-spirv-allow-unknown-intrinsics");
78317834

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const char *SYCL::Linker::constructLLVMSpirvCommand(Compilation &C,
4343
CmdArgs.push_back("-spirv-max-version=1.1");
4444
CmdArgs.push_back("-spirv-ext=+all");
4545
CmdArgs.push_back("-spirv-debug-info-version=legacy");
46+
CmdArgs.push_back("-spirv-allow-extra-diexpressions");
4647
if (C.getArgs().hasArg(options::OPT_fsycl_esimd))
4748
CmdArgs.push_back("-spirv-allow-unknown-intrinsics");
4849
CmdArgs.push_back("-o");

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3006,6 +3006,38 @@ static void handleNumSimdWorkItemsAttr(Sema &S, Decl *D,
30063006
E);
30073007
}
30083008

3009+
// Add scheduler_target_fmax_mhz
3010+
void Sema::addSYCLIntelSchedulerTargetFmaxMhzAttr(
3011+
Decl *D, const AttributeCommonInfo &Attr, Expr *E) {
3012+
assert(E && "Attribute must have an argument.");
3013+
3014+
SYCLIntelSchedulerTargetFmaxMhzAttr TmpAttr(Context, Attr, E);
3015+
if (!E->isValueDependent()) {
3016+
ExprResult ResultExpr;
3017+
if (checkRangedIntegralArgument<SYCLIntelSchedulerTargetFmaxMhzAttr>(
3018+
E, &TmpAttr, ResultExpr))
3019+
return;
3020+
E = ResultExpr.get();
3021+
}
3022+
3023+
D->addAttr(::new (Context)
3024+
SYCLIntelSchedulerTargetFmaxMhzAttr(Context, Attr, E));
3025+
}
3026+
3027+
// Handle scheduler_target_fmax_mhz
3028+
static void handleSchedulerTargetFmaxMhzAttr(Sema &S, Decl *D,
3029+
const ParsedAttr &AL) {
3030+
if (D->isInvalidDecl())
3031+
return;
3032+
3033+
Expr *E = AL.getArgAsExpr(0);
3034+
3035+
if (D->getAttr<SYCLIntelSchedulerTargetFmaxMhzAttr>())
3036+
S.Diag(AL.getLoc(), diag::warn_duplicate_attribute) << AL;
3037+
3038+
S.addSYCLIntelSchedulerTargetFmaxMhzAttr(D, AL, E);
3039+
}
3040+
30093041
// Handles max_global_work_dim.
30103042
static void handleMaxGlobalWorkDimAttr(Sema &S, Decl *D,
30113043
const ParsedAttr &Attr) {
@@ -8225,6 +8257,9 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
82258257
case ParsedAttr::AT_SYCLIntelNumSimdWorkItems:
82268258
handleNumSimdWorkItemsAttr(S, D, AL);
82278259
break;
8260+
case ParsedAttr::AT_SYCLIntelSchedulerTargetFmaxMhz:
8261+
handleSchedulerTargetFmaxMhzAttr(S, D, AL);
8262+
break;
82288263
case ParsedAttr::AT_SYCLIntelMaxGlobalWorkDim:
82298264
handleMaxGlobalWorkDimAttr(S, D, AL);
82308265
break;

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,9 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
531531
if (auto *A = FD->getAttr<SYCLIntelNumSimdWorkItemsAttr>())
532532
Attrs.insert(A);
533533

534+
if (auto *A = FD->getAttr<SYCLIntelSchedulerTargetFmaxMhzAttr>())
535+
Attrs.insert(A);
536+
534537
if (auto *A = FD->getAttr<SYCLIntelMaxWorkGroupSizeAttr>())
535538
Attrs.insert(A);
536539

@@ -3166,6 +3169,7 @@ void Sema::MarkDevice(void) {
31663169
}
31673170
case attr::Kind::SYCLIntelKernelArgsRestrict:
31683171
case attr::Kind::SYCLIntelNumSimdWorkItems:
3172+
case attr::Kind::SYCLIntelSchedulerTargetFmaxMhz:
31693173
case attr::Kind::SYCLIntelMaxGlobalWorkDim:
31703174
case attr::Kind::SYCLIntelNoGlobalWorkOffset:
31713175
case attr::Kind::SYCLSimd: {

0 commit comments

Comments
 (0)