-
-
Notifications
You must be signed in to change notification settings - Fork 11k
[Attention] Implement universal BACKEND_MAP #25900
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
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.
Code Review
This pull request refactors the attention backend selection mechanism by introducing a centralized registry. Backends now register themselves using a decorator, which is a significant improvement in modularity and removes hardcoded mappings. The changes are extensive and touch many files, mostly for updating imports and applying the new registration decorator.
The core logic is sound, but I've identified one high-severity issue related to testing on ROCm. The refactoring removed a platform-specific hack from a test utility without updating the tests that relied on it. This will lead to tests being skipped on ROCm, reducing test coverage for that platform. My review comment provides details on this issue.
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
20a75cb to
55ad364
Compare
|
cc @ILikeIneine this has the registration mechanism you proposed in #24794! |
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
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.
LGTM , thanks @MatthewBonanni !
Left a few minor comments, also please check with AMD folks if the backend renaming is fine (just to be on the safe side).
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
|
@NickLucche Thanks for your review! I've addressed your comments. |
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
… to selection. Leave decorator to enable out-of-tree backend plugins Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
| } | ||
|
|
||
|
|
||
| def register_attn_backend(backend: _Backend, class_path: Optional[str] = None): |
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.
How does this work for OOT backends, wouldn't they have to extend the _Backend enum?
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.
The plan is for them to override an existing backend (see #24794 (comment)). We could extend this in the future (and find an alternative to the enum) to make it cleaner though.
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com> Signed-off-by: xuebwang-amd <xuebwang@amd.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com> Signed-off-by: Dhruvil Bhatt <bhattdbh@amazon.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com> Signed-off-by: xuebwang-amd <xuebwang@amd.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com> Signed-off-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com> Signed-off-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>
Purpose
This PR continues the attention backend selection refactor #24794, which is now being split up. Here, we allow backends to register themselves in a
BACKEND_MAPwhich will be used later in the refactor. This also enables out-of-tree backends for other hardware to plug in neatly.Test Plan
CI should be sufficient
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.