-
Notifications
You must be signed in to change notification settings - Fork 80
[Host IR] Allocation cache #4466
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,34 +143,56 @@ If the distributed tensor is replicated on that parallel type, returns -1. | |
| } | ||
|
|
||
| void bindMultiDeviceExecutor(py::module& nvfuser) { | ||
| // Bind params type under the multidevice submodule. We'll alias it to the | ||
| // top-level module in bindMultiDevice to allow direct imports. | ||
| py::class_<MultiDeviceExecutorParams>(nvfuser, "MultiDeviceExecutorParams") | ||
| .def(py::init<>()) | ||
| .def_property( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know how to use that with nested structures. Otherwise I can also change the behavior and let the use "readwrite" the whole params and not only those two knobs: |
||
| "use_allocation_cache", | ||
| [](const MultiDeviceExecutorParams& self) { | ||
| return self.executor.use_allocation_cache; | ||
| }, | ||
| [](MultiDeviceExecutorParams& self, bool value) { | ||
| self.executor.use_allocation_cache = value; | ||
| }) | ||
| .def_property( | ||
| "backend_type", | ||
| [](const MultiDeviceExecutorParams& self) { | ||
| return self.lower.communicator_backend; | ||
| }, | ||
| [](MultiDeviceExecutorParams& self, CommunicatorBackend value) { | ||
| self.lower.communicator_backend = value; | ||
| }); | ||
|
|
||
| py::class_<MultiDeviceExecutor> multi_device_executor( | ||
| nvfuser, "MultiDeviceExecutor"); | ||
| multi_device_executor.def( | ||
| py::init([](const Fusion& fusion, CommunicatorBackend backend) { | ||
| MultiDeviceExecutorParams params; | ||
| params.lower.communicator_backend = backend; | ||
| return std::make_unique<MultiDeviceExecutor>( | ||
| std::make_unique<Fusion>(fusion), | ||
| Communicator::getInstance(), | ||
| std::move(params)); | ||
| }), | ||
| py::init( | ||
| [](const Fusion& fusion, const MultiDeviceExecutorParams& params) { | ||
| return std::make_unique<MultiDeviceExecutor>( | ||
| std::make_unique<Fusion>(fusion), | ||
| Communicator::getInstance(), | ||
| params); | ||
| }), | ||
| R"( | ||
| Create a new MultiDeviceExecutor. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| fusion : Fusion | ||
| The fusion to be executed. | ||
| backend : CommunicatorBackend | ||
| The backend to be used for the communicator. | ||
| params : MultiDeviceExecutorParams | ||
| Parameters configuring the executor and communicator backend. | ||
|
|
||
| Examples | ||
| -------- | ||
| >>> multi_device_executor = MultiDeviceExecutor(fusion, CommunicatorBackend.nccl) | ||
| >>> params = MultiDeviceExecutorParams() | ||
| >>> params.backend_type = CommunicatorBackend.nccl | ||
| >>> multi_device_executor = MultiDeviceExecutor(fusion, params) | ||
| >>> outputs = multi_device_executor.run(inputs) | ||
| )", | ||
| py::arg("fusion"), | ||
| py::arg("backend")); | ||
| py::arg("params")); | ||
| multi_device_executor.def( | ||
| "__str__", | ||
| [](MultiDeviceExecutor& self) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.