Skip to content

Commit e08c89d

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web'
2 parents 72abbc0 + c630064 commit e08c89d

File tree

77 files changed

+629
-533
lines changed

Some content is hidden

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

77 files changed

+629
-533
lines changed

.github/workflows/sycl-linux-precommit-aws.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
with:
6565
name: CUDA E2E
6666
runner: '["aws_cuda-${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}"]'
67-
image: ghcr.io/intel/llvm/ubuntu2204_build:latest-cc1dd89176dd35522d57022a57204b41ae2611a9
67+
image: ghcr.io/intel/llvm/ubuntu2204_build:latest
6868
image_options: -u 1001 --gpus all --cap-add SYS_ADMIN --env NVIDIA_DISABLE_REQUIRE=1
6969
target_devices: ext_oneapi_cuda:gpu
7070
# No idea why but that seems to work and be in sync with the main

.github/workflows/sycl-linux-precommit.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
build_artifact_suffix: "default"
4747
build_cache_suffix: "default"
4848
changes: ${{ needs.detect_changes.outputs.filters }}
49-
build_image: "ghcr.io/intel/llvm/ubuntu2204_build:latest-cc1dd89176dd35522d57022a57204b41ae2611a9"
5049

5150
determine_arc_tests:
5251
name: Decide which Arc tests to run
@@ -78,7 +77,7 @@ jobs:
7877
include:
7978
- name: AMD/HIP
8079
runner: '["Linux", "amdgpu"]'
81-
image: ghcr.io/intel/llvm/ubuntu2204_build:latest-cc1dd89176dd35522d57022a57204b41ae2611a9
80+
image: ghcr.io/intel/llvm/ubuntu2204_build:latest
8281
image_options: -u 1001 --device=/dev/dri --device=/dev/kfd
8382
target_devices: ext_oneapi_hip:gpu
8483
- name: Intel

buildbot/configure.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ def do_configure(args):
8888
sycl_enabled_plugins.append("hip")
8989

9090
if args.native_cpu:
91-
#Todo: we should set whatever targets we support for native cpu
92-
libclc_targets_to_build += ';x86_64-unknown-linux-gnu'
91+
# Todo: we should set whatever targets we support for native cpu
92+
libclc_targets_to_build += ";x86_64-unknown-linux-gnu"
93+
libclc_gen_remangled_variants = "ON"
9394
sycl_enabled_plugins.append("native_cpu")
9495

9596

clang/include/clang/CodeGen/BackendUtil.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ namespace clang {
3030
class CodeGenOptions;
3131
class TargetOptions;
3232
class LangOptions;
33+
class BackendConsumer;
3334

3435
enum BackendAction {
3536
Backend_EmitAssembly, ///< Emit native assembly files
@@ -45,7 +46,8 @@ namespace clang {
4546
const TargetOptions &TOpts, const LangOptions &LOpts,
4647
StringRef TDesc, llvm::Module *M, BackendAction Action,
4748
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
48-
std::unique_ptr<raw_pwrite_stream> OS);
49+
std::unique_ptr<raw_pwrite_stream> OS,
50+
BackendConsumer *BC = nullptr);
4951

5052
void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts,
5153
llvm::MemoryBufferRef Buf);

clang/lib/CodeGen/BackendConsumer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class BackendConsumer : public ASTConsumer {
159159
/// Specialized handler for misexpect warnings.
160160
/// Note that misexpect remarks are emitted through ORE
161161
void MisExpectDiagHandler(const llvm::DiagnosticInfoMisExpect &D);
162+
void AspectMismatchDiagHandler(const llvm::DiagnosticInfoAspectsMismatch &D);
162163
};
163164

164165
} // namespace clang

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "clang/CodeGen/BackendUtil.h"
10+
#include "BackendConsumer.h"
11+
#include "LinkInModulesPass.h"
1012
#include "clang/Basic/CodeGenOptions.h"
1113
#include "clang/Basic/Diagnostic.h"
1214
#include "clang/Basic/LangOptions.h"
@@ -133,11 +135,6 @@ static cl::opt<PGOOptions::ColdFuncOpt> ClPGOColdFuncAttr(
133135

134136
extern cl::opt<InstrProfCorrelator::ProfCorrelatorKind> ProfileCorrelate;
135137

136-
// Re-link builtin bitcodes after optimization
137-
cl::opt<bool> ClRelinkBuiltinBitcodePostop(
138-
"relink-builtin-bitcode-postop", cl::Optional,
139-
cl::desc("Re-link builtin bitcodes after optimization."), cl::init(false));
140-
141138
static cl::opt<bool> SYCLNativeCPUBackend(
142139
"sycl-native-cpu-backend", cl::init(false),
143140
cl::desc("Re-link builtin bitcodes after optimization."));
@@ -158,7 +155,7 @@ class EmitAssemblyHelper {
158155
const CodeGenOptions &CodeGenOpts;
159156
const clang::TargetOptions &TargetOpts;
160157
const LangOptions &LangOpts;
161-
Module *TheModule;
158+
llvm::Module *TheModule;
162159
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS;
163160

164161
Timer CodeGenerationTime;
@@ -201,10 +198,9 @@ class EmitAssemblyHelper {
201198
return F;
202199
}
203200

204-
void
205-
RunOptimizationPipeline(BackendAction Action,
206-
std::unique_ptr<raw_pwrite_stream> &OS,
207-
std::unique_ptr<llvm::ToolOutputFile> &ThinLinkOS);
201+
void RunOptimizationPipeline(
202+
BackendAction Action, std::unique_ptr<raw_pwrite_stream> &OS,
203+
std::unique_ptr<llvm::ToolOutputFile> &ThinLinkOS, BackendConsumer *BC);
208204
void RunCodegenPipeline(BackendAction Action,
209205
std::unique_ptr<raw_pwrite_stream> &OS,
210206
std::unique_ptr<llvm::ToolOutputFile> &DwoOS);
@@ -232,7 +228,7 @@ class EmitAssemblyHelper {
232228
const HeaderSearchOptions &HeaderSearchOpts,
233229
const CodeGenOptions &CGOpts,
234230
const clang::TargetOptions &TOpts,
235-
const LangOptions &LOpts, Module *M,
231+
const LangOptions &LOpts, llvm::Module *M,
236232
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS)
237233
: Diags(_Diags), HSOpts(HeaderSearchOpts), CodeGenOpts(CGOpts),
238234
TargetOpts(TOpts), LangOpts(LOpts), TheModule(M), VFS(std::move(VFS)),
@@ -247,8 +243,8 @@ class EmitAssemblyHelper {
247243
std::unique_ptr<TargetMachine> TM;
248244

249245
// Emit output using the new pass manager for the optimization pipeline.
250-
void EmitAssembly(BackendAction Action,
251-
std::unique_ptr<raw_pwrite_stream> OS);
246+
void EmitAssembly(BackendAction Action, std::unique_ptr<raw_pwrite_stream> OS,
247+
BackendConsumer *BC);
252248
};
253249
} // namespace
254250

@@ -731,7 +727,7 @@ static void addSanitizers(const Triple &TargetTriple,
731727
// the logic of the original code, but operates on "shadow" values. It
732728
// can benefit from re-running some general purpose optimization
733729
// passes.
734-
MPM.addPass(RequireAnalysisPass<GlobalsAA, Module>());
730+
MPM.addPass(RequireAnalysisPass<GlobalsAA, llvm::Module>());
735731
FunctionPassManager FPM;
736732
FPM.addPass(EarlyCSEPass(true /* Enable mem-ssa. */));
737733
FPM.addPass(InstCombinePass());
@@ -790,7 +786,7 @@ static void addSanitizers(const Triple &TargetTriple,
790786
SanitizersCallback(NewMPM, Level);
791787
if (!NewMPM.isEmpty()) {
792788
// Sanitizers can abandon<GlobalsAA>.
793-
NewMPM.addPass(RequireAnalysisPass<GlobalsAA, Module>());
789+
NewMPM.addPass(RequireAnalysisPass<GlobalsAA, llvm::Module>());
794790
MPM.addPass(std::move(NewMPM));
795791
}
796792
});
@@ -812,7 +808,7 @@ static void addSanitizers(const Triple &TargetTriple,
812808

813809
void EmitAssemblyHelper::RunOptimizationPipeline(
814810
BackendAction Action, std::unique_ptr<raw_pwrite_stream> &OS,
815-
std::unique_ptr<llvm::ToolOutputFile> &ThinLinkOS) {
811+
std::unique_ptr<llvm::ToolOutputFile> &ThinLinkOS, BackendConsumer *BC) {
816812
std::optional<PGOOptions> PGOOpt;
817813

818814
if (CodeGenOpts.hasProfileIRInstr())
@@ -1163,6 +1159,10 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
11631159
}
11641160
}
11651161

1162+
// Link against bitcodes supplied via the -mlink-builtin-bitcode option
1163+
if (CodeGenOpts.LinkBitcodePostopt)
1164+
MPM.addPass(LinkInModulesPass(BC, false));
1165+
11661166
// Add a verifier pass if requested. We don't have to do this if the action
11671167
// requires code generation because there will already be a verifier pass in
11681168
// the code-generation pipeline.
@@ -1175,7 +1175,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
11751175
CodeGenOpts.FatLTO) {
11761176
if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) {
11771177
if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
1178-
TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
1178+
TheModule->addModuleFlag(llvm::Module::Error, "EnableSplitLTOUnit",
11791179
CodeGenOpts.EnableSplitLTOUnit);
11801180
if (Action == Backend_EmitBC) {
11811181
if (!CodeGenOpts.ThinLinkBitcodeFile.empty()) {
@@ -1195,9 +1195,9 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
11951195
bool EmitLTOSummary = shouldEmitRegularLTOSummary();
11961196
if (EmitLTOSummary) {
11971197
if (!TheModule->getModuleFlag("ThinLTO") && !CodeGenOpts.UnifiedLTO)
1198-
TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0));
1198+
TheModule->addModuleFlag(llvm::Module::Error, "ThinLTO", uint32_t(0));
11991199
if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
1200-
TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
1200+
TheModule->addModuleFlag(llvm::Module::Error, "EnableSplitLTOUnit",
12011201
uint32_t(1));
12021202
}
12031203
if (Action == Backend_EmitBC) {
@@ -1280,7 +1280,8 @@ void EmitAssemblyHelper::RunCodegenPipeline(
12801280
}
12811281

12821282
void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
1283-
std::unique_ptr<raw_pwrite_stream> OS) {
1283+
std::unique_ptr<raw_pwrite_stream> OS,
1284+
BackendConsumer *BC) {
12841285
TimeRegion Region(CodeGenOpts.TimePasses ? &CodeGenerationTime : nullptr);
12851286
setCommandLineOpts(CodeGenOpts);
12861287

@@ -1296,7 +1297,7 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
12961297
cl::PrintOptionValues();
12971298

12981299
std::unique_ptr<llvm::ToolOutputFile> ThinLinkOS, DwoOS;
1299-
RunOptimizationPipeline(Action, OS, ThinLinkOS);
1300+
RunOptimizationPipeline(Action, OS, ThinLinkOS, BC);
13001301
RunCodegenPipeline(Action, OS, DwoOS);
13011302

13021303
if (ThinLinkOS)
@@ -1306,11 +1307,12 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
13061307
}
13071308

13081309
static void runThinLTOBackend(
1309-
DiagnosticsEngine &Diags, ModuleSummaryIndex *CombinedIndex, Module *M,
1310-
const HeaderSearchOptions &HeaderOpts, const CodeGenOptions &CGOpts,
1311-
const clang::TargetOptions &TOpts, const LangOptions &LOpts,
1312-
std::unique_ptr<raw_pwrite_stream> OS, std::string SampleProfile,
1313-
std::string ProfileRemapping, BackendAction Action) {
1310+
DiagnosticsEngine &Diags, ModuleSummaryIndex *CombinedIndex,
1311+
llvm::Module *M, const HeaderSearchOptions &HeaderOpts,
1312+
const CodeGenOptions &CGOpts, const clang::TargetOptions &TOpts,
1313+
const LangOptions &LOpts, std::unique_ptr<raw_pwrite_stream> OS,
1314+
std::string SampleProfile, std::string ProfileRemapping,
1315+
BackendAction Action) {
13141316
DenseMap<StringRef, DenseMap<GlobalValue::GUID, GlobalValueSummary *>>
13151317
ModuleToDefinedGVSummaries;
13161318
CombinedIndex->collectDefinedGVSummariesPerModule(ModuleToDefinedGVSummaries);
@@ -1379,18 +1381,18 @@ static void runThinLTOBackend(
13791381
Conf.SplitDwarfOutput = CGOpts.SplitDwarfOutput;
13801382
switch (Action) {
13811383
case Backend_EmitNothing:
1382-
Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) {
1384+
Conf.PreCodeGenModuleHook = [](size_t Task, const llvm::Module &Mod) {
13831385
return false;
13841386
};
13851387
break;
13861388
case Backend_EmitLL:
1387-
Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
1389+
Conf.PreCodeGenModuleHook = [&](size_t Task, const llvm::Module &Mod) {
13881390
M->print(*OS, nullptr, CGOpts.EmitLLVMUseLists);
13891391
return false;
13901392
};
13911393
break;
13921394
case Backend_EmitBC:
1393-
Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
1395+
Conf.PreCodeGenModuleHook = [&](size_t Task, const llvm::Module &Mod) {
13941396
WriteBitcodeToFile(*M, *OS, CGOpts.EmitLLVMUseLists);
13951397
return false;
13961398
};
@@ -1409,14 +1411,12 @@ static void runThinLTOBackend(
14091411
}
14101412
}
14111413

1412-
void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
1413-
const HeaderSearchOptions &HeaderOpts,
1414-
const CodeGenOptions &CGOpts,
1415-
const clang::TargetOptions &TOpts,
1416-
const LangOptions &LOpts, StringRef TDesc,
1417-
Module *M, BackendAction Action,
1418-
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
1419-
std::unique_ptr<raw_pwrite_stream> OS) {
1414+
void clang::EmitBackendOutput(
1415+
DiagnosticsEngine &Diags, const HeaderSearchOptions &HeaderOpts,
1416+
const CodeGenOptions &CGOpts, const clang::TargetOptions &TOpts,
1417+
const LangOptions &LOpts, StringRef TDesc, llvm::Module *M,
1418+
BackendAction Action, IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
1419+
std::unique_ptr<raw_pwrite_stream> OS, BackendConsumer *BC) {
14201420

14211421
llvm::TimeTraceScope TimeScope("Backend");
14221422

@@ -1459,7 +1459,7 @@ void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
14591459
}
14601460

14611461
EmitAssemblyHelper AsmHelper(Diags, HeaderOpts, CGOpts, TOpts, LOpts, M, VFS);
1462-
AsmHelper.EmitAssembly(Action, std::move(OS));
1462+
AsmHelper.EmitAssembly(Action, std::move(OS), BC);
14631463

14641464
// Verify clang's TargetInfo DataLayout against the LLVM TargetMachine's
14651465
// DataLayout.

clang/lib/CodeGen/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ add_clang_library(clangCodeGen
106106
ConstantInitBuilder.cpp
107107
CoverageMappingGen.cpp
108108
ItaniumCXXABI.cpp
109+
LinkInModulesPass.cpp
109110
MacroPPCallbacks.cpp
110111
MicrosoftCXXABI.cpp
111112
ModuleBuilder.cpp

0 commit comments

Comments
 (0)