-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Parameterize test_link_params #9276
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
Conversation
64639b9
to
8128067
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty cool, didn't realise we had this!
linkable_dtype = tvm.testing.parameter( | ||
*( | ||
[f"uint{b}" for b in (8, 16, 32, 64)] | ||
+ [f"int{b}" for b in (8, 16, 32, 64)] | ||
+ ["float32", "float64"] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can do this a tiny bit neater?
linkable_dtype = tvm.testing.parameter( | |
*( | |
[f"uint{b}" for b in (8, 16, 32, 64)] | |
+ [f"int{b}" for b in (8, 16, 32, 64)] | |
+ ["float32", "float64"] | |
) | |
linkable_dtype = tvm.testing.parameter( | |
*[f"uint{b}" for b in (8, 16, 32, 64)], | |
*[f"int{b}" for b in (8, 16, 32, 64)], | |
"float32", "float64" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just had a couple small questions on it.
|
||
# NOTE: Need to export_library() and load_library() to link all the Module(llvm, ...) | ||
# against one another. | ||
temp_dir = tempfile.mkdtemp() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't related to the current PR, but do you know why tempfile.mkdtemp
is used instead of tempfile.TemporaryDirectory
? The mkdtemp
requires manual cleanup which doesn't seem to be done here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed this one
else: | ||
np.testing.assert_allclose(unlinked_output.numpy(), linked_output.numpy()) | ||
def test_llvm_link_params(linkable_dtype): | ||
ir_mod, param_init = _make_mod_and_params(linkable_dtype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that linkable_dtype
is a parameter, we can change _make_mod_and_params
from a function to a fixture. This would let pytest make a distinction between setup errors in the module setup due to tvm.parser
, and test errors in the linking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd like to address this one, but i'm a little short on time right now. hopefully we can merge this in the spirit of incremental progress and address later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, and agreed.
It has been a while since this PR was updated, @Lunderberg @Mousius @Lunderberg please leave a review or address the outstanding comments |
8128067
to
f5a85c2
Compare
@Lunderberg I sync'd this one up, PTAL when you get a chance. |
f5a85c2
to
f6d3494
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
else: | ||
np.testing.assert_allclose(unlinked_output.numpy(), linked_output.numpy()) | ||
def test_llvm_link_params(linkable_dtype): | ||
ir_mod, param_init = _make_mod_and_params(linkable_dtype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, and agreed.
Cleaning up test_link_params to support the new parameterized testing.
cc @Lunderberg