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
bb97938d
Commit
bb97938d
authored
Dec 17, 2017
by
Andrew Adams
Committed by
Tianqi Chen
Dec 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Halide -> HalideIR (#698)
parent
75cee522
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
131 additions
and
131 deletions
+131
-131
HalideIR
+1
-1
include/tvm/expr.h
+28
-28
include/tvm/ir.h
+48
-48
include/tvm/ir_operator.h
+7
-7
include/tvm/packed_func_ext.h
+5
-5
include/tvm/runtime/packed_func.h
+6
-6
include/tvm/tensor.h
+1
-1
src/api/api_ir.cc
+1
-1
src/arithmetic/bound_deducer.cc
+1
-1
src/arithmetic/canonical.cc
+2
-2
src/arithmetic/compute_expr.h
+5
-5
src/arithmetic/int_set.cc
+1
-1
src/arithmetic/int_set_internal.h
+1
-1
src/lang/expr.cc
+3
-3
src/lang/ir.cc
+2
-2
src/lang/reflection.cc
+1
-1
src/lang/tensor.cc
+1
-1
src/op/compute_op.cc
+1
-1
src/op/extern_op.cc
+1
-1
src/op/scan_op.cc
+1
-1
src/pass/inject_prefetch.cc
+1
-1
src/pass/ir_deep_compare.cc
+2
-2
src/pass/ir_mutator.cc
+2
-2
src/pass/storage_flatten.cc
+1
-1
src/schedule/message_passing.cc
+1
-1
tests/cpp/ir_mutator_test.cc
+3
-3
tests/cpp/ir_simplify_test.cc
+1
-1
tests/cpp/ir_ssa_test.cc
+2
-2
tests/cpp/ir_visitor_test.cc
+1
-1
No files found.
HalideIR
@
aadbf02d
Subproject commit
d91cf97d5d6cd2b47ec408bb08e978b88cbf6ab7
Subproject commit
aadbf02d6bd7a545edbf6652494a7b07a97a06c1
include/tvm/expr.h
View file @
bb97938d
...
@@ -16,31 +16,31 @@
...
@@ -16,31 +16,31 @@
namespace
tvm
{
namespace
tvm
{
using
Halide
::
Type
;
using
Halide
IR
::
Type
;
using
Halide
::
Float
;
using
Halide
IR
::
Float
;
using
Halide
::
Bool
;
using
Halide
IR
::
Bool
;
using
Halide
::
Int
;
using
Halide
IR
::
Int
;
using
Halide
::
UInt
;
using
Halide
IR
::
UInt
;
using
Halide
::
Handle
;
using
Halide
IR
::
Handle
;
using
Halide
::
ExprHash
;
using
Halide
IR
::
ExprHash
;
using
Halide
::
ExprEqual
;
using
Halide
IR
::
ExprEqual
;
using
Halide
::
Expr
;
using
Halide
IR
::
Expr
;
using
Halide
::
VarExpr
;
using
Halide
IR
::
VarExpr
;
using
Halide
::
IR
::
RangeNode
;
using
Halide
IR
::
IR
::
RangeNode
;
using
Halide
::
IR
::
FunctionRef
;
using
Halide
IR
::
IR
::
FunctionRef
;
using
Halide
::
IR
::
FunctionBaseNode
;
using
Halide
IR
::
IR
::
FunctionBaseNode
;
using
Halide
::
Internal
::
Stmt
;
using
Halide
IR
::
Internal
::
Stmt
;
using
Halide
::
Internal
::
IRPrinter
;
using
Halide
IR
::
Internal
::
IRPrinter
;
using
Halide
::
Internal
::
Variable
;
using
Halide
IR
::
Internal
::
Variable
;
using
Halide
::
Internal
::
make_const
;
using
Halide
IR
::
Internal
::
make_const
;
using
Halide
::
Internal
::
make_zero
;
using
Halide
IR
::
Internal
::
make_zero
;
using
Halide
::
Internal
::
as_const_int
;
using
Halide
IR
::
Internal
::
as_const_int
;
using
Halide
::
Internal
::
as_const_uint
;
using
Halide
IR
::
Internal
::
as_const_uint
;
using
Halide
::
Internal
::
const_true
;
using
Halide
IR
::
Internal
::
const_true
;
using
Halide
::
Internal
::
const_false
;
using
Halide
IR
::
Internal
::
const_false
;
using
Halide
::
Internal
::
is_no_op
;
using
Halide
IR
::
Internal
::
is_no_op
;
inline
Type
TVMShapeIndexType
()
{
inline
Type
TVMShapeIndexType
()
{
if
(
std
::
is_signed
<
tvm_index_t
>::
value
)
{
if
(
std
::
is_signed
<
tvm_index_t
>::
value
)
{
...
@@ -51,7 +51,7 @@ inline Type TVMShapeIndexType() {
...
@@ -51,7 +51,7 @@ inline Type TVMShapeIndexType() {
}
}
inline
Type
TVMType2Type
(
TVMType
t
)
{
inline
Type
TVMType2Type
(
TVMType
t
)
{
return
Type
(
static_cast
<
halide_type_code_t
>
(
t
.
code
),
t
.
bits
,
t
.
lanes
);
return
Type
(
static_cast
<
halide
ir
_type_code_t
>
(
t
.
code
),
t
.
bits
,
t
.
lanes
);
}
}
inline
TVMType
Type2TVMType
(
Type
t
)
{
inline
TVMType
Type2TVMType
(
Type
t
)
{
...
@@ -71,7 +71,7 @@ inline int GetVectorBytes(Type dtype) {
...
@@ -71,7 +71,7 @@ inline int GetVectorBytes(Type dtype) {
}
}
/*! \brief a named variable in TVM */
/*! \brief a named variable in TVM */
class
Var
:
public
Halide
::
VarExpr
{
class
Var
:
public
Halide
IR
::
VarExpr
{
public
:
public
:
explicit
Var
(
const
std
::
string
&
name_hint
=
"v"
,
explicit
Var
(
const
std
::
string
&
name_hint
=
"v"
,
Type
t
=
Int
(
32
))
:
VarExpr
(
name_hint
,
t
)
{}
Type
t
=
Int
(
32
))
:
VarExpr
(
name_hint
,
t
)
{}
...
@@ -94,7 +94,7 @@ class Var : public Halide::VarExpr {
...
@@ -94,7 +94,7 @@ class Var : public Halide::VarExpr {
class
IterVarNode
;
class
IterVarNode
;
/*!
/*!
* \brief same as Halide::IR::Range
* \brief same as Halide
IR
::IR::Range
* except it provide an constructor with (begin, end)
* except it provide an constructor with (begin, end)
*
*
* \note Traditional Halide's Range have a constructor with
* \note Traditional Halide's Range have a constructor with
...
@@ -102,11 +102,11 @@ class IterVarNode;
...
@@ -102,11 +102,11 @@ class IterVarNode;
* We decided to correct it by removing the constructor in HalideIR,
* We decided to correct it by removing the constructor in HalideIR,
* and add it back in TVM's range.
* and add it back in TVM's range.
*/
*/
class
Range
:
public
Halide
::
IR
::
Range
{
class
Range
:
public
Halide
IR
::
IR
::
Range
{
public
:
public
:
/*! \brief constructor */
/*! \brief constructor */
Range
()
{}
Range
()
{}
explicit
Range
(
std
::
shared_ptr
<
Node
>
n
)
:
Halide
::
IR
::
Range
(
n
)
{}
explicit
Range
(
std
::
shared_ptr
<
Node
>
n
)
:
Halide
IR
::
IR
::
Range
(
n
)
{}
/*!
/*!
* \brief constructor by begin and end
* \brief constructor by begin and end
* \param begin The begin of the range.
* \param begin The begin of the range.
...
...
include/tvm/ir.h
View file @
bb97938d
...
@@ -16,11 +16,11 @@
...
@@ -16,11 +16,11 @@
namespace
tvm
{
namespace
tvm
{
namespace
ir
{
namespace
ir
{
using
Halide
::
Internal
::
ExprNode
;
using
Halide
IR
::
Internal
::
ExprNode
;
using
Halide
::
Internal
::
StmtNode
;
using
Halide
IR
::
Internal
::
StmtNode
;
using
Halide
::
Internal
::
IRNodeType
;
using
Halide
IR
::
Internal
::
IRNodeType
;
using
Halide
::
Internal
::
ForType
;
using
Halide
IR
::
Internal
::
ForType
;
using
Halide
::
DeviceAPI
;
using
Halide
IR
::
DeviceAPI
;
// Node container for CommReducer
// Node container for CommReducer
struct
CommReducerNode
;
struct
CommReducerNode
;
...
@@ -433,50 +433,50 @@ enum TVMStructFieldKind : int {
...
@@ -433,50 +433,50 @@ enum TVMStructFieldKind : int {
}
// namespace intrinsic
}
// namespace intrinsic
// Reuse IR node defintiion from HalideIR
// Reuse IR node defintiion from HalideIR
using
Halide
::
Internal
::
IntImm
;
using
Halide
IR
::
Internal
::
IntImm
;
using
Halide
::
Internal
::
UIntImm
;
using
Halide
IR
::
Internal
::
UIntImm
;
using
Halide
::
Internal
::
FloatImm
;
using
Halide
IR
::
Internal
::
FloatImm
;
using
Halide
::
Internal
::
StringImm
;
using
Halide
IR
::
Internal
::
StringImm
;
using
Halide
::
Internal
::
Cast
;
using
Halide
IR
::
Internal
::
Cast
;
using
Halide
::
Internal
::
Add
;
using
Halide
IR
::
Internal
::
Add
;
using
Halide
::
Internal
::
Sub
;
using
Halide
IR
::
Internal
::
Sub
;
using
Halide
::
Internal
::
Mul
;
using
Halide
IR
::
Internal
::
Mul
;
using
Halide
::
Internal
::
Div
;
using
Halide
IR
::
Internal
::
Div
;
using
Halide
::
Internal
::
Mod
;
using
Halide
IR
::
Internal
::
Mod
;
using
Halide
::
Internal
::
Min
;
using
Halide
IR
::
Internal
::
Min
;
using
Halide
::
Internal
::
Max
;
using
Halide
IR
::
Internal
::
Max
;
using
Halide
::
Internal
::
EQ
;
using
Halide
IR
::
Internal
::
EQ
;
using
Halide
::
Internal
::
NE
;
using
Halide
IR
::
Internal
::
NE
;
using
Halide
::
Internal
::
LT
;
using
Halide
IR
::
Internal
::
LT
;
using
Halide
::
Internal
::
LE
;
using
Halide
IR
::
Internal
::
LE
;
using
Halide
::
Internal
::
GT
;
using
Halide
IR
::
Internal
::
GT
;
using
Halide
::
Internal
::
GE
;
using
Halide
IR
::
Internal
::
GE
;
using
Halide
::
Internal
::
And
;
using
Halide
IR
::
Internal
::
And
;
using
Halide
::
Internal
::
Or
;
using
Halide
IR
::
Internal
::
Or
;
using
Halide
::
Internal
::
Not
;
using
Halide
IR
::
Internal
::
Not
;
using
Halide
::
Internal
::
Select
;
using
Halide
IR
::
Internal
::
Select
;
using
Halide
::
Internal
::
Load
;
using
Halide
IR
::
Internal
::
Load
;
using
Halide
::
Internal
::
Ramp
;
using
Halide
IR
::
Internal
::
Ramp
;
using
Halide
::
Internal
::
Broadcast
;
using
Halide
IR
::
Internal
::
Broadcast
;
using
Halide
::
Internal
::
Call
;
using
Halide
IR
::
Internal
::
Call
;
using
Halide
::
Internal
::
Let
;
using
Halide
IR
::
Internal
::
Let
;
using
Halide
::
Internal
::
LetStmt
;
using
Halide
IR
::
Internal
::
LetStmt
;
using
Halide
::
Internal
::
AttrStmt
;
using
Halide
IR
::
Internal
::
AttrStmt
;
using
Halide
::
Internal
::
AssertStmt
;
using
Halide
IR
::
Internal
::
AssertStmt
;
using
Halide
::
Internal
::
ProducerConsumer
;
using
Halide
IR
::
Internal
::
ProducerConsumer
;
using
Halide
::
Internal
::
For
;
using
Halide
IR
::
Internal
::
For
;
using
Halide
::
Internal
::
Store
;
using
Halide
IR
::
Internal
::
Store
;
using
Halide
::
Internal
::
Provide
;
using
Halide
IR
::
Internal
::
Provide
;
using
Halide
::
Internal
::
Allocate
;
using
Halide
IR
::
Internal
::
Allocate
;
using
Halide
::
Internal
::
Free
;
using
Halide
IR
::
Internal
::
Free
;
using
Halide
::
Internal
::
Realize
;
using
Halide
IR
::
Internal
::
Realize
;
using
Halide
::
Internal
::
Prefetch
;
using
Halide
IR
::
Internal
::
Prefetch
;
using
Halide
::
Internal
::
Block
;
using
Halide
IR
::
Internal
::
Block
;
using
Halide
::
Internal
::
IfThenElse
;
using
Halide
IR
::
Internal
::
IfThenElse
;
using
Halide
::
Internal
::
Evaluate
;
using
Halide
IR
::
Internal
::
Evaluate
;
using
Halide
::
Internal
::
Shuffle
;
using
Halide
IR
::
Internal
::
Shuffle
;
// ir functions
// ir functions
using
Halide
::
Internal
::
is_const_power_of_two_integer
;
using
Halide
IR
::
Internal
::
is_const_power_of_two_integer
;
}
// namespace ir
}
// namespace ir
}
// namespace tvm
}
// namespace tvm
...
...
include/tvm/ir_operator.h
View file @
bb97938d
...
@@ -12,14 +12,14 @@
...
@@ -12,14 +12,14 @@
namespace
tvm
{
namespace
tvm
{
using
Halide
::
likely
;
using
Halide
IR
::
likely
;
using
Halide
::
likely_if_innermost
;
using
Halide
IR
::
likely_if_innermost
;
// functions
// functions
using
Halide
::
cast
;
using
Halide
IR
::
cast
;
using
Halide
::
min
;
using
Halide
IR
::
min
;
using
Halide
::
max
;
using
Halide
IR
::
max
;
using
Halide
::
abs
;
using
Halide
IR
::
abs
;
using
Halide
::
select
;
using
Halide
IR
::
select
;
/*!
/*!
* \brief sum of of source expression over axis
* \brief sum of of source expression over axis
...
...
include/tvm/packed_func_ext.h
View file @
bb97938d
...
@@ -104,7 +104,7 @@ inline TNodeRef TVMArgValue::AsNodeRef() const {
...
@@ -104,7 +104,7 @@ inline TNodeRef TVMArgValue::AsNodeRef() const {
return
TNodeRef
(
sptr
);
return
TNodeRef
(
sptr
);
}
}
inline
TVMArgValue
::
operator
Halide
::
Expr
()
const
{
inline
TVMArgValue
::
operator
Halide
IR
::
Expr
()
const
{
if
(
type_code_
==
kNull
)
return
Expr
();
if
(
type_code_
==
kNull
)
return
Expr
();
if
(
type_code_
==
kDLInt
)
{
if
(
type_code_
==
kDLInt
)
{
return
Expr
(
static_cast
<
int
>
(
value_
.
v_int64
));
return
Expr
(
static_cast
<
int
>
(
value_
.
v_int64
));
...
@@ -184,20 +184,20 @@ inline void TVMArgsSetter::operator()(size_t i, const NodeRef& other) const { /
...
@@ -184,20 +184,20 @@ inline void TVMArgsSetter::operator()(size_t i, const NodeRef& other) const { /
}
}
// type related stuffs
// type related stuffs
inline
TVMRetValue
&
TVMRetValue
::
operator
=
(
const
Halide
::
Type
&
t
)
{
inline
TVMRetValue
&
TVMRetValue
::
operator
=
(
const
Halide
IR
::
Type
&
t
)
{
return
this
->
operator
=
(
Type2TVMType
(
t
));
return
this
->
operator
=
(
Type2TVMType
(
t
));
}
}
inline
TVMRetValue
::
operator
Halide
::
Type
()
const
{
inline
TVMRetValue
::
operator
Halide
IR
::
Type
()
const
{
return
TVMType2Type
(
operator
TVMType
());
return
TVMType2Type
(
operator
TVMType
());
}
}
inline
TVMArgValue
::
operator
Halide
::
Type
()
const
{
inline
TVMArgValue
::
operator
Halide
IR
::
Type
()
const
{
return
TVMType2Type
(
operator
TVMType
());
return
TVMType2Type
(
operator
TVMType
());
}
}
inline
void
TVMArgsSetter
::
operator
()(
inline
void
TVMArgsSetter
::
operator
()(
size_t
i
,
const
Halide
::
Type
&
t
)
const
{
size_t
i
,
const
Halide
IR
::
Type
&
t
)
const
{
this
->
operator
()(
i
,
Type2TVMType
(
t
));
this
->
operator
()(
i
,
Type2TVMType
(
t
));
}
}
}
// namespace runtime
}
// namespace runtime
...
...
include/tvm/runtime/packed_func.h
View file @
bb97938d
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
#include "./c_runtime_api.h"
#include "./c_runtime_api.h"
#include "./module.h"
#include "./module.h"
namespace
Halide
{
namespace
Halide
IR
{
// Forward declare type for extensions
// Forward declare type for extensions
// The header works fine without depending on this.
// The header works fine without depending on this.
struct
Type
;
struct
Type
;
...
@@ -351,8 +351,8 @@ class TVMArgValue : public TVMPODValue_ {
...
@@ -351,8 +351,8 @@ class TVMArgValue : public TVMPODValue_ {
typename
=
typename
std
::
enable_if
<
typename
=
typename
std
::
enable_if
<
std
::
is_class
<
TNodeRef
>::
value
>::
type
>
std
::
is_class
<
TNodeRef
>::
value
>::
type
>
inline
bool
IsNodeType
()
const
;
inline
bool
IsNodeType
()
const
;
inline
operator
Halide
::
Type
()
const
;
inline
operator
Halide
IR
::
Type
()
const
;
inline
operator
Halide
::
Expr
()
const
;
inline
operator
Halide
IR
::
Expr
()
const
;
// get internal node ptr, if it is node
// get internal node ptr, if it is node
inline
std
::
shared_ptr
<
Node
>&
node_sptr
();
inline
std
::
shared_ptr
<
Node
>&
node_sptr
();
};
};
...
@@ -531,8 +531,8 @@ class TVMRetValue : public TVMPODValue_ {
...
@@ -531,8 +531,8 @@ class TVMRetValue : public TVMPODValue_ {
inline
TVMRetValue
&
operator
=
(
const
NodeRef
&
other
);
inline
TVMRetValue
&
operator
=
(
const
NodeRef
&
other
);
inline
TVMRetValue
&
operator
=
(
const
std
::
shared_ptr
<
Node
>&
other
);
inline
TVMRetValue
&
operator
=
(
const
std
::
shared_ptr
<
Node
>&
other
);
// type related
// type related
inline
operator
Halide
::
Type
()
const
;
inline
operator
Halide
IR
::
Type
()
const
;
inline
TVMRetValue
&
operator
=
(
const
Halide
::
Type
&
other
);
inline
TVMRetValue
&
operator
=
(
const
Halide
IR
::
Type
&
other
);
private
:
private
:
template
<
typename
T
>
template
<
typename
T
>
...
@@ -800,7 +800,7 @@ class TVMArgsSetter {
...
@@ -800,7 +800,7 @@ class TVMArgsSetter {
inline
void
operator
()(
size_t
i
,
const
T
&
value
)
const
;
inline
void
operator
()(
size_t
i
,
const
T
&
value
)
const
;
// NodeRef related extenstions: in tvm/packed_func_ext.h
// NodeRef related extenstions: in tvm/packed_func_ext.h
inline
void
operator
()(
size_t
i
,
const
NodeRef
&
other
)
const
;
// NOLINT(*)
inline
void
operator
()(
size_t
i
,
const
NodeRef
&
other
)
const
;
// NOLINT(*)
inline
void
operator
()(
size_t
i
,
const
Halide
::
Type
&
t
)
const
;
inline
void
operator
()(
size_t
i
,
const
Halide
IR
::
Type
&
t
)
const
;
private
:
private
:
/*! \brief The values fields */
/*! \brief The values fields */
...
...
include/tvm/tensor.h
View file @
bb97938d
...
@@ -23,7 +23,7 @@ class TensorNode;
...
@@ -23,7 +23,7 @@ class TensorNode;
// internal node container for Operation
// internal node container for Operation
class
OperationNode
;
class
OperationNode
;
using
Halide
::
IR
::
FunctionRef
;
using
Halide
IR
::
IR
::
FunctionRef
;
/*!
/*!
* \brief Tensor structure representing a possible input,
* \brief Tensor structure representing a possible input,
...
...
src/api/api_ir.cc
View file @
bb97938d
...
@@ -27,7 +27,7 @@ TVM_REGISTER_API("make.For")
...
@@ -27,7 +27,7 @@ TVM_REGISTER_API("make.For")
args
[
1
],
args
[
1
],
args
[
2
],
args
[
2
],
static_cast
<
ForType
>
(
args
[
3
].
operator
int
()),
static_cast
<
ForType
>
(
args
[
3
].
operator
int
()),
static_cast
<
Halide
::
DeviceAPI
>
(
args
[
4
].
operator
int
()),
static_cast
<
Halide
IR
::
DeviceAPI
>
(
args
[
4
].
operator
int
()),
args
[
5
]);
args
[
5
]);
});
});
...
...
src/arithmetic/bound_deducer.cc
View file @
bb97938d
...
@@ -16,7 +16,7 @@ namespace tvm {
...
@@ -16,7 +16,7 @@ namespace tvm {
namespace
arith
{
namespace
arith
{
using
namespace
ir
;
using
namespace
ir
;
using
Halide
::
Internal
::
Interval
;
using
Halide
IR
::
Internal
::
Interval
;
// a visitor to find the path to the target variable
// a visitor to find the path to the target variable
// from a expression.
// from a expression.
...
...
src/arithmetic/canonical.cc
View file @
bb97938d
...
@@ -626,7 +626,7 @@ Expr CanonicalSimplify(Expr expr, Map<Var, Range> vrange) {
...
@@ -626,7 +626,7 @@ Expr CanonicalSimplify(Expr expr, Map<Var, Range> vrange) {
template
<
typename
T
>
template
<
typename
T
>
T
Simplify_
(
T
a
,
Map
<
Var
,
Range
>
vrange
)
{
T
Simplify_
(
T
a
,
Map
<
Var
,
Range
>
vrange
)
{
using
namespace
Halide
::
Internal
;
using
namespace
Halide
IR
::
Internal
;
Scope
<
Interval
>
rscope
;
Scope
<
Interval
>
rscope
;
for
(
auto
kv
:
vrange
)
{
for
(
auto
kv
:
vrange
)
{
Range
r
=
kv
.
second
;
Range
r
=
kv
.
second
;
...
@@ -635,7 +635,7 @@ T Simplify_(T a, Map<Var, Range> vrange) {
...
@@ -635,7 +635,7 @@ T Simplify_(T a, Map<Var, Range> vrange) {
Interval
(
r
->
min
,
Interval
(
r
->
min
,
simplify
(
r
->
min
+
r
->
extent
-
make_const
(
r
->
min
.
type
(),
1
))));
simplify
(
r
->
min
+
r
->
extent
-
make_const
(
r
->
min
.
type
(),
1
))));
}
}
return
Halide
::
Internal
::
simplify
(
a
,
true
,
rscope
);
return
Halide
IR
::
Internal
::
simplify
(
a
,
true
,
rscope
);
}
}
...
...
src/arithmetic/compute_expr.h
View file @
bb97938d
...
@@ -14,9 +14,9 @@
...
@@ -14,9 +14,9 @@
namespace
tvm
{
namespace
tvm
{
namespace
arith
{
namespace
arith
{
using
Halide
::
Internal
::
add_would_overflow
;
using
Halide
IR
::
Internal
::
add_would_overflow
;
using
Halide
::
Internal
::
sub_would_overflow
;
using
Halide
IR
::
Internal
::
sub_would_overflow
;
using
Halide
::
Internal
::
mul_would_overflow
;
using
Halide
IR
::
Internal
::
mul_would_overflow
;
/*!
/*!
* \brief Compute the expression with the given binary op.
* \brief Compute the expression with the given binary op.
...
@@ -133,12 +133,12 @@ inline Expr ComputeExpr<ir::Mod>(Expr a, Expr b) {
...
@@ -133,12 +133,12 @@ inline Expr ComputeExpr<ir::Mod>(Expr a, Expr b) {
template
<>
template
<>
inline
Expr
ComputeExpr
<
ir
::
Max
>
(
Expr
a
,
Expr
b
)
{
inline
Expr
ComputeExpr
<
ir
::
Max
>
(
Expr
a
,
Expr
b
)
{
return
Halide
::
Internal
::
Interval
::
make_max
(
a
,
b
);
return
Halide
IR
::
Internal
::
Interval
::
make_max
(
a
,
b
);
}
}
template
<>
template
<>
inline
Expr
ComputeExpr
<
ir
::
Min
>
(
Expr
a
,
Expr
b
)
{
inline
Expr
ComputeExpr
<
ir
::
Min
>
(
Expr
a
,
Expr
b
)
{
return
Halide
::
Internal
::
Interval
::
make_min
(
a
,
b
);
return
Halide
IR
::
Internal
::
Interval
::
make_min
(
a
,
b
);
}
}
template
<
typename
Op
>
template
<
typename
Op
>
...
...
src/arithmetic/int_set.cc
View file @
bb97938d
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
namespace
tvm
{
namespace
tvm
{
namespace
arith
{
namespace
arith
{
using
Halide
::
Internal
::
Interval
;
using
Halide
IR
::
Internal
::
Interval
;
using
namespace
ir
;
using
namespace
ir
;
inline
IntSet
IntSet
::
cover_interval
()
const
{
inline
IntSet
IntSet
::
cover_interval
()
const
{
...
...
src/arithmetic/int_set_internal.h
View file @
bb97938d
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
namespace
tvm
{
namespace
tvm
{
namespace
arith
{
namespace
arith
{
using
Halide
::
Internal
::
Interval
;
using
Halide
IR
::
Internal
::
Interval
;
/*! \brief Set of continuous interval */
/*! \brief Set of continuous interval */
struct
IntervalSet
:
public
IntSetNode
{
struct
IntervalSet
:
public
IntSetNode
{
...
...
src/lang/expr.cc
View file @
bb97938d
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
namespace
tvm
{
namespace
tvm
{
using
Halide
::
IR
::
RangeNode
;
using
Halide
IR
::
IR
::
RangeNode
;
Range
::
Range
(
Expr
begin
,
Expr
end
)
Range
::
Range
(
Expr
begin
,
Expr
end
)
:
Range
(
std
::
make_shared
<
RangeNode
>
(
:
Range
(
std
::
make_shared
<
RangeNode
>
(
...
@@ -19,7 +19,7 @@ Range::Range(Expr begin, Expr end)
...
@@ -19,7 +19,7 @@ Range::Range(Expr begin, Expr end)
}
}
Range
Range
::
make_by_min_extent
(
Expr
min
,
Expr
extent
)
{
Range
Range
::
make_by_min_extent
(
Expr
min
,
Expr
extent
)
{
return
Range
(
std
::
make_shared
<
Halide
::
IR
::
RangeNode
>
(
min
,
extent
));
return
Range
(
std
::
make_shared
<
Halide
IR
::
IR
::
RangeNode
>
(
min
,
extent
));
}
}
IterVar
IterVarNode
::
make
(
Range
dom
,
Var
var
,
IterVar
IterVarNode
::
make
(
Range
dom
,
Var
var
,
...
@@ -67,7 +67,7 @@ TVM_STATIC_IR_FUNCTOR(IRPrinter, vtable)
...
@@ -67,7 +67,7 @@ TVM_STATIC_IR_FUNCTOR(IRPrinter, vtable)
});
});
TVM_STATIC_IR_FUNCTOR
(
IRPrinter
,
vtable
)
TVM_STATIC_IR_FUNCTOR
(
IRPrinter
,
vtable
)
.
set_dispatch
<
RangeNode
>
([](
const
Halide
::
IR
::
RangeNode
*
op
,
IRPrinter
*
p
)
{
.
set_dispatch
<
RangeNode
>
([](
const
Halide
IR
::
IR
::
RangeNode
*
op
,
IRPrinter
*
p
)
{
p
->
stream
<<
"range(min="
<<
op
->
min
<<
", ext="
<<
op
->
extent
<<
')'
;
p
->
stream
<<
"range(min="
<<
op
->
min
<<
", ext="
<<
op
->
extent
<<
')'
;
});
});
...
...
src/lang/ir.cc
View file @
bb97938d
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#include <memory>
#include <memory>
#include "../pass/ir_util.h"
#include "../pass/ir_util.h"
namespace
Halide
{
namespace
Halide
IR
{
namespace
Internal
{
namespace
Internal
{
using
tvm
::
ir
::
CommReducerNode
;
using
tvm
::
ir
::
CommReducerNode
;
...
@@ -43,7 +43,7 @@ TVM_STATIC_IR_FUNCTOR(IRPrinter, vtable)
...
@@ -43,7 +43,7 @@ TVM_STATIC_IR_FUNCTOR(IRPrinter, vtable)
<<
")"
;
<<
")"
;
});
});
}
// namespace Internal
}
// namespace Internal
}
// namespace Halide
}
// namespace Halide
IR
namespace
tvm
{
namespace
tvm
{
namespace
ir
{
namespace
ir
{
...
...
src/lang/reflection.cc
View file @
bb97938d
...
@@ -25,7 +25,7 @@ inline std::string Type2String(const Type& t) {
...
@@ -25,7 +25,7 @@ inline std::string Type2String(const Type& t) {
inline
Type
String2Type
(
std
::
string
s
)
{
inline
Type
String2Type
(
std
::
string
s
)
{
std
::
istringstream
is
(
s
);
std
::
istringstream
is
(
s
);
halide_type_code_t
code
=
Type
::
Int
;
halide
ir
_type_code_t
code
=
Type
::
Int
;
if
(
s
.
substr
(
0
,
3
)
==
"int"
)
{
if
(
s
.
substr
(
0
,
3
)
==
"int"
)
{
code
=
Type
::
Int
;
s
=
s
.
substr
(
3
);
code
=
Type
::
Int
;
s
=
s
.
substr
(
3
);
}
else
if
(
s
.
substr
(
0
,
4
)
==
"uint"
)
{
}
else
if
(
s
.
substr
(
0
,
4
)
==
"uint"
)
{
...
...
src/lang/tensor.cc
View file @
bb97938d
...
@@ -16,7 +16,7 @@ Expr Tensor::operator()(Array<Var> indices) const {
...
@@ -16,7 +16,7 @@ Expr Tensor::operator()(Array<Var> indices) const {
}
}
Expr
Tensor
::
operator
()(
Array
<
Expr
>
indices
)
const
{
Expr
Tensor
::
operator
()(
Array
<
Expr
>
indices
)
const
{
using
Halide
::
Internal
::
Call
;
using
Halide
IR
::
Internal
::
Call
;
CHECK_EQ
(
ndim
(),
indices
.
size
())
CHECK_EQ
(
ndim
(),
indices
.
size
())
<<
"Tensor dimension mismatch in read"
<<
"Tensor dimension mismatch in read"
<<
"ndim = "
<<
ndim
()
<<
", indices.size="
<<
indices
.
size
();
<<
"ndim = "
<<
ndim
()
<<
", indices.size="
<<
indices
.
size
();
...
...
src/op/compute_op.cc
View file @
bb97938d
...
@@ -228,7 +228,7 @@ Stmt ComputeOpNode::BuildRealize(
...
@@ -228,7 +228,7 @@ Stmt ComputeOpNode::BuildRealize(
const
std
::
unordered_map
<
IterVar
,
Range
>&
realize_map
,
const
std
::
unordered_map
<
IterVar
,
Range
>&
realize_map
,
const
Stmt
&
realize_body
)
const
{
const
Stmt
&
realize_body
)
const
{
CHECK_EQ
(
stage
->
op
.
get
(),
this
);
CHECK_EQ
(
stage
->
op
.
get
(),
this
);
Halide
::
Internal
::
Region
bounds
;
Halide
IR
::
Internal
::
Region
bounds
;
for
(
IterVar
iv
:
this
->
axis
)
{
for
(
IterVar
iv
:
this
->
axis
)
{
bounds
.
push_back
(
realize_map
.
at
(
iv
));
bounds
.
push_back
(
realize_map
.
at
(
iv
));
}
}
...
...
src/op/extern_op.cc
View file @
bb97938d
...
@@ -113,7 +113,7 @@ Stmt ExternOpNode::BuildRealize(
...
@@ -113,7 +113,7 @@ Stmt ExternOpNode::BuildRealize(
Stmt
realize_body
=
body
;
Stmt
realize_body
=
body
;
for
(
int
k
=
0
;
k
<
num_outputs
();
++
k
)
{
for
(
int
k
=
0
;
k
<
num_outputs
();
++
k
)
{
Tensor
t
=
stage
->
op
.
output
(
k
);
Tensor
t
=
stage
->
op
.
output
(
k
);
Halide
::
Internal
::
Region
bounds
;
Halide
IR
::
Internal
::
Region
bounds
;
for
(
size_t
i
=
0
;
i
<
t
->
shape
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
t
->
shape
.
size
();
++
i
)
{
bounds
.
push_back
(
bounds
.
push_back
(
Range
::
make_by_min_extent
(
Range
::
make_by_min_extent
(
...
...
src/op/scan_op.cc
View file @
bb97938d
...
@@ -238,7 +238,7 @@ Stmt ScanOpNode::BuildRealize(
...
@@ -238,7 +238,7 @@ Stmt ScanOpNode::BuildRealize(
for
(
size_t
i
=
0
;
i
<
update
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
update
.
size
();
++
i
)
{
Tensor
t
=
stage
->
op
.
output
(
i
);
Tensor
t
=
stage
->
op
.
output
(
i
);
CHECK_EQ
(
static_cast
<
size_t
>
(
t
->
value_index
),
i
);
CHECK_EQ
(
static_cast
<
size_t
>
(
t
->
value_index
),
i
);
Halide
::
Internal
::
Region
bounds
;
Halide
IR
::
Internal
::
Region
bounds
;
bounds
.
push_back
(
tdom
);
bounds
.
push_back
(
tdom
);
for
(
size_t
k
=
1
;
k
<
this
->
update
[
i
]
->
shape
.
size
();
++
k
,
++
sp_idx
)
{
for
(
size_t
k
=
1
;
k
<
this
->
update
[
i
]
->
shape
.
size
();
++
k
,
++
sp_idx
)
{
IterVar
sp_ax
=
this
->
spatial_axis_
[
sp_idx
];
IterVar
sp_ax
=
this
->
spatial_axis_
[
sp_idx
];
...
...
src/pass/inject_prefetch.cc
View file @
bb97938d
...
@@ -15,7 +15,7 @@ namespace ir {
...
@@ -15,7 +15,7 @@ namespace ir {
using
arith
::
IntSet
;
using
arith
::
IntSet
;
using
arith
::
DomainTouched
;
using
arith
::
DomainTouched
;
using
Halide
::
Internal
::
Region
;
using
Halide
IR
::
Internal
::
Region
;
class
PrefetchInjector
:
public
IRMutator
{
class
PrefetchInjector
:
public
IRMutator
{
public
:
public
:
...
...
src/pass/ir_deep_compare.cc
View file @
bb97938d
...
@@ -328,8 +328,8 @@ class IRDeepCompare :
...
@@ -328,8 +328,8 @@ class IRDeepCompare :
return
order_
;
return
order_
;
}
}
int
CompareRegion
(
const
Halide
::
Internal
::
Region
&
lhs
,
int
CompareRegion
(
const
Halide
IR
::
Internal
::
Region
&
lhs
,
const
Halide
::
Internal
::
Region
&
rhs
)
{
const
Halide
IR
::
Internal
::
Region
&
rhs
)
{
if
(
order_
!=
0
)
return
order_
;
if
(
order_
!=
0
)
return
order_
;
if
(
CompareValue
(
lhs
.
size
(),
rhs
.
size
())
!=
0
)
return
order_
;
if
(
CompareValue
(
lhs
.
size
(),
rhs
.
size
())
!=
0
)
return
order_
;
for
(
size_t
i
=
0
;
i
<
lhs
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
lhs
.
size
();
++
i
)
{
...
...
src/pass/ir_mutator.cc
View file @
bb97938d
...
@@ -206,7 +206,7 @@ Stmt IRMutator::Mutate_(const Provide* op, const Stmt& s) {
...
@@ -206,7 +206,7 @@ Stmt IRMutator::Mutate_(const Provide* op, const Stmt& s) {
Stmt
IRMutator
::
Mutate_
(
const
Realize
*
op
,
const
Stmt
&
s
)
{
Stmt
IRMutator
::
Mutate_
(
const
Realize
*
op
,
const
Stmt
&
s
)
{
IRMutator
*
m
=
this
;
IRMutator
*
m
=
this
;
Halide
::
Internal
::
Region
new_bounds
;
Halide
IR
::
Internal
::
Region
new_bounds
;
bool
bounds_changed
=
false
;
bool
bounds_changed
=
false
;
// Mutate the bounds
// Mutate the bounds
...
@@ -236,7 +236,7 @@ Stmt IRMutator::Mutate_(const Realize* op, const Stmt& s) {
...
@@ -236,7 +236,7 @@ Stmt IRMutator::Mutate_(const Realize* op, const Stmt& s) {
Stmt
IRMutator
::
Mutate_
(
const
Prefetch
*
op
,
const
Stmt
&
s
)
{
Stmt
IRMutator
::
Mutate_
(
const
Prefetch
*
op
,
const
Stmt
&
s
)
{
IRMutator
*
m
=
this
;
IRMutator
*
m
=
this
;
Halide
::
Internal
::
Region
new_bounds
;
Halide
IR
::
Internal
::
Region
new_bounds
;
bool
bounds_changed
=
false
;
bool
bounds_changed
=
false
;
// Mutate the bounds
// Mutate the bounds
...
...
src/pass/storage_flatten.cc
View file @
bb97938d
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
namespace
tvm
{
namespace
tvm
{
namespace
ir
{
namespace
ir
{
using
Halide
::
Internal
::
Region
;
using
Halide
IR
::
Internal
::
Region
;
using
runtime
::
StorageScope
;
using
runtime
::
StorageScope
;
using
runtime
::
ThreadScope
;
using
runtime
::
ThreadScope
;
using
intrinsic
::
tvm_address_of
;
using
intrinsic
::
tvm_address_of
;
...
...
src/schedule/message_passing.cc
View file @
bb97938d
...
@@ -407,7 +407,7 @@ void PassUpBoundCheck(const Stage& s,
...
@@ -407,7 +407,7 @@ void PassUpBoundCheck(const Stage& s,
const
Map
<
IterVar
,
Range
>&
dom_map
,
const
Map
<
IterVar
,
Range
>&
dom_map
,
std
::
unordered_map
<
IterVar
,
bool
>*
p_state
)
{
std
::
unordered_map
<
IterVar
,
bool
>*
p_state
)
{
auto
&
state
=
*
p_state
;
auto
&
state
=
*
p_state
;
using
Halide
::
Internal
::
can_prove
;
using
Halide
IR
::
Internal
::
can_prove
;
for
(
size_t
i
=
s
->
relations
.
size
();
i
!=
0
;
--
i
)
{
for
(
size_t
i
=
s
->
relations
.
size
();
i
!=
0
;
--
i
)
{
IterVarRelation
rel
=
s
->
relations
[
i
-
1
];
IterVarRelation
rel
=
s
->
relations
[
i
-
1
];
if
(
rel
.
as
<
SplitNode
>
())
{
if
(
rel
.
as
<
SplitNode
>
())
{
...
...
tests/cpp/ir_mutator_test.cc
View file @
bb97938d
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
namespace
{
namespace
{
using
namespace
tvm
::
ir
;
using
namespace
tvm
::
ir
;
using
namespace
Halide
::
Internal
;
using
namespace
Halide
IR
::
Internal
;
using
namespace
Halide
;
using
namespace
Halide
IR
;
// replace variable to constant
// replace variable to constant
class
IRVar2Const
:
public
IRMutator
{
class
IRVar2Const
:
public
IRMutator
{
...
@@ -38,7 +38,7 @@ TVM_STATIC_IR_FUNCTOR(IRVar2Const, vtable_expr)
...
@@ -38,7 +38,7 @@ TVM_STATIC_IR_FUNCTOR(IRVar2Const, vtable_expr)
}
// namespace
}
// namespace
TEST
(
IRMutator
,
Basic
)
{
TEST
(
IRMutator
,
Basic
)
{
using
namespace
Halide
::
Internal
;
using
namespace
Halide
IR
::
Internal
;
using
namespace
tvm
;
using
namespace
tvm
;
Var
x
(
"x"
),
y
;
Var
x
(
"x"
),
y
;
auto
z
=
x
+
y
;
auto
z
=
x
+
y
;
...
...
tests/cpp/ir_simplify_test.cc
View file @
bb97938d
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#include <arithmetic/Simplify.h>
#include <arithmetic/Simplify.h>
TEST
(
IRSIMPLIFY
,
Basic
)
{
TEST
(
IRSIMPLIFY
,
Basic
)
{
using
namespace
Halide
::
Internal
;
using
namespace
Halide
IR
::
Internal
;
simplify_test
();
simplify_test
();
}
}
...
...
tests/cpp/ir_ssa_test.cc
View file @
bb97938d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
TEST
(
IRSSA
,
Convert
)
{
TEST
(
IRSSA
,
Convert
)
{
using
namespace
Halide
::
Internal
;
using
namespace
Halide
IR
::
Internal
;
using
namespace
tvm
;
using
namespace
tvm
;
Var
x
(
"x"
),
y
;
Var
x
(
"x"
),
y
;
Expr
let
=
Let
::
make
(
x
,
1
,
x
+
1
);
Expr
let
=
Let
::
make
(
x
,
1
,
x
+
1
);
...
@@ -17,7 +17,7 @@ TEST(IRSSA, Convert) {
...
@@ -17,7 +17,7 @@ TEST(IRSSA, Convert) {
}
}
TEST
(
IRSSA
,
Basic
)
{
TEST
(
IRSSA
,
Basic
)
{
using
namespace
Halide
::
Internal
;
using
namespace
Halide
IR
::
Internal
;
using
namespace
tvm
;
using
namespace
tvm
;
Var
x
(
"x"
),
y
;
Var
x
(
"x"
),
y
;
auto
z
=
Evaluate
::
make
(
x
+
y
);
auto
z
=
Evaluate
::
make
(
x
+
y
);
...
...
tests/cpp/ir_visitor_test.cc
View file @
bb97938d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#include <tvm/ir_pass.h>
#include <tvm/ir_pass.h>
TEST
(
IRVisitor
,
CountVar
)
{
TEST
(
IRVisitor
,
CountVar
)
{
using
namespace
Halide
::
Internal
;
using
namespace
Halide
IR
::
Internal
;
using
namespace
tvm
;
using
namespace
tvm
;
int
n_var
=
0
;
int
n_var
=
0
;
Var
x
(
"x"
),
y
;
Var
x
(
"x"
),
y
;
...
...
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