Skip to content

Commit

Permalink
[ci] xfail failing ethosu codegen tests
Browse files Browse the repository at this point in the history
This adds a testing utility so we can mark parameter combinations as
xfail without having to manually match each parameter from the name into
the code. The param strings here come directly from CI logs as in
https://ci.tlcpack.ai/blue/organizations/jenkins/tvm/detail/PR-12389/5/pipeline
  • Loading branch information
driazati committed Aug 20, 2022
1 parent 8b3401c commit 734517e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
24 changes: 24 additions & 0 deletions python/tvm/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1705,6 +1705,30 @@ def fetch_model_from_url(
return tvmc_model.mod, tvmc_model.params


def xfail_parameterizations(*xfail_params, reason):
"""
Mark tests with a nodeid parameters that exactly matches one in params as
xfail. Useful for quickly marking tests as xfail when they have a large
combination of parameters.
"""
xfail_params = set(xfail_params)

def decorator(func):
@functools.wraps(func)
def wrapper(request, *args, **kwargs):
if "[" in request.node.name and "]" in request.node.name:
# Strip out the test name and the [ and ] brackets
params_from_name = request.node.name[len(request.node.originalname) + 1 : -1]
if params_from_name in xfail_params:
pytest.xfail(reason=f"xfail on nodeid {request.node.nodeid}: " + reason)

return func(request, *args, **kwargs)

return wrapper

return decorator


def main():
test_file = inspect.getsourcefile(sys._getframe(1))
sys.exit(pytest.main([test_file] + sys.argv[1:]))
Expand Down
20 changes: 18 additions & 2 deletions tests/python/contrib/test_ethosu/test_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,11 @@ def binary_elementwise(lhs, rhs):
([1, 4, 4], [4, 1]),
],
)
@tvm.testing.xfail_parameterizations(
"ifm_shape0-ifm2_shape0-ethos-u55-64", reason="See https://github.com/apache/tvm/issues/12511"
)
def test_binary_add_with_non_4d_shapes(
request,
accel_type,
ifm_shape,
ifm2_shape,
Expand Down Expand Up @@ -604,7 +608,12 @@ def rounding_right_shift(lhs, rhs):
@pytest.mark.parametrize("accel_type", ACCEL_TYPES)
@pytest.mark.parametrize("ifm_shape", [(3, 2), (1, 15, 11, 7), (3, 1, 12), (400,)])
@pytest.mark.parametrize("ifm_scale, ifm_zp, ofm_scale, ofm_zp", [(1, 0, 1, 0), (0.015, 3, 0.2, 5)])
def test_ethosu_identity_codegen(ifm_shape, ifm_scale, ifm_zp, ofm_scale, ofm_zp, accel_type):
@tvm.testing.xfail_parameterizations(
"1-0-1-0-ifm_shape3-ethos-u55-128", reason="See https://github.com/apache/tvm/issues/12511"
)
def test_ethosu_identity_codegen(
request, ifm_shape, ifm_scale, ifm_zp, ofm_scale, ofm_zp, accel_type
):
np.random.seed(0)

def create_model():
Expand Down Expand Up @@ -682,7 +691,10 @@ def create_model():
([5000], [123], [2151]),
],
)
def test_tflite_slice(accel_type, ifm_shape, begin, size):
@tvm.testing.xfail_parameterizations(
"ifm_shape3-begin3-size3-ethos-u55-32", reason="See https://github.com/apache/tvm/issues/12511"
)
def test_tflite_slice(request, accel_type, ifm_shape, begin, size):
np.random.seed(0)

@tf.function
Expand Down Expand Up @@ -717,7 +729,11 @@ def strided_slice_func(x):
"ifm_shape",
[[1, 5, 12, 4], [1, 1, 2], [4, 3, 2], [10, 20], [345]],
)
@tvm.testing.xfail_parameterizations(
"ifm_shape4-ABS-ethos-u55-64", reason="See https://github.com/apache/tvm/issues/12511"
)
def test_ethosu_unary_elementwise(
request,
accel_type,
operator_type,
ifm_shape,
Expand Down

0 comments on commit 734517e

Please sign in to comment.