j2kun/mlir-tutorial

Question on test `affine_loop_unroll.mlir`

vguerra opened this issue ยท 3 comments

Specifically regarding the test on function @test_doubly_nested_loop: should line 23 be as well preceded by a // CHECK-NOT: affine.for? IIUC, the point of the test is to make sure that nested instances of affine.for are as well transformed or it is not really necessary?

j2kun commented

In this case, FileCheck will match any line in the output for that check, so it would catch inner nested loops as well. FileCheck is a "dumb" regex tool, so it doesn't know anything about the syntax of the input.

I think what is really missing here is something that splits the test on line 7 from the test on line 18, since the // CHECK-NOT: affine.for technically would match across those. Otherwise if the second test input produced a for in its output, the first CHECK-NOT would fail. A minor issue, but a "better" practice.

The way around it is to add a line // CHECK-LABEL: <test_name> just before each test, which would cause the first CHECK-NOT to check lines before the label, and the second for the lines after the label.

But I'm on vacation in Hawaii right now, so I will do this next week. Aloha! ๐Ÿ˜„

Thank you for taking the time to comment and explain. I got it now. As well, I took the liberty to push a PR #14 that simply adds those CHECK-LABEL directives ๐Ÿ˜€.

Enjoy Hawaii ๐ŸŒด ๐Ÿ„๐Ÿปโ€โ™‚๏ธ ๐ŸŒŠ

j2kun commented

Thanks!