Skip to content

Commit

Permalink
update unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
cyx-6 committed Feb 4, 2023
1 parent 9c673ba commit d6816c4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/tir/schedule/error.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ String ScheduleError::RenderReport(const String& primitive) const {
int n_locs = locs.size();
std::string msg = DetailRenderTemplate();
PrinterConfig cfg;
cfg->syntax_sugar = false;
if (n_locs > 0) {
for (int i = 0; i < n_locs; ++i) {
std::string name = locs[i]->GetTypeKey() + '#' + std::to_string(i);
Expand Down
28 changes: 16 additions & 12 deletions tests/python/unittest/test_tvmscript_error_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,10 @@ def test_reorder_fail_block():
with pytest.raises(tvm.tir.ScheduleError) as execinfo:
sch.reorder(l, i)
expected_sub_error_message = (
" # tir.Block#0\n"
' with T.block("B"):\n'
" ^^^^^^^^^^^^^^^^^^\n"
" # tir.Block#0\n"
" ^^^^^^^^^^^^^\n"
' with T.block("B"):\n'
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"
)
assert expected_sub_error_message in str(execinfo.value)

Expand All @@ -473,10 +474,11 @@ def test_reorder_fail_nested_loop_inner():
with pytest.raises(tvm.tir.ScheduleError) as execinfo:
sch.reorder(k, i)
expected_sub_error_message = (
" for i in T.serial(128):\n"
" # tir.For#0\n"
" for j in T.serial(128):\n"
" ^^^^^^^^^^^^^^^^^^^^^^^\n"
" for i in range(128):\n"
" # tir.For#0\n"
" ^^^^^^^^^^^\n"
" for j in range(128):\n"
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"
)
assert expected_sub_error_message in str(execinfo.value)

Expand All @@ -488,10 +490,11 @@ def test_fuse_fail_nested_loop_outer():
with pytest.raises(tvm.tir.ScheduleError) as execinfo:
sch.fuse(k, i)
expected_sub_error_message = (
" # tir.For#1\n"
" for i in T.serial(128):\n"
" ^^^^^^^^^^^^^^^^^^^^^^^\n"
" for j in T.serial(128):\n"
" # tir.For#1\n"
" ^^^^^^^^^^^\n"
" for i in range(128):\n"
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"
" for j in range(128):\n"
)
assert expected_sub_error_message in str(execinfo.value)

Expand All @@ -503,8 +506,9 @@ def test_report_error_root_block():
sch.compute_inline(root)
expected_sub_error_message = (
" # tir.Block#0\n"
" ^^^^^^^^^^^^^\n"
' with T.block("root"):\n'
" ^^^^^^^^^^^^^^^^^^^^^\n"
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"
)
assert expected_sub_error_message in str(execinfo.value)

Expand Down

0 comments on commit d6816c4

Please sign in to comment.