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
537b70e4
Commit
537b70e4
authored
Mar 08, 2018
by
Chris Nuernberger
Committed by
Tianqi Chen
Mar 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assert dont crash on null strides (#976)
parent
e380c8a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
src/pass/arg_binder.cc
+7
-3
No files found.
src/pass/arg_binder.cc
View file @
537b70e4
...
@@ -194,6 +194,9 @@ void ArgBinder::BindDLTensor(const Buffer& buffer,
...
@@ -194,6 +194,9 @@ void ArgBinder::BindDLTensor(const Buffer& buffer,
init_nest_
.
emplace_back
(
LetStmt
::
make
(
init_nest_
.
emplace_back
(
LetStmt
::
make
(
v_strides
,
TVMArrayGet
(
Handle
(),
handle
,
intrinsic
::
kArrStrides
),
v_strides
,
TVMArrayGet
(
Handle
(),
handle
,
intrinsic
::
kArrStrides
),
nop
));
nop
));
Expr
is_null
=
Call
::
make
(
Bool
(
1
),
intrinsic
::
tvm_handle_is_null
,
{
v_strides
},
Call
::
PureIntrinsic
);
if
(
buffer
->
strides
.
size
()
==
0
)
{
if
(
buffer
->
strides
.
size
()
==
0
)
{
// Assert the buffer is compact
// Assert the buffer is compact
Type
stype
=
buffer
->
DefaultIndexType
();
Type
stype
=
buffer
->
DefaultIndexType
();
...
@@ -215,13 +218,14 @@ void ArgBinder::BindDLTensor(const Buffer& buffer,
...
@@ -215,13 +218,14 @@ void ArgBinder::BindDLTensor(const Buffer& buffer,
Stmt
check
=
Stmt
check
=
AssertStmt
::
make
(
arith
::
ComputeReduce
<
ir
::
And
>
(
conds
,
Expr
()),
AssertStmt
::
make
(
arith
::
ComputeReduce
<
ir
::
And
>
(
conds
,
Expr
()),
stride_err_msg
.
str
(),
Evaluate
::
make
(
0
));
stride_err_msg
.
str
(),
Evaluate
::
make
(
0
));
Expr
is_null
=
Call
::
make
(
Bool
(
1
),
intrinsic
::
tvm_handle_is_null
,
{
v_strides
},
Call
::
PureIntrinsic
);
check
=
IfThenElse
::
make
(
Not
::
make
(
is_null
),
check
,
Stmt
());
check
=
IfThenElse
::
make
(
Not
::
make
(
is_null
),
check
,
Stmt
());
init_nest_
.
emplace_back
(
Block
::
make
(
check
,
Evaluate
::
make
(
0
)));
init_nest_
.
emplace_back
(
Block
::
make
(
check
,
Evaluate
::
make
(
0
)));
}
}
}
else
{
}
else
{
std
::
ostringstream
stride_null_err_msg
;
stride_null_err_msg
<<
arg_name
<<
".strides: expected non-null strides."
;
asserts_
.
emplace_back
(
AssertStmt
::
make
(
Not
::
make
(
is_null
),
stride_null_err_msg
.
str
(),
nop
));
for
(
size_t
k
=
0
;
k
<
buffer
->
strides
.
size
();
++
k
)
{
for
(
size_t
k
=
0
;
k
<
buffer
->
strides
.
size
();
++
k
)
{
std
::
ostringstream
field_name
;
std
::
ostringstream
field_name
;
field_name
<<
v_strides
->
name_hint
<<
'['
<<
k
<<
']'
;
field_name
<<
v_strides
->
name_hint
<<
'['
<<
k
<<
']'
;
...
...
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