⚡ Bolt: Optimize rebuild_padding with lazy platform resolution#6498
⚡ Bolt: Optimize rebuild_padding with lazy platform resolution#6498
Conversation
Co-authored-by: ZeyuChen <1371212+ZeyuChen@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
|
Co-authored-by: ZeyuChen <1371212+ZeyuChen@users.noreply.github.com>
Co-authored-by: ZeyuChen <1371212+ZeyuChen@users.noreply.github.com>
Co-authored-by: ZeyuChen <1371212+ZeyuChen@users.noreply.github.com>
Co-authored-by: ZeyuChen <1371212+ZeyuChen@users.noreply.github.com>
Co-authored-by: ZeyuChen <1371212+ZeyuChen@users.noreply.github.com>
Motivation
The
rebuild_paddingfunction infastdeploy/model_executor/pre_and_post_process.pyis called frequently during model execution. The original implementation checkedcurrent_platform.is_*()and performed local imports on every call, adding unnecessary overhead.Modifications
rebuild_paddingto resolve the platform-specific implementation once (lazy initialization) and cache it in a module-level global variable_rebuild_padding_impl.Usage or Command
No changes to usage or commands. The optimization is internal.
Accuracy Tests
tests/test_rebuild_padding_mock.py- deleted after verification) which confirmed that the platform check is performed only once per process lifetime.Checklist
PR created automatically by Jules for task 15703239940177532441 started by @ZeyuChen