memory: bound dense 1024 decode and host postprocess allocations - #46
Open
danthemighty316-jpg wants to merge 1 commit into
Open
memory: bound dense 1024 decode and host postprocess allocations#46danthemighty316-jpg wants to merge 1 commit into
danthemighty316-jpg wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This patch addresses several memory-scaling failures encountered during dense 1024 shape generation on a 16 GB GPU.
The goal is to bound peak allocations in sparse decode, DiT/shape decoding, subdivision, and host-side mesh postprocessing without reducing generation resolution, imposing a token cap, or disabling postprocessing stages.
Changes
C2S sparse convolution
The existing chunked C2S path could still retain/upload the full sparse input feature table for each chunk.
This patch makes the working set more local by:
DiT
Large FlashAttention padding-mask/query handling could produce a very large allocation at high token counts.
The affected work is chunked so the full allocation is no longer required at once.
Shape decoder / ConvNeXt
Large sparse ConvNeXt stages are streamed in chunks rather than processing the entire stage as one large allocation.
C2S subdivision
to_subdivcontained another full[Cin, N]F32 pre-pass which became the next memory wall after the earlier C2S changes.This path is now chunked and its 8-channel output is stitched on the host.
Host mesh postprocessing
A dense decode can produce a very large intermediate mesh, exposing host-side allocation pressure after GPU decode succeeds.
Changes include:
fill_small_holesno longer keeps multiple giant full-mesh edge maps alive simultaneously2 * FValidation
The patch was originally developed and runtime-tested from commit
16f3109.A former DiT allocation failure case reached:
A former host-side
bad allocationreproducer reached approximately:It then completed:
That generation completed in approximately 3718 seconds.
A subsequent continuous 1024/xatlas soak completed 18 consecutive server generations with:
bad allocationTest hardware
Current upstream
The tested patch was preserved separately and then cherry-picked onto current
mainat2516c48.The cherry-pick applied without conflicts and the resulting branch builds successfully with the Vulkan backend.
The full runtime soak above was performed on the original
16f3109base; the2516c48integration has currently been compile-tested rather than having the full soak repeated.Caveat
I previously encountered an AMD display-driver TDR/BSOD during separate heavy testing. No BSOD occurred during the captured 18-generation soak, but I am treating the driver-level issue as separate and am not claiming this patch resolves it.
I'm happy to split this into smaller changes if that would make review easier.