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
[MPS] Introduce torch.mps.Event() APIs #102121
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/102121
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 49fb3f6: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
944f2df
to
a870c7e
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.
Sorry for the delay in reviewing this.
The change sounds ok (I didn't check the mm implementation in detail as I assume this has already been reviewed in details).
I would say that the id-based binding is not the nicest though for two reasons: you have to __del__
which have some caveats, the lifetime of the different objects are not hard-linked opening to bugs in having one dying earlier than the other and the binding code is not very easy to read.
If you plan on upgrading this, I would suggest to using pybind to directly bind the class via pybind like
pytorch/torch/csrc/utils/init.cpp
Line 14 in 18dacf7
py::class_<BenchmarkConfig>(m, "BenchmarkConfig") |
- Implement MPSEventPool to recycle events and hook it into MPSAllocator - Implement python bindings with torch.mps.Event class using the MPSEventPool backend. The current member functions of the Event class are, record(), wait(), synchronize() and query() - Add API to measure elapsed time between two event recordings - Added test case to test_mps.py - Replace PyLong_From with THPUtils_packUInt() to avoid overflow errors
a870c7e
to
364c20d
Compare
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
- Implement `MPSEventPool` to recycle events. - Implement python bindings with `torch.mps.Event` class using the MPSEventPool backend. The current member functions of the Event class are `record()`, `wait()`, `synchronize()`, `query()`, and `elapsed_time()`. - Add API to measure elapsed time between two event recordings. - Added documentation for Event class to `mps.rst`. - Added test case to `test_mps.py`. Pull Request resolved: pytorch#102121 Approved by: https://github.com/albanD, https://github.com/kulinseth
MPSEventPool
to recycle events.torch.mps.Event
class using the MPSEventPool backend. The current member functions of the Event class arerecord()
,wait()
,synchronize()
,query()
, andelapsed_time()
.mps.rst
.test_mps.py
.