Skip to content

vello_gpu: reuse staging belt for strips upload - #1915

Open
HigherOrderLogic wants to merge 2 commits into
linebender:mainfrom
HigherOrderLogic:gpu/staging
Open

HigherOrderLogic wants to merge 2 commits into
linebender:mainfrom
HigherOrderLogic:gpu/staging

Conversation

@HigherOrderLogic

Copy link
Copy Markdown
Contributor

Clear more TODO.

This remove the queue allocation and use an arena-like staging belt instead.

@LaurenzV

Copy link
Copy Markdown
Collaborator

Ah, sorry, I forgot to mention that there was a reason why we haven't used the wgpu-native staging belt, see this PR: #1532

Or does this problem not exist in this implementation?

@HigherOrderLogic

Copy link
Copy Markdown
Contributor Author

Or does this problem not exist in this implementation?

I think it should eliminate the overlapped memory problem, since the old belt is dropped every time a new one is created. However, there would still be overlapped memory spike, for example when frames are submitted too fast, but this should only last for a short duration.

@LaurenzV

LaurenzV commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

@taj-p What do you think of the current impl? We've changed it now so that we precalculate how many bytes we need, set this as the chunk size and recreate the whole staging belt whenever we have to grow. I've checked the profiler and it results in the same speedup! But not sure if you have better ideas, as it's kind of ugly and brittle to estimate how much space we are going to need. But maybe it's the best option for now.

@LaurenzV
LaurenzV requested a review from taj-p October 7, 2026 13:10
@HigherOrderLogic

Copy link
Copy Markdown
Contributor Author

Cant you keep track of how many bytes allocated through a prop inside the StagingBelt wrapper struct? Should be kinda similar to an arena I think.

@LaurenzV

LaurenzV commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

I mean yeah, but the problem is we need to know it ahead of time before we start doing the allocations, right?

@HigherOrderLogic

Copy link
Copy Markdown
Contributor Author

we need to know it ahead of time before we start doing the allocations, right?

Hmm yeah, that should help with preventing the degenerate case mentioned in the OG PR. However, our StagingBelt is discarded and recreated when size grow so it should be fine I think.

But I havent tested it out yet so let's go with your approach for now.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants