Skip to content

Add budget-aware Vulkan memory policies - #15

Merged
antono3 merged 2 commits into
masterfrom
feature/budget-aware-allocation
Sep 12, 2026
Merged

Add budget-aware Vulkan memory policies#15
antono3 merged 2 commits into
masterfrom
feature/budget-aware-allocation

Conversation

@antono3

@antono3 antono3 commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add deterministic, explainable memory-type policies for GPU-only, upload, readback, and automatic usage
  • add optional VK_EXT_memory_budget discovery, refresh, strict/preferred budget behavior, and heap diagnostics
  • retry allocations after cached-block reclamation and fall through to compatible memory types on allocation pressure
  • add non-coherent flush/invalidate helpers aligned to nonCoherentAtomSize
  • add policy-based buffer, image, raw-allocation, and upload-ring APIs while preserving every existing MemType API
  • document the higher-level policy/planning/Vulkan-ownership model and the conservative dedicated-image rule
  • pin the authoritative CI compiler to V 0.5.2 and add ASan/UBSan coverage

Compatibility

Existing allocate, create_buffer, create_dedicated_buffer, create_image, and new_upload_ring behavior remains available. The new API is additive. antono2.memory remains the small CPU-only planning layer; Vulkan-specific policy stays in this repository.

Validation

  • v fmt -verify .
  • v vet block_pool.v block_pool_test.v mapped_memory.v mapped_memory_test.v memory_policy.v memory_policy_test.v upload_ring.v upload_ring_test.v vulkan_memory_allocator.v vulkan_memory_allocator_test.v
  • v test . (5/5)
  • full ASan/UBSan suite with the exact V 0.5.2 release (5/5)
  • real lavapipe example: shared upload-buffer suballocation, simultaneous mapping, policy-selected dedicated image, reported live heap budget, policy-selected upload ring, slice flushing, wraparound, retirement, and cleanup

@antono3
antono3 merged commit 5c7dbd2 into master Sep 12, 2026
2 checks passed
@antono3
antono3 deleted the feature/budget-aware-allocation branch September 12, 2026 13:42
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.

1 participant