Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
59d8d400
Commit
59d8d400
authored
Oct 05, 2019
by
Yizhi Liu
Committed by
Zhi
Oct 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[llvm] switch to use Align for llvm trunk (#4051)
parent
81118023
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
0 deletions
+43
-0
src/codegen/llvm/codegen_amdgpu.cc
+8
-0
src/codegen/llvm/codegen_cpu.cc
+16
-0
src/codegen/llvm/codegen_llvm.cc
+8
-0
src/codegen/llvm/codegen_nvptx.cc
+8
-0
src/codegen/llvm/llvm_common.h
+3
-0
No files found.
src/codegen/llvm/codegen_amdgpu.cc
View file @
59d8d400
...
...
@@ -71,7 +71,11 @@ class CodeGenAMDGPU : public CodeGenLLVM {
LLVMType
(
op
->
type
),
ConstInt32
(
constant_size
));
});
if
(
alloca
->
getAlignment
()
<
static_cast
<
uint32_t
>
(
info
.
alignment
))
{
#if TVM_LLVM_VERSION >= 100
alloca
->
setAlignment
(
llvm
::
Align
(
info
.
alignment
));
#else
alloca
->
setAlignment
(
info
.
alignment
);
#endif
}
buf
=
alloca
;
}
else
{
...
...
@@ -84,7 +88,11 @@ class CodeGenAMDGPU : public CodeGenLLVM {
llvm
::
GlobalVariable
*
global
=
new
llvm
::
GlobalVariable
(
*
module_
,
type
,
false
,
llvm
::
GlobalValue
::
PrivateLinkage
,
0
,
".shared"
,
nullptr
,
llvm
::
GlobalValue
::
NotThreadLocal
,
shared_address_space
);
#if TVM_LLVM_VERSION >= 100
global
->
setAlignment
(
llvm
::
Align
(
info
.
alignment
));
#else
global
->
setAlignment
(
info
.
alignment
);
#endif
buf
=
global
;
}
}
...
...
src/codegen/llvm/codegen_cpu.cc
View file @
59d8d400
...
...
@@ -236,7 +236,11 @@ void CodeGenCPU::AddMainFunction(const std::string& entry_func_name) {
llvm
::
GlobalVariable
*
global
=
new
llvm
::
GlobalVariable
(
*
module_
,
type
,
true
,
llvm
::
GlobalValue
::
WeakAnyLinkage
,
0
,
runtime
::
symbol
::
tvm_module_main
);
#if TVM_LLVM_VERSION >= 100
global
->
setAlignment
(
llvm
::
Align
(
1
));
#else
global
->
setAlignment
(
1
);
#endif
global
->
setInitializer
(
llvm
::
ConstantDataArray
::
getString
(
*
ctx_
,
entry_func_name
));
}
...
...
@@ -350,7 +354,11 @@ llvm::GlobalVariable* CodeGenCPU::InitContextPtr(
*
module_
,
p_type
,
false
,
llvm
::
GlobalValue
::
LinkOnceAnyLinkage
,
0
,
name
);
#if TVM_LLVM_VERSION >= 100
gv
->
setAlignment
(
llvm
::
Align
(
data_layout_
->
getTypeAllocSize
(
p_type
)));
#else
gv
->
setAlignment
(
data_layout_
->
getTypeAllocSize
(
p_type
));
#endif
gv
->
setInitializer
(
llvm
::
Constant
::
getNullValue
(
p_type
));
gv
->
setDLLStorageClass
(
llvm
::
GlobalValue
::
DLLStorageClassTypes
::
DLLExportStorageClass
);
return
gv
;
...
...
@@ -550,7 +558,11 @@ llvm::Value* CodeGenCPU::CreateStaticHandle() {
*
module_
,
t_void_p_
,
false
,
llvm
::
GlobalValue
::
PrivateLinkage
,
0
,
"__tvm_static_handle"
);
#if TVM_LLVM_VERSION >= 100
gv
->
setAlignment
(
llvm
::
Align
(
data_layout_
->
getTypeAllocSize
(
t_void_p_
)));
#else
gv
->
setAlignment
(
data_layout_
->
getTypeAllocSize
(
t_void_p_
));
#endif
gv
->
setInitializer
(
llvm
::
Constant
::
getNullValue
(
t_void_p_
));
return
gv
;
}
...
...
@@ -610,7 +622,11 @@ llvm::Value* CodeGenCPU::GetPackedFuncHandle(const std::string& fname) {
hptr
=
new
llvm
::
GlobalVariable
(
*
module_
,
t_tvm_func_handle_
,
false
,
llvm
::
GlobalValue
::
InternalLinkage
,
nullptr
,
".tvm_func."
+
fname
);
#if TVM_LLVM_VERSION >= 100
hptr
->
setAlignment
(
llvm
::
Align
(
align
));
#else
hptr
->
setAlignment
(
align
);
#endif
hptr
->
setInitializer
(
llvm
::
Constant
::
getNullValue
(
t_tvm_func_handle_
));
func_handle_map_
[
fname
]
=
hptr
;
}
else
{
...
...
src/codegen/llvm/codegen_llvm.cc
View file @
59d8d400
...
...
@@ -595,7 +595,11 @@ llvm::Value* CodeGenLLVM::GetConstString(const std::string& str) {
llvm
::
Type
*
type
=
llvm
::
ArrayType
::
get
(
t_char_
,
str
.
length
()
+
1
);
llvm
::
GlobalVariable
*
global
=
new
llvm
::
GlobalVariable
(
*
module_
,
type
,
true
,
llvm
::
GlobalValue
::
PrivateLinkage
,
0
,
".str"
);
#if TVM_LLVM_VERSION >= 100
global
->
setAlignment
(
llvm
::
Align
(
1
));
#else
global
->
setAlignment
(
1
);
#endif
global
->
setInitializer
(
llvm
::
ConstantDataArray
::
getString
(
*
ctx_
,
str
));
llvm
::
Constant
*
zero
=
ConstInt32
(
0
);
llvm
::
Constant
*
indices
[]
=
{
zero
,
zero
};
...
...
@@ -1150,7 +1154,11 @@ void CodeGenLLVM::VisitStmt_(const Allocate* op) {
LLVMType
(
op
->
type
),
ConstInt32
(
constant_size
));
});
if
(
alloca
->
getAlignment
()
<
static_cast
<
uint32_t
>
(
info
.
alignment
))
{
#if TVM_LLVM_VERSION >= 100
alloca
->
setAlignment
(
llvm
::
Align
(
info
.
alignment
));
#else
alloca
->
setAlignment
(
info
.
alignment
);
#endif
}
info
.
alignment
=
alloca
->
getAlignment
();
buf
=
alloca
;
...
...
src/codegen/llvm/codegen_nvptx.cc
View file @
59d8d400
...
...
@@ -73,7 +73,11 @@ class CodeGenNVPTX : public CodeGenLLVM {
LLVMType
(
op
->
type
),
ConstInt32
(
constant_size
));
});
if
(
alloca
->
getAlignment
()
<
static_cast
<
uint32_t
>
(
info
.
alignment
))
{
#if TVM_LLVM_VERSION >= 100
alloca
->
setAlignment
(
llvm
::
Align
(
info
.
alignment
));
#else
alloca
->
setAlignment
(
info
.
alignment
);
#endif
}
buf
=
alloca
;
}
else
{
...
...
@@ -86,7 +90,11 @@ class CodeGenNVPTX : public CodeGenLLVM {
llvm
::
GlobalVariable
*
global
=
new
llvm
::
GlobalVariable
(
*
module_
,
type
,
false
,
llvm
::
GlobalValue
::
PrivateLinkage
,
0
,
".shared"
,
nullptr
,
llvm
::
GlobalValue
::
NotThreadLocal
,
shared_address_space
);
#if TVM_LLVM_VERSION >= 100
global
->
setAlignment
(
llvm
::
Align
(
info
.
alignment
));
#else
global
->
setAlignment
(
info
.
alignment
);
#endif
buf
=
global
;
}
}
...
...
src/codegen/llvm/llvm_common.h
View file @
59d8d400
...
...
@@ -55,6 +55,9 @@
#include <llvm/Transforms/IPO/PassManagerBuilder.h>
#include <llvm/Transforms/IPO.h>
#if TVM_LLVM_VERSION >= 100
#include <llvm/Support/Alignment.h>
#endif
#include <llvm/Support/FileSystem.h>
#include <llvm/Support/MemoryBuffer.h>
#include <llvm/Support/raw_ostream.h>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment