Mousius commented on code in PR #12416: URL: https://github.com/apache/tvm/pull/12416#discussion_r945602802
########## tests/python/relay/test_build_module.py: ########## @@ -22,48 +22,23 @@ from tvm import relay from tvm.target.target import Target from tvm.relay.backend import Runtime, Executor, graph_executor_codegen -from tvm.relay.build_module import _reconstruct_from_deprecated_options [email protected]( - "target,executor,runtime", - [ - [Target("c"), None, None], - [Target("c -runtime=c"), None, Runtime("crt")], - [Target("c -system-lib"), None, Runtime("cpp", {"system-lib": True})], - [Target("c -runtime=c -system-lib"), None, Runtime("crt", {"system-lib": True})], - [Target("c -executor=aot"), Executor("aot"), None], - [ - Target("c -executor=aot -interface-api=c"), - Executor("aot", {"interface-api": "c"}), - None, - ], - [ - Target("c -executor=aot -unpacked-api=1"), - Executor("aot", {"unpacked-api": 1}), - None, - ], - [Target("c -executor=aot -link-params=1"), Executor("aot"), None], - [Target("c -link-params=1"), Executor("graph", {"link-params": 1}), None], - [ - Target( - "c -executor=aot -link-params=1 -interface-api=c" - " -unpacked-api=1 -runtime=c -system-lib" - ), - Executor("aot", {"unpacked-api": 1, "interface-api": "c"}), - Runtime("crt", {"system-lib": True}), - ], - ], +test_target = tvm.testing.parameter( + "c -runtime=c", + "c -system-lib", + "c -executor=aot", + "c -interface-api=c", + "c -unpacked-api=1", + "c -link-params=1", ) -def test_deprecated_target_parameters(target, executor, runtime): - actual_executor, actual_runtime = _reconstruct_from_deprecated_options(target) - assert (executor is None and actual_executor is None) or (executor.name == actual_executor.name) - # sort as TVM Map cannot guarantee round-trip order. - assert (executor is None and actual_executor is None) or ( - sorted(executor.attrs.items()) == sorted(actual_executor.attrs.items()) - ) - assert runtime == actual_runtime + +def test_deprecated_target_parameters(test_target, target): + unsupported_config = test_target.split(" ")[1].replace("=", " ").split(" ")[0][1:] Review Comment: This is pretty complex, would be better to have `test_target` and `unsupported_config` in a tuple. ########## tests/python/relay/test_build_module.py: ########## @@ -22,48 +22,23 @@ from tvm import relay from tvm.target.target import Target from tvm.relay.backend import Runtime, Executor, graph_executor_codegen -from tvm.relay.build_module import _reconstruct_from_deprecated_options [email protected]( - "target,executor,runtime", - [ - [Target("c"), None, None], - [Target("c -runtime=c"), None, Runtime("crt")], - [Target("c -system-lib"), None, Runtime("cpp", {"system-lib": True})], - [Target("c -runtime=c -system-lib"), None, Runtime("crt", {"system-lib": True})], - [Target("c -executor=aot"), Executor("aot"), None], - [ - Target("c -executor=aot -interface-api=c"), - Executor("aot", {"interface-api": "c"}), - None, - ], - [ - Target("c -executor=aot -unpacked-api=1"), - Executor("aot", {"unpacked-api": 1}), - None, - ], - [Target("c -executor=aot -link-params=1"), Executor("aot"), None], - [Target("c -link-params=1"), Executor("graph", {"link-params": 1}), None], - [ - Target( - "c -executor=aot -link-params=1 -interface-api=c" - " -unpacked-api=1 -runtime=c -system-lib" - ), - Executor("aot", {"unpacked-api": 1, "interface-api": "c"}), - Runtime("crt", {"system-lib": True}), - ], - ], +test_target = tvm.testing.parameter( Review Comment: We should probably keep using `pytest.mark.parametrize` to aid in linting this file. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
