-
Notifications
You must be signed in to change notification settings - Fork 516
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
Propagate device data names #1157
Propagate device data names #1157
Conversation
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.
can you add a test for this?
876ec6e
to
4ba4a1a
Compare
I'm not sure I understand what the test is testing. It seems to call the API but I don't see it checking the result. |
There's unfortunately no good way to check the result. I originally checked that the number of inputs was greater than zero, but this is not true for all ops apparently and thus some ops fail that check. I also tried saving the input names and checking them against the values that are set, but this also doesn't work as multiple tests are run in parallel and thus there is a race condition in the storage and retrieval of this value. As such, I decided to only add it as a spot check. Especially considering that this is not something that is needed for all lazy backends (for example, the TorchScript backend has no use for this). I figured its fine to just print the number of inputs in the reference lazy backend so that we can do a visible check of the output to verify that its working as intended. @silvasean please let me know if my reasoning for this is sufficient |
76dad5d
to
b48684d
Compare
@silvasean Gentle reminder to please review again |
Sorry, I've been OoO. What I meant to say is that I see I would recommend that you add unit tests like we did with the "eager mode" here: https://github.com/llvm/torch-mlir/tree/main/python/test/eager_mode I'm imagining a 3 line test where you call |
There is no concrete check. I only meant for it to be a "check by inspection". Its not required by all backends and I thought it was sufficient to be able to see it in the test logs.
The problem with doing this is that the tests are run in parallel in the same process. This causes race conditions as there is only a single instance of the static lazy tensor C++ symbols.
This is what I was hoping to add as well, but with the current test infrastructure, unless I'm mistaken, I don't think this is possible due to the reasons I listed above. |
09a605f
to
4ae1f0b
Compare
4ae1f0b
to
545b776
Compare
@silvasean I've added some unit tests. Please review again when you get a chance |
Need to propagate device data names in order to be able to distinguish between inputs and weights.
An example of its intended usage has been added to the reference backend. The idea is to assign names to tensors on the python side (e.g. perhaps in the dataloader) so that you know which tensors are which in the actual compile
Also, export remaining headers that weren't exported before.
CC: @ke1337 @henrytwo