1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
diff -upr beignet.orig/backend/src/backend/program.cpp beignet/backend/src/backend/program.cpp
--- beignet.orig/backend/src/backend/program.cpp 2020-04-16 03:44:21.153955099 +0300
+++ beignet/backend/src/backend/program.cpp 2020-04-16 03:47:50.369205839 +0300
@@ -694,9 +694,14 @@ namespace gbe {
#endif
);
+ llvm::cl::ResetAllOptionOccurrences();
clang::CompilerInvocation::CreateFromArgs(*CI,
+#if LLVM_VERSION_MAJOR < 10
&args[0],
&args[0] + args.size(),
+#else
+ clang::ArrayRef<const char*>(args),
+#endif
Diags);
// Create the compiler instance
clang::CompilerInstance Clang;
@@ -1242,8 +1247,12 @@ EXTEND_QUOTE:
// Create the compiler invocation
std::unique_ptr<clang::CompilerInvocation> CI(new clang::CompilerInvocation);
return clang::CompilerInvocation::CreateFromArgs(*CI,
+#if LLVM_VERSION_MAJOR < 10
&args[0],
&args[0] + args.size(),
+#else
+ clang::ArrayRef<const char*>(args),
+#endif
Diags);
}
#endif
Only in beignet/backend/src/backend: program.cpp.orig
Only in beignet.orig/backend/src: CMakeLists.txt.orig
diff -upr beignet.orig/backend/src/llvm/llvm_gen_backend.cpp beignet/backend/src/llvm/llvm_gen_backend.cpp
--- beignet.orig/backend/src/llvm/llvm_gen_backend.cpp 2020-04-16 03:44:21.783970632 +0300
+++ beignet/backend/src/llvm/llvm_gen_backend.cpp 2020-04-16 03:45:04.141685867 +0300
@@ -575,11 +575,13 @@ namespace gbe
has_errors(false),
legacyMode(true)
{
+#if LLVM_VERSION_MAJOR < 10
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 37
initializeLoopInfoWrapperPassPass(*PassRegistry::getPassRegistry());
#else
initializeLoopInfoPass(*PassRegistry::getPassRegistry());
#endif
+#endif
pass = PASS_EMIT_REGISTERS;
}
diff -upr beignet.orig/backend/src/llvm/llvm_gen_backend.hpp beignet/backend/src/llvm/llvm_gen_backend.hpp
--- beignet.orig/backend/src/llvm/llvm_gen_backend.hpp 2020-04-16 03:44:21.177289008 +0300
+++ beignet/backend/src/llvm/llvm_gen_backend.hpp 2020-04-16 03:45:04.135019035 +0300
@@ -130,10 +130,10 @@ namespace gbe
llvm::FunctionPass *createGenPass(ir::Unit &unit);
/*! Remove the GEP instructions */
- llvm::BasicBlockPass *createRemoveGEPPass(const ir::Unit &unit);
+ llvm::FunctionPass *createRemoveGEPPass(const ir::Unit &unit);
/*! Merge load/store if possible */
- llvm::BasicBlockPass *createLoadStoreOptimizationPass();
+ llvm::FunctionPass *createLoadStoreOptimizationPass();
/*! Scalarize all vector op instructions */
llvm::FunctionPass* createScalarizePass();
@@ -141,7 +141,7 @@ namespace gbe
llvm::ModulePass* createBarrierNodupPass(bool);
/*! Convert the Intrinsic call to gen function */
- llvm::BasicBlockPass *createIntrinsicLoweringPass();
+ llvm::FunctionPass *createIntrinsicLoweringPass();
/*! Passer the printf function call. */
llvm::FunctionPass* createPrintfParserPass(ir::Unit &unit);
diff -upr beignet.orig/backend/src/llvm/llvm_intrinsic_lowering.cpp beignet/backend/src/llvm/llvm_intrinsic_lowering.cpp
--- beignet.orig/backend/src/llvm/llvm_intrinsic_lowering.cpp 2020-04-16 03:44:21.783970632 +0300
+++ beignet/backend/src/llvm/llvm_intrinsic_lowering.cpp 2020-04-16 03:45:04.135019035 +0300
@@ -29,12 +29,12 @@
using namespace llvm;
namespace gbe {
- class InstrinsicLowering : public BasicBlockPass
+ class InstrinsicLowering : public FunctionPass
{
public:
static char ID;
InstrinsicLowering() :
- BasicBlockPass(ID) {}
+ FunctionPass(ID) {}
void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -93,9 +93,9 @@ namespace gbe {
CI->eraseFromParent();
return NewCI;
}
- virtual bool runOnBasicBlock(BasicBlock &BB)
+ virtual bool runOnFunction(Function &F)
{
- bool changedBlock = false;
+ for (BasicBlock &BB : F) {
Module *M = BB.getParent()->getParent();
DataLayout TD(M);
@@ -159,13 +159,14 @@ namespace gbe {
}
}
}
- return changedBlock;
+ }
+ return true;
}
};
char InstrinsicLowering::ID = 0;
- BasicBlockPass *createIntrinsicLoweringPass() {
+ FunctionPass *createIntrinsicLoweringPass() {
return new InstrinsicLowering();
}
} // end namespace
diff -upr beignet.orig/backend/src/llvm/llvm_loadstore_optimization.cpp beignet/backend/src/llvm/llvm_loadstore_optimization.cpp
--- beignet.orig/backend/src/llvm/llvm_loadstore_optimization.cpp 2020-04-16 03:44:21.177289008 +0300
+++ beignet/backend/src/llvm/llvm_loadstore_optimization.cpp 2020-04-16 03:45:38.645879307 +0300
@@ -26,13 +26,13 @@
using namespace llvm;
namespace gbe {
- class GenLoadStoreOptimization : public BasicBlockPass {
+ class GenLoadStoreOptimization : public FunctionPass {
public:
static char ID;
ScalarEvolution *SE;
const DataLayout *TD;
- GenLoadStoreOptimization() : BasicBlockPass(ID) {}
+ GenLoadStoreOptimization() : FunctionPass(ID) {}
void getAnalysisUsage(AnalysisUsage &AU) const {
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 38
@@ -45,7 +45,9 @@ namespace gbe {
AU.setPreservesCFG();
}
- virtual bool runOnBasicBlock(BasicBlock &BB) {
+ virtual bool runOnFunction(Function &F) {
+ bool changedAnyBlock = false;
+ for (BasicBlock &BB : F) {
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 38
SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
#else
@@ -59,7 +61,9 @@ namespace gbe {
#else
TD = getAnalysisIfAvailable<DataLayout>();
#endif
- return optimizeLoadStore(BB);
+ changedAnyBlock = optimizeLoadStore(BB) | changedAnyBlock;
+ }
+ return changedAnyBlock;
}
Type *getValueType(Value *insn);
Value *getPointerOperand(Value *I);
@@ -159,7 +163,11 @@ namespace gbe {
values.push_back(merged[i]);
}
LoadInst *ld = cast<LoadInst>(first);
+#if LLVM_VERSION_MAJOR < 10
unsigned align = ld->getAlignment();
+#else
+ MaybeAlign align = ld->getAlign();
+#endif
unsigned addrSpace = ld->getPointerAddressSpace();
// insert before first load
Builder.SetInsertPoint(ld);
@@ -352,7 +360,11 @@ namespace gbe {
unsigned addrSpace = st->getPointerAddressSpace();
+#if LLVM_VERSION_MAJOR < 10
unsigned align = st->getAlignment();
+#else
+ MaybeAlign align = st->getAlign();
+#endif
// insert before the last store
Builder.SetInsertPoint(last);
@@ -466,7 +478,7 @@ namespace gbe {
return changed;
}
- BasicBlockPass *createLoadStoreOptimizationPass() {
+ FunctionPass *createLoadStoreOptimizationPass() {
return new GenLoadStoreOptimization();
}
};
Only in beignet/backend/src/llvm: llvm_loadstore_optimization.cpp.orig
Only in beignet/backend/src/llvm: llvm_loadstore_optimization.cpp.rej
diff -upr beignet.orig/backend/src/llvm/llvm_passes.cpp beignet/backend/src/llvm/llvm_passes.cpp
--- beignet.orig/backend/src/llvm/llvm_passes.cpp 2020-04-16 03:44:21.177289008 +0300
+++ beignet/backend/src/llvm/llvm_passes.cpp 2020-04-16 03:45:04.135019035 +0300
@@ -37,7 +37,7 @@
#include "sys/map.hpp"
using namespace llvm;
-
+template class cfg::Update<BasicBlock *>;
namespace gbe
{
bool isKernelFunction(const llvm::Function &F) {
@@ -219,13 +219,13 @@ namespace gbe
return offset;
}
- class GenRemoveGEPPasss : public BasicBlockPass
+ class GenRemoveGEPPasss : public FunctionPass
{
public:
static char ID;
GenRemoveGEPPasss(const ir::Unit &unit) :
- BasicBlockPass(ID),
+ FunctionPass(ID),
unit(unit) {}
const ir::Unit &unit;
void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -242,16 +242,18 @@ namespace gbe
bool simplifyGEPInstructions(GetElementPtrInst* GEPInst);
- virtual bool runOnBasicBlock(BasicBlock &BB)
+ virtual bool runOnFunction(Function &F)
{
- bool changedBlock = false;
+ bool changedAnyBlock = false;
+ for (BasicBlock &BB : F) {
iplist<Instruction>::iterator I = BB.getInstList().begin();
for (auto nextI = I, E = --BB.getInstList().end(); I != E; I = nextI) {
iplist<Instruction>::iterator I = nextI++;
if(GetElementPtrInst* gep = dyn_cast<GetElementPtrInst>(&*I))
- changedBlock = (simplifyGEPInstructions(gep) || changedBlock);
+ changedAnyBlock = (simplifyGEPInstructions(gep) | changedAnyBlock);
}
- return changedBlock;
+ }
+ return changedAnyBlock;
}
};
@@ -367,7 +369,7 @@ namespace gbe
return true;
}
- BasicBlockPass *createRemoveGEPPass(const ir::Unit &unit) {
+ FunctionPass *createRemoveGEPPass(const ir::Unit &unit) {
return new GenRemoveGEPPasss(unit);
}
} /* namespace gbe */
diff -upr beignet.orig/backend/src/llvm/llvm_sampler_fix.cpp beignet/backend/src/llvm/llvm_sampler_fix.cpp
--- beignet.orig/backend/src/llvm/llvm_sampler_fix.cpp 2020-04-16 03:44:21.783970632 +0300
+++ beignet/backend/src/llvm/llvm_sampler_fix.cpp 2020-04-16 03:45:04.138352451 +0300
@@ -33,11 +33,13 @@ namespace gbe {
class SamplerFix : public FunctionPass {
public:
SamplerFix() : FunctionPass(ID) {
+#if LLVM_VERSION_MAJOR < 10
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
initializeDominatorTreeWrapperPassPass(*PassRegistry::getPassRegistry());
#else
initializeDominatorTreePass(*PassRegistry::getPassRegistry());
#endif
+#endif
}
bool visitCallInst(CallInst *I) {
diff -upr beignet.orig/backend/src/llvm/llvm_scalarize.cpp beignet/backend/src/llvm/llvm_scalarize.cpp
--- beignet.orig/backend/src/llvm/llvm_scalarize.cpp 2020-04-16 03:44:21.670634504 +0300
+++ beignet/backend/src/llvm/llvm_scalarize.cpp 2020-04-16 03:45:04.141685867 +0300
@@ -96,11 +96,13 @@ namespace gbe {
Scalarize() : FunctionPass(ID)
{
+#if LLVM_VERSION_MAJOR < 10
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
initializeDominatorTreeWrapperPassPass(*PassRegistry::getPassRegistry());
#else
initializeDominatorTreePass(*PassRegistry::getPassRegistry());
#endif
+#endif
}
virtual bool runOnFunction(Function&);
diff -upr beignet.orig/CMake/FindLLVM.cmake beignet/CMake/FindLLVM.cmake
--- beignet.orig/CMake/FindLLVM.cmake 2020-04-16 03:44:21.137288022 +0300
+++ beignet/CMake/FindLLVM.cmake 2020-04-16 03:46:38.104039602 +0300
@@ -104,30 +104,16 @@ string(REGEX REPLACE " *\n" "" LLVM_SYST
endif (LLVM_SYSTEM_LIBS_ORIG)
endif (LLVM_VERSION_NODOT VERSION_GREATER 34)
+#something harmless because whitespace at start is an error
+set(CLANG_LIBRARIES "-ldl")
macro(add_one_lib name)
FIND_LIBRARY(CLANG_LIB
NAMES ${name}
PATHS ${LLVM_LIBRARY_DIR} NO_DEFAULT_PATH)
- set(CLANG_LIBRARIES ${CLANG_LIBRARIES} ${CLANG_LIB})
+ set(CLANG_LIBRARIES "${CLANG_LIBRARIES} ${CLANG_LIB}")
+ message(STATUS "clanglibs name ${name} this ${CLANG_LIB} all ${CLANG_LIBRARIES} ")
unset(CLANG_LIB CACHE)
endmacro()
#Assume clang lib path same as llvm lib path
-add_one_lib("clangCodeGen")
-add_one_lib("clangFrontend")
-add_one_lib("clangSerialization")
-add_one_lib("clangDriver")
-add_one_lib("clangSema")
-add_one_lib("clangStaticAnalyzerFrontend")
-add_one_lib("clangStaticAnalyzerCheckers")
-add_one_lib("clangStaticAnalyzerCore")
-add_one_lib("clangAnalysis")
-add_one_lib("clangEdit")
-if (LLVM_VERSION_NODOT VERSION_GREATER 80)
-add_one_lib("clangASTMatchers")
-endif (LLVM_VERSION_NODOT VERSION_GREATER 80)
-add_one_lib("clangAST")
-add_one_lib("clangParse")
-add_one_lib("clangSema")
-add_one_lib("clangLex")
-add_one_lib("clangBasic")
+add_one_lib("clang-cpp")
Only in beignet/CMake: FindLLVM.cmake.orig
diff -upr beignet.orig/CMakeLists.txt beignet/CMakeLists.txt
--- beignet.orig/CMakeLists.txt 2020-04-16 03:44:21.137288022 +0300
+++ beignet/CMakeLists.txt 2020-04-16 03:45:04.131685618 +0300
@@ -80,7 +80,7 @@ elseif (COMPILER STREQUAL "CLANG")
elseif (COMPILER STREQUAL "ICC")
set (CMAKE_C_CXX_FLAGS "${CMAKE_C_CXX_FLAGS} -wd2928 -Wall -fPIC -fstrict-aliasing -fp-model fast -msse4.1 -Wl,-E")
endif ()
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_CXX_FLAGS} -std=c++0x -Wno-invalid-offsetof")
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_CXX_FLAGS} -Wno-invalid-offsetof")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_CXX_FLAGS}")
set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DGBE_DEBUG=1")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DGBE_DEBUG=1")
diff -upr beignet.orig/utests/CMakeLists.txt beignet/utests/CMakeLists.txt
--- beignet.orig/utests/CMakeLists.txt 2020-04-16 03:44:21.220623410 +0300
+++ beignet/utests/CMakeLists.txt 2020-04-16 03:45:04.131685618 +0300
@@ -26,8 +26,8 @@ if (NOT NOT_BUILD_STAND_ALONE_UTEST)
# Threads
Find_Package(Threads)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_CXX_FLAGS} -std=c++0x -Wno-invalid-offsetof")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_CXX_FLAGS}")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_CXX_FLAGS} -Wno-invalid-offsetof -ffloat-store -fno-strict-aliasing")
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_CXX_FLAGS} -ffloat-store -fno-strict-aliasing") #compiler_{degrees,radians,function_argument2} use equality comparison of floats, compiler_long_bitcast uses aliasing
set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DGBE_DEBUG=1")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DGBE_DEBUG=1")
set (CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DGBE_DEBUG=0")
|