Repository navigation
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/149343
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit b2c8efe with merge base 790f93d ( UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Not for landing and no unit test right now. Just use this PR to collective feedback to see if this is something we want to do. cc H-Huang awgu kwen2501 wanchaol fegin wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
Not for landing and no unit test right now. Just use this PR to collective feedback to see if this is something we want to do. cc H-Huang awgu kwen2501 wanchaol fegin wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
We want to upstream the feature from new nccl for users to estimate comm time. cc H-Huang awgu kwen2501 wanchaol fegin wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
We want to upstream the feature from new nccl for users to estimate comm time. cc H-Huang awgu kwen2501 wanchaol fegin wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
|
unit test passed and now it is ready for reviewing. |
We want to upstream the feature from new nccl for users to estimate comm time. cc H-Huang awgu kwen2501 wanchaol fegin wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
| >>> # Synchronous ops | ||
| >>> with _collective_estimator() as cm: | ||
| >>> for i in range(num_colls): | ||
| >>> dist.all_reduce(tensors[i]) |
There was a problem hiding this comment.
i'm unclear about how this actually works.
when you run all_reduce inside CE context, does it actually perform the communication?
I assume it does not, because if it did then it would really be a profiler not an estimator. But its weird to hook the estimation into the real runtime APIs, which requires (1) users init a process group (it doesn't specify whether a fake PG is acceptable or real one is required), (2) users pass actual tensors in, but then these do not get correct data? Should these be fake tensors? or it doesn't matter?
There was a problem hiding this comment.
(1) is required because only with a real communicator can we do accurate estimation. The communicator internally has knowledge about the links it runs on (e.g. intra-node or inter-node, whether the links are NVLink or PCI-e or IB).
(2) is similar to CUDA Graph capturing -- in the capturing context, nothing is actually run. But yeah, we should document the expectation well.
There was a problem hiding this comment.
That said, I don't know if Inductor uses real tensor or fake tensor for scheduling, we should try to support whatever Inductor's using.
There was a problem hiding this comment.
I can add a TODO for (2) to support what inductor is using as well. Any customer from the compiler side is interested to try this tool?
| >>> # Synchronous ops | ||
| >>> with _collective_estimator() as cm: | ||
| >>> for i in range(num_colls): | ||
| >>> dist.all_reduce(tensors[i]) |
There was a problem hiding this comment.
(1) is required because only with a real communicator can we do accurate estimation. The communicator internally has knowledge about the links it runs on (e.g. intra-node or inter-node, whether the links are NVLink or PCI-e or IB).
(2) is similar to CUDA Graph capturing -- in the capturing context, nothing is actually run. But yeah, we should document the expectation well.
We want to upstream the feature from new nccl for users to estimate comm time. cc H-Huang awgu kwen2501 wanchaol fegin wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
We want to upstream the feature from new nccl for users to estimate comm time. cc H-Huang awgu kwen2501 wanchaol fegin wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
|
@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 |
…e estimation" Computation Estimation: - BaseSchedulerNode/FusedSchedulerNode: Get the generated triton code and use [do_bench](https://github.com/pytorch/pytorch/blob/85111cd165f108ffabb4a90083d59d7a867ebd9f/torch/_inductor/codegen/triton.py#L4234) mode to benchmark the runtime. - ExternKernelSchedulerNode: Realize faketensor into realtensor, and log the cuda event time. Communication Estimation: - NCCL estimation: estimate communication using NCCL's [ncclGroupSimulateEnd API](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/api/group.html?highlight=ncclsiminfo_t) from this [PR](#149343). - Profiling-based estimation: Realize faketensor into realtensor, and log the cuda event time for performing the communication. Note: By default, I use Profiling-based estimation to estimate communication. The reason is it gives better estimation performance in multi-node settings. At the end, it aggregates the estimated runtime from all ranks, and take the median runtime as the final estimated results. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov [ghstack-poisoned]
Computation Estimation: - BaseSchedulerNode/FusedSchedulerNode: Get the generated triton code and use [do_bench](https://github.com/pytorch/pytorch/blob/85111cd165f108ffabb4a90083d59d7a867ebd9f/torch/_inductor/codegen/triton.py#L4234) mode to benchmark the runtime. - ExternKernelSchedulerNode: Realize faketensor into realtensor, and log the cuda event time. Communication Estimation: - NCCL estimation: estimate communication using NCCL's [ncclGroupSimulateEnd API](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/api/group.html?highlight=ncclsiminfo_t) from this [PR](#149343). - Profiling-based estimation: Realize faketensor into realtensor, and log the cuda event time for performing the communication. Note: By default, I use Profiling-based estimation to estimate communication. The reason is it gives better estimation performance in multi-node settings. At the end, it aggregates the estimated runtime from all ranks, and take the median runtime as the final estimated results. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov [ghstack-poisoned]
Stack from ghstack (oldest at bottom):
We want to upstream the feature from new nccl for users to estimate comm time.
Resolves #147753
cc @H-Huang @awgu @kwen2501 @wanchaol @fegin @wz337 @wconstab @d4l3k @c-p-i-o