Skip to content

Commit 4b0d136

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web'
2 parents 879aff1 + 6117a1b commit 4b0d136

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

+1510
-177
lines changed

README.md

+16-23
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,30 @@
11
# Intel Project for LLVM\* technology
22

3-
## Introduction
3+
Intel staging area for llvm.org contribution. Home for Intel LLVM-based projects:
44

5-
Intel staging area for llvm.org contribution.
6-
Home for Intel LLVM-based projects:
5+
## oneAPI Data Parallel C++ compiler
76

8-
* oneAPI Data Parallel C++ compiler - see
9-
[sycl](https://github.com/intel/llvm/tree/sycl) branch. More information on
10-
oneAPI and DPC++ is available at
11-
[https://www.oneapi.com/](https://www.oneapi.com/)
12-
* [![Linux Post Commit Checks](https://github.com/intel/llvm/workflows/Linux%20Post%20Commit%20Checks/badge.svg)](https://github.com/intel/llvm/actions?query=workflow%3A%22Linux+Post+Commit+Checks%22)
13-
[![Generate Doxygen documentation](https://github.com/intel/llvm/workflows/Generate%20Doxygen%20documentation/badge.svg)](https://github.com/intel/llvm/actions?query=workflow%3A%22Generate+Doxygen+documentation%22)
14-
* Late-outline OpenMP\* and OpenMP\* Offload - see
15-
[openmp](https://github.com/intel/llvm/tree/openmp) branch.
7+
[![](https://spec.oneapi.io/oneapi-logo-white-scaled.jpg)](https://www.oneapi.io/)
168

17-
## License
9+
See [sycl](https://github.com/intel/llvm/tree/sycl) branch and
10+
[DPC++ Documentation](https://intel.github.io/llvm-docs/).
1811

19-
See [LICENSE.txt](sycl/LICENSE.TXT) for details.
12+
[![Linux Post Commit Checks](https://github.com/intel/llvm/workflows/Linux%20Post%20Commit%20Checks/badge.svg)](https://github.com/intel/llvm/actions?query=workflow%3A%22Linux+Post+Commit+Checks%22)
13+
[![Generate Doxygen documentation](https://github.com/intel/llvm/workflows/Generate%20Doxygen%20documentation/badge.svg)](https://github.com/intel/llvm/actions?query=workflow%3A%22Generate+Doxygen+documentation%22)
2014

21-
## Contributing
15+
DPC++ is an open, cross-architecture language built upon the ISO C++ and Khronos
16+
SYCL\* standards. DPC++ extends these standards with a number of extensions,
17+
which can be found in [sycl/doc/extensions](sycl/doc/extensions) directory.
2218

23-
See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
19+
## Late-outline OpenMP\* and OpenMP\* Offload
20+
See [openmp](https://github.com/intel/llvm/tree/openmp) branch.
2421

25-
## Sub-projects Documentation
22+
# License
2623

27-
* oneAPI Data Parallel C++ compiler - See
28-
[DPC++ Documentation](https://intel.github.io/llvm-docs/)
29-
* Late-outline OpenMP\* and OpenMP\* Offload - TBD
24+
See [LICENSE.txt](sycl/LICENSE.TXT) for details.
3025

31-
## DPC++ extensions
26+
# Contributing
3227

33-
DPC++ is an open, cross-architecture language built upon the ISO C++ and Khronos
34-
SYCL\* standards. DPC++ extends these standards with a number of extensions,
35-
which can be found in [sycl/doc/extensions](sycl/doc/extensions) directory.
28+
See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
3629

3730
*\*Other names and brands may be claimed as the property of others.*

buildbot/configure.py

+3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ def do_configure(args):
6161
if args.rocm_platform == 'AMD':
6262
llvm_targets_to_build += ';AMDGPU'
6363
libclc_targets_to_build += ';amdgcn--;amdgcn--amdhsa'
64+
65+
# The ROCm plugin for AMD uses lld for linking
66+
llvm_enable_projects += ';lld'
6467
elif args.rocm_platform == 'NVIDIA' and not args.cuda:
6568
llvm_targets_to_build += ';NVPTX'
6669
libclc_targets_to_build += ';nvptx64--;nvptx64--nvidiacl'

buildbot/dependency.conf

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ ocl_cpu_rt_ver_win=2021.12.6.0.19
77
# https://github.com/intel/compute-runtime/releases/tag/21.33.20678
88
ocl_gpu_rt_ver=21.33.20678
99
# Same GPU driver supports Level Zero and OpenCL
10-
# https://downloadmirror.intel.com/30579/a08/igfx_win_100.9684.zip
11-
# https://downloadmirror.intel.com/30381/a08/igfx_win10_100.9466.zip
12-
ocl_gpu_rt_ver_win=30.0.100.9684
10+
# https://downloadmirror.intel.com/646152/igfx_win_100.9805.zip
11+
ocl_gpu_rt_ver_win=30.0.100.9805
1312
intel_sycl_ver=build
1413

1514
# TBB binaries can be built from sources following instructions under
@@ -32,7 +31,7 @@ ocloc_ver_win=27.20.100.9168
3231
cpu_driver_lin=2021.12.6.0.19
3332
cpu_driver_win=2021.12.6.0.19
3433
gpu_driver_lin=21.33.20678
35-
gpu_driver_win=30.0.100.9684
34+
gpu_driver_win=30.0.100.9805
3635
fpga_driver_lin=2021.12.6.0.19
3736
fpga_driver_win=2021.12.6.0.19
3837
# NVidia CUDA driver

clang/lib/Driver/Driver.cpp

+45-13
Original file line numberDiff line numberDiff line change
@@ -2932,6 +2932,18 @@ bool Driver::checkForSYCLDefaultDevice(Compilation &C,
29322932
if (Args.hasArg(options::OPT_fno_sycl_link_spirv))
29332933
return false;
29342934

2935+
// Do not do the check if the default device is passed in -fsycl-targets
2936+
// or if -fsycl-targets isn't passed (that implies default device)
2937+
if (const Arg *A = Args.getLastArg(options::OPT_fsycl_targets_EQ)) {
2938+
for (const char *Val : A->getValues()) {
2939+
llvm::Triple TT(C.getDriver().MakeSYCLDeviceTriple(Val));
2940+
if (TT.isSPIR() && TT.getSubArch() == llvm::Triple::NoSubArch)
2941+
// Default triple found
2942+
return false;
2943+
}
2944+
} else if (!Args.hasArg(options::OPT_fintelfpga))
2945+
return false;
2946+
29352947
SmallVector<const char *, 16> AllArgs(getLinkerArgs(C, Args, true));
29362948
for (StringRef Arg : AllArgs) {
29372949
if (hasSYCLDefaultSection(C, Arg))
@@ -4388,12 +4400,15 @@ class OffloadingActionBuilder final {
43884400
TT.getSubArch() == llvm::Triple::SPIRSubArch_gen ||
43894401
TT.getSubArch() == llvm::Triple::SPIRSubArch_x86_64;
43904402
for (const auto &Input : LI) {
4391-
// FPGA aoco does not go through the link, everything else does.
4392-
if (Input->getType() == types::TY_FPGA_AOCO)
4393-
DeviceLibObjects.push_back(Input);
4394-
// FPGA aocr/aocx does not go through the link and is passed
4395-
// directly to the backend compilation step (aocr) or wrapper (aocx)
4396-
else if (types::isFPGA(Input->getType())) {
4403+
if (TT.getSubArch() == llvm::Triple::SPIRSubArch_fpga &&
4404+
types::isFPGA(Input->getType())) {
4405+
// FPGA aoco does not go through the link, everything else does.
4406+
if (Input->getType() == types::TY_FPGA_AOCO) {
4407+
DeviceLibObjects.push_back(Input);
4408+
continue;
4409+
}
4410+
// FPGA aocr/aocx does not go through the link and is passed
4411+
// directly to the backend compilation step (aocr) or wrapper (aocx)
43974412
Action *FPGAAOTAction;
43984413
if (Input->getType() == types::TY_FPGA_AOCR ||
43994414
Input->getType() == types::TY_FPGA_AOCR_EMU)
@@ -4413,7 +4428,8 @@ class OffloadingActionBuilder final {
44134428
RenameAction, types::TY_Object);
44144429
DA.add(*DeviceWrappingAction, **TC, /*BoundArch=*/nullptr,
44154430
Action::OFK_SYCL);
4416-
} else
4431+
continue;
4432+
} else if (!types::isFPGA(Input->getType()))
44174433
LinkObjects.push_back(Input);
44184434
}
44194435
if (LinkObjects.empty())
@@ -5488,6 +5504,16 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
54885504
break;
54895505
}
54905506

5507+
// When performing -fsycl based compilations and generating dependency
5508+
// information, perform a specific dependency generation compilation which
5509+
// is not based on the source + footer compilation.
5510+
if (Phase == phases::Preprocess && Args.hasArg(options::OPT_fsycl) &&
5511+
Args.hasArg(options::OPT_M_Group) &&
5512+
!Args.hasArg(options::OPT_fno_sycl_use_footer)) {
5513+
Actions.push_back(
5514+
C.MakeAction<PreprocessJobAction>(Current, types::TY_Dependencies));
5515+
}
5516+
54915517
// FIXME: Should we include any prior module file outputs as inputs of
54925518
// later actions in the same command line?
54935519

@@ -5852,6 +5878,9 @@ void Driver::BuildJobs(Compilation &C) const {
58525878
// we are also generating .o files. So we allow more than one output file in
58535879
// this case as well.
58545880
//
5881+
// Preprocessing job performed for -fsycl enabled compilation specifically
5882+
// for dependency generation (TY_Dependencies)
5883+
//
58555884
if (FinalOutput) {
58565885
unsigned NumOutputs = 0;
58575886
unsigned NumIfsOutputs = 0;
@@ -5862,7 +5891,10 @@ void Driver::BuildJobs(Compilation &C) const {
58625891
A->getKind() == clang::driver::Action::CompileJobClass &&
58635892
0 == NumIfsOutputs++) ||
58645893
(A->getKind() == Action::BindArchClass && A->getInputs().size() &&
5865-
A->getInputs().front()->getKind() == Action::IfsMergeJobClass)))
5894+
A->getInputs().front()->getKind() == Action::IfsMergeJobClass) ||
5895+
(A->getKind() == Action::PreprocessJobClass &&
5896+
A->getType() == types::TY_Dependencies &&
5897+
C.getArgs().hasArg(options::OPT_fsycl))))
58665898
++NumOutputs;
58675899

58685900
if (NumOutputs > 1) {
@@ -6649,7 +6681,9 @@ InputInfo Driver::BuildJobsForActionNoCache(
66496681
} else if (types::isFPGA(JA->getType())) {
66506682
std::string Ext(types::getTypeTempSuffix(JA->getType()));
66516683
types::ID TI = types::TY_Object;
6652-
if (EffectiveTriple.getSubArch() == llvm::Triple::SPIRSubArch_fpga) {
6684+
if (EffectiveTriple.isSPIR()) {
6685+
if (!UI.DependentToolChain->getTriple().isSPIR())
6686+
continue;
66536687
// Output file from unbundle is FPGA device. Name the file
66546688
// accordingly.
66556689
if (UI.DependentOffloadKind == Action::OFK_Host) {
@@ -6665,13 +6699,11 @@ InputInfo Driver::BuildJobsForActionNoCache(
66656699
JA->getType() == types::TY_FPGA_AOCR_EMU)
66666700
// AOCR files are always unbundled into a list file.
66676701
TI = types::TY_Tempfilelist;
6668-
} else if (EffectiveTriple.getSubArch() !=
6669-
llvm::Triple::SPIRSubArch_fpga) {
6670-
if (UI.DependentOffloadKind == Action::OFK_SYCL) {
6702+
} else {
6703+
if (UI.DependentOffloadKind == Action::OFK_SYCL)
66716704
// Do not add the current info for device with FPGA device. The
66726705
// device side isn't used
66736706
continue;
6674-
}
66756707
TI = types::TY_Tempfilelist;
66766708
Ext = "txt";
66776709
}

clang/lib/Driver/ToolChains/Clang.cpp

+33-26
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,12 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
12031203
C.getDriver().addFPGATempDepFile(DepFile, BaseName);
12041204
};
12051205

1206+
// Do not add dependency generation information when compiling the source +
1207+
// footer combination. The dependency generation is done in a separate
1208+
// compile step so we can retain original source information.
1209+
if (ContainsAppendFooterAction(&JA))
1210+
ArgM = nullptr;
1211+
12061212
if (ArgM) {
12071213
// Determine the output location.
12081214
const char *DepFile;
@@ -1216,6 +1222,12 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
12161222
DepFile, Clang::getBaseInputName(Args, Inputs[0]));
12171223
} else if (Output.getType() == types::TY_Dependencies) {
12181224
DepFile = Output.getFilename();
1225+
if (!ContainsAppendFooterAction(&JA) && Args.hasArg(options::OPT_fsycl) &&
1226+
!Args.hasArg(options::OPT_fno_sycl_use_footer) &&
1227+
!JA.isDeviceOffloading(Action::OFK_SYCL))
1228+
// Name the dependency file for the specific dependency generation
1229+
// step created for the integration footer enabled compilation.
1230+
DepFile = getDependencyFileName(Args, Inputs);
12191231
} else if (!ArgMD) {
12201232
DepFile = "-";
12211233
} else if (IsIntelFPGA && JA.isDeviceOffloading(Action::OFK_SYCL)) {
@@ -8303,10 +8315,8 @@ void OffloadBundler::ConstructJobMultipleOutputs(
83038315
// types (aocx/aocr) are always list files. We should represent this
83048316
// better in the output extension and type for improved understanding
83058317
// of file contents and debuggability.
8306-
if (getToolChain().getTriple().getSubArch() ==
8307-
llvm::Triple::SPIRSubArch_fpga)
8308-
TypeArg = (InputType == types::TY_FPGA_AOCX) ? "aocx" : "aocr";
8309-
else
8318+
TypeArg = (InputType == types::TY_FPGA_AOCX) ? "aocx" : "aocr";
8319+
if (!getToolChain().getTriple().isSPIR())
83108320
TypeArg = "aoo";
83118321
}
83128322
if (InputType == types::TY_FPGA_AOCO || IsFPGADepLibUnbundle)
@@ -8327,28 +8337,25 @@ void OffloadBundler::ConstructJobMultipleOutputs(
83278337
// aocx or aocr type bundles. Also, we only do a specific target
83288338
// unbundling, skipping the host side or device side.
83298339
if (types::isFPGA(InputType)) {
8330-
if (getToolChain().getTriple().getSubArch() ==
8331-
llvm::Triple::SPIRSubArch_fpga &&
8332-
Dep.DependentOffloadKind == Action::OFK_SYCL) {
8333-
if (J++)
8334-
Triples += ',';
8335-
llvm::Triple TT;
8336-
TT.setArchName(types::getTypeName(InputType));
8337-
TT.setVendorName("intel");
8338-
TT.setOS(getToolChain().getTriple().getOS());
8339-
TT.setEnvironment(llvm::Triple::SYCLDevice);
8340-
Triples += "sycl-";
8341-
Triples += TT.normalize();
8342-
} else if (getToolChain().getTriple().getSubArch() !=
8343-
llvm::Triple::SPIRSubArch_fpga &&
8344-
Dep.DependentOffloadKind == Action::OFK_Host) {
8345-
if (J++)
8346-
Triples += ',';
8347-
Triples += Action::GetOffloadKindName(Dep.DependentOffloadKind);
8348-
Triples += '-';
8349-
Triples += Dep.DependentToolChain->getTriple().normalize();
8350-
}
8351-
continue;
8340+
if (getToolChain().getTriple().isSPIR()) {
8341+
if (Dep.DependentToolChain->getTriple().getSubArch() ==
8342+
llvm::Triple::SPIRSubArch_fpga) {
8343+
if (J++)
8344+
Triples += ',';
8345+
llvm::Triple TT;
8346+
TT.setArchName(types::getTypeName(InputType));
8347+
TT.setVendorName("intel");
8348+
TT.setOS(getToolChain().getTriple().getOS());
8349+
TT.setEnvironment(llvm::Triple::SYCLDevice);
8350+
Triples += "sycl-";
8351+
Triples += TT.normalize();
8352+
continue;
8353+
} else if (Dep.DependentOffloadKind == Action::OFK_Host) {
8354+
// No host unbundle for FPGA binaries.
8355+
continue;
8356+
}
8357+
} else if (Dep.DependentOffloadKind == Action::OFK_SYCL)
8358+
continue;
83528359
} else if (InputType == types::TY_Archive ||
83538360
(getToolChain().getTriple().getSubArch() ==
83548361
llvm::Triple::SPIRSubArch_fpga &&

clang/test/Driver/sycl-int-footer.cpp

+32
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,35 @@
6767
// FOOTER_PATH: append-file{{.*}} "--append=dummy_dir{{(/|\\\\)}}{{.*}}-footer-{{.*}}.h"
6868
// FOOTER_PATH-SAME: "--output=dummy_dir{{(/|\\\\)}}[[APPENDEDSRC:.+\.cpp]]"
6969
// FOOTER_PATH: clang{{.*}} "-x" "c++" "dummy_dir{{(/|\\\\)}}[[APPENDEDSRC]]"
70+
71+
/// Check behaviors for dependency generation
72+
// RUN: %clangxx -fsycl -MD -c %s -### 2>&1 \
73+
// RUN: | FileCheck -check-prefix DEP_GEN %s
74+
// DEP_GEN: clang{{.*}} "-Eonly"
75+
// DEP_GEN-SAME: "-dependency-file"
76+
// DEP_GEN-SAME: "-MT"
77+
// DEP_GEN-SAME: "-x" "c++" "[[INPUTFILE:.+\.cpp]]"
78+
// DEP_GEN: append-file{{.*}} "[[INPUTFILE]]"
79+
// DEP_GEN-NOT: clang{{.*}} "-dependency-file"
80+
81+
/// Dependency generation phases
82+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -MD -c %s -ccc-print-phases 2>&1 \
83+
// RUN: | FileCheck -check-prefix DEP_GEN_PHASES %s
84+
// DEP_GEN_PHASES: 0: input, "[[INPUTFILE:.+\.cpp]]", c++, (host-sycl)
85+
// DEP_GEN_PHASES: 1: preprocessor, {0}, dependencies
86+
// DEP_GEN_PHASES: 2: input, "[[INPUTFILE]]", c++, (device-sycl)
87+
// DEP_GEN_PHASES: 3: preprocessor, {2}, c++-cpp-output, (device-sycl)
88+
// DEP_GEN_PHASES: 4: compiler, {3}, ir, (device-sycl)
89+
// DEP_GEN_PHASES: 5: offload, "device-sycl (spir64-unknown-unknown-sycldevice)" {4}, ir
90+
// DEP_GEN_PHASES: 6: append-footer, {0}, c++, (host-sycl)
91+
// DEP_GEN_PHASES: 7: preprocessor, {6}, c++-cpp-output, (host-sycl)
92+
// DEP_GEN_PHASES: 8: offload, "host-sycl (x86_64-unknown-linux-gnu)" {7}, "device-sycl (spir64-unknown-unknown-sycldevice)" {4}, c++-cpp-output
93+
// DEP_GEN_PHASES: 9: compiler, {8}, ir, (host-sycl)
94+
// DEP_GEN_PHASES: 10: backend, {9}, assembler, (host-sycl)
95+
// DEP_GEN_PHASES: 11: assembler, {10}, object, (host-sycl)
96+
// DEP_GEN_PHASES: 12: clang-offload-bundler, {5, 11}, object, (host-sycl)
97+
98+
/// Allow for -o and preprocessing
99+
// RUN: %clangxx -fsycl -MD -c %s -o dummy -### 2>&1 \
100+
// RUN: | FileCheck -check-prefix DEP_GEN_OUT_ERROR %s
101+
// DEP_GEN_OUT_ERROR-NOT: cannot specify -o when generating multiple output files

0 commit comments

Comments
 (0)