-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add getter and setter methods for compile_backend across accelerators. #5299
Add getter and setter methods for compile_backend across accelerators. #5299
Conversation
…ks in compile tests.
Hi @loadams , Added support for retrieving the preferred compile backend from the accelerator. However, I'm unsure about the preferred backend for each accelerator. Therefore, I've set the default to 'inductor'. Could you please review this? |
@vshekhawat-hlab, thanks for adding this API. I think it is a great start to addressing generalization issue raised by @delock. However, there is a bit more work required to make this consistent with DeepSpeed/deepspeed/runtime/compiler.py Line 56 in 3dd3d51
Also, I think there are few questions that need resolving. I will post them below as separate comment to reduce clutter. |
Since users can specify compile_backend (string or Callable) through either ds_config or set_backend(), which value takes precedence between user specification and preferred/default backend in accelerator class? I think user specification should have higher precedence. |
Assuming user specification has higher precedence, how can users select the accelerator preferred backend without having to read the code? I see two options:
|
What is the expected behavior if user specifies backend that is not supported by accelerator? I see three options:
|
@delock, @tohtana, @umchand, @vshekhawat-hlab, @loadams, I will appreciate your thoughts on the above questions. Thanks! |
Thanks @tjruwase for review. My views on above: Updated get_compile_backend, let me know your views on this.
` |
I agree on this, I think the best option if the user specifies a backend that is not supported is to fail immediately with a meaningful error message. And I think having it be implicit except if they override in ds_config or via |
Agree that if user explicitly specifiy backend then should fail immedately. Also leaving |
Refactored the get_compile_backend method to handle user backend selection more efficiently. If no backend is specified, it now defaults to accelerator preferred backend. Additionally, improved error handling for unsupported backends by providing informative error messages.
Thanks @vshekhawat-hlab, we will work on reviewing this. |
@vshekhawat-hlab, apologies for the delay. Based on all the feedback, the main change needed in my mind is to split into a
@vshekhawat-hlab, @tohtana, @umchand, @delock, @loadams, I will appreciate your thoughts on the above. |
I like that approach, I think it makes the most sense to match existing APIs and provide default behavior and a normal way to override it. |
Hi @tjruwase, Agree with comment. Couple of questions:
Code snippet with get and set API.
|
Yes, it makes sense to reject |
@vshekhawat-hlab, the proposed snippet looks good to me. I suspect that individual accelerators might later apply optimizations such as caching the |
Updated the PR as discussed. Please review. |
microsoft#5299) Add getter and setter methods for `compile_backend` across accelerators, which provide a mechanism to retrieve the compile backend. These APIs handle user-defined backend selection and raise a `ValueError` with informative error messages for unsupported backends. --------- Co-authored-by: Olatunji Ruwase <[email protected]> Co-authored-by: Logan Adams <[email protected]>
microsoft#5299) Add getter and setter methods for `compile_backend` across accelerators, which provide a mechanism to retrieve the compile backend. These APIs handle user-defined backend selection and raise a `ValueError` with informative error messages for unsupported backends. --------- Co-authored-by: Olatunji Ruwase <[email protected]> Co-authored-by: Logan Adams <[email protected]>
Add getter and setter methods for
compile_backend
across accelerators, which provide a mechanism to retrieve the compile backend. These APIs handle user-defined backend selection and raise aValueError
with informative error messages for unsupported backends.