Skip to content

[webgpu] Use LazyRelease for prepack allocator#27077

Merged
fs-eire merged 5 commits intomainfrom
fix_prepack
Jan 24, 2026
Merged

[webgpu] Use LazyRelease for prepack allocator#27077
fs-eire merged 5 commits intomainfrom
fix_prepack

Conversation

@qjia7
Copy link
Contributor

@qjia7 qjia7 commented Jan 20, 2026

BUG #27068

@fs-eire
Copy link
Contributor

fs-eire commented Jan 20, 2026

thank you for the fix. I have a question: should we call context.Flush() after each prepack (or after the initialization?)

@qjia7
Copy link
Contributor Author

qjia7 commented Jan 21, 2026

thank you for the fix. I have a question: should we call context.Flush() after each prepack (or after the initialization?)

Good point. I definitely don't want to call context.Flush() after the initialization which is not good for memory. To not impact the original initializer, I add a new one specific for prepack which will follow the normal buffer manager to flush when pending patches reach to max_num_pending_dispatches_. What do you think?

@qjia7
Copy link
Contributor Author

qjia7 commented Jan 21, 2026

thank you for the fix. I have a question: should we call context.Flush() after each prepack (or after the initialization?)

Good point. I definitely don't want to call context.Flush() after the initialization which is not good for memory. To not impact the original initializer, I add a new one specific for prepack which will follow the normal buffer manager to flush when pending patches reach to max_num_pending_dispatches_. What do you think?

Sorry—this approach may still have issues. With this change, I can’t properly control the release of the original weights. I’ll think through this more carefully and send an updated proposal. Thanks.

@qjia7
Copy link
Contributor Author

qjia7 commented Jan 21, 2026

thank you for the fix. I have a question: should we call context.Flush() after each prepack (or after the initialization?)

Good point. I definitely don't want to call context.Flush() after the initialization which is not good for memory. To not impact the original initializer, I add a new one specific for prepack which will follow the normal buffer manager to flush when pending patches reach to max_num_pending_dispatches_. What do you think?

Sorry—this approach may still have issues. With this change, I can’t properly control the release of the original weights. I’ll think through this more carefully and send an updated proposal. Thanks.

Restore to the original one with LazyRelease plus flush after each prepack.

@xhcao
Copy link
Contributor

xhcao commented Jan 21, 2026

With this PR, the issue #27068 cannot been reproduced again. Thanks.

@qjia7 qjia7 requested a review from fs-eire January 21, 2026 06:20
fs-eire
fs-eire previously approved these changes Jan 22, 2026
@qjia7 qjia7 requested a review from fs-eire January 22, 2026 09:10
@guschmue guschmue added the ep:WebGPU ort-web webgpu provider label Jan 22, 2026
@fs-eire fs-eire merged commit ca0cd21 into main Jan 24, 2026
90 checks passed
@fs-eire fs-eire deleted the fix_prepack branch January 24, 2026 00:28
tianleiwu pushed a commit that referenced this pull request Feb 12, 2026
tianleiwu added a commit that referenced this pull request Feb 13, 2026
This cherry-picks the following commits for the 1.24.2 release:
- #27096
- #27077
- #26677
- #27238
- #27213
- #27256
- #27278
- #27275
- #27276
- #27216
- #27271
- #27299
- #27294
- #27266
- #27176
- #27126
- #27252

---------

Co-authored-by: Xiaofei Han <[email protected]>
Co-authored-by: Jiajia Qin <[email protected]>
Co-authored-by: Yulong Wang <[email protected]>
Co-authored-by: qti-monumeen <[email protected]>
Co-authored-by: Ankit Maheshkar <[email protected]>
Co-authored-by: Eric Crawford <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: guschmue <[email protected]>
Co-authored-by: Guenther Schmuelling <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: angelser <[email protected]>
Co-authored-by: Angela Serrano Brummett <[email protected]>
Co-authored-by: Misha Chornyi <[email protected]>
Co-authored-by: hariharans29 <[email protected]>
Co-authored-by: eserscor <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Baiju Meswani <[email protected]>
Co-authored-by: Adrian Lizarraga <[email protected]>
Co-authored-by: Ti-Tai Wang <[email protected]>
Co-authored-by: bmehta001 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ep:WebGPU ort-web webgpu provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants