Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup Hexagon conv2d tests #9473

Merged
merged 9 commits into from
Nov 18, 2021
Merged

Conversation

adstraw
Copy link
Contributor

@adstraw adstraw commented Nov 8, 2021

Deletes unnecessary cases from the test_conv2d_blocked.py including cases covering logical oihw filter and packed nhw8h8wc packed input layouts. Moved quite a lot of shared code to the infrastructure file reducing maintenance costs. And, some other general cleanup items --- comments, variable names, etc.

@adstraw
Copy link
Contributor Author

adstraw commented Nov 8, 2021

@csullivan and @cconvey please review

Comment on lines 21 to 37
import tvm
from .infrastructure import get_packed_filter_layout


@tvm.testing.fixture
def shape_nhwc(batch, in_channel, in_size):
return (batch, in_size, in_size, in_channel)


@tvm.testing.fixture
def shape_oihw(out_channel, in_channel, kernel):
return (out_channel, in_channel, kernel, kernel)


@tvm.testing.fixture
def shape_oihw8i32o4i(out_channel, in_channel, kernel):
return get_packed_filter_layout(out_channel, in_channel, kernel, kernel)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal being to check to see if the testing fixtures are the source of the i386 flakiness?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the fixtures because of their effect in terms of the ordering of parameters on the pytest command lines which I personally find confusing. I just realized, though, that the maxpool test in this same directory relies on these fixtures so I either need to remove that dependence or add back these fixtures.

shape.extend(block_shape)
else:
shape.extend([off_h, off_w, shape_nhwc[3]])
shape.append(ceildiv(shape_nhwc[3], off_c))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this code we handle ceildiv as-is, but in the get_packed_filter_shape function (below) we cast its result to a Python int type.

Is there a good reason for doing it two different ways?

Specifically: casting to int works when the runtime return type of ceildiv is tvm.tir.expr.IntImm. But I'm wondering if we're okay with this test making that assumption. I.e., are we testing everything we intend to test when we assume that the exact shapes are known at this point in time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, casting to int is a means of converting from tvm.tir.expr.IntImm to int. I am not sure why it works differently for get_packed_shape (no cast) vs. get_packed_filter_shape (requires cast). Also not sure about your question RE knowing exact shapes. More investigation required.

NOTE: I did change get_packed_filter_shape to take a shape instead of a list of dimensions to match the API of get_packed_shape.

@adstraw adstraw force-pushed the hexagon-conv2d-cleanup branch from 9a4c73f to 3be018b Compare November 17, 2021 15:57
Copy link
Contributor

@csullivan csullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@tmoreau89 tmoreau89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tmoreau89 tmoreau89 merged commit e276929 into apache:main Nov 18, 2021
@tmoreau89
Copy link
Contributor

Thank you @adstraw @cconvey @csullivan ; the PR has been merged!

@adstraw adstraw deleted the hexagon-conv2d-cleanup branch November 19, 2021 01:18
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Dec 1, 2021
* cleanup Hexagon conv2d tests

* add back fixtures; skip tests only on i386

* fix pylint error

* fix maxpool failures

* fix `skipif` statement and verify error + code review feedback

* fix typo "physical_physical"

* retrigger ci

* determining i386 processor string from CI

* hopefully the correct test disable
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Dec 1, 2021
* cleanup Hexagon conv2d tests

* add back fixtures; skip tests only on i386

* fix pylint error

* fix maxpool failures

* fix `skipif` statement and verify error + code review feedback

* fix typo "physical_physical"

* retrigger ci

* determining i386 processor string from CI

* hopefully the correct test disable
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* cleanup Hexagon conv2d tests

* add back fixtures; skip tests only on i386

* fix pylint error

* fix maxpool failures

* fix `skipif` statement and verify error + code review feedback

* fix typo "physical_physical"

* retrigger ci

* determining i386 processor string from CI

* hopefully the correct test disable
yangulei pushed a commit to yangulei/tvm that referenced this pull request Jan 11, 2022
* cleanup Hexagon conv2d tests

* add back fixtures; skip tests only on i386

* fix pylint error

* fix maxpool failures

* fix `skipif` statement and verify error + code review feedback

* fix typo "physical_physical"

* retrigger ci

* determining i386 processor string from CI

* hopefully the correct test disable
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* cleanup Hexagon conv2d tests

* add back fixtures; skip tests only on i386

* fix pylint error

* fix maxpool failures

* fix `skipif` statement and verify error + code review feedback

* fix typo "physical_physical"

* retrigger ci

* determining i386 processor string from CI

* hopefully the correct test disable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants