Repository navigation
GOU-02 memory + GpuPack marshal substrate #20
Copy link
Copy link
Closed
Labels
sub-featurePiece of a larger enchancementPiece of a larger enchancement
Description
Goal
Ship the permanent device-memory and pack layer used by every later launch:
memory::helpers for buffer lifetimes and copies- Transfer engine (command pool + fence): staging <-> device-local copies
- GpuPack (option 5): scalar SSBO + N list SSBOs
- Marshal round-trip: Python scalars/
list-> pack -> writeback into the same objects
No public buffer type. No SPIR-V yet. No host-visible-only “temporary” SSBO path that later gets deleted, shader-facing buffers are device-local from day one; staging is the host mirror used for copies.
Todos
- Extend
Contextwith all buffer / memory / command-pool / fence entry points needed for transfers (load once ininit, clear inshutdown). memory::Buffer: ownsVkBuffer+VkDeviceMemory+ size; distinguish usage kind (device-local storage vs host-visible staging) via create parameters; one API, two property sets, not two throwaway designs.find_memory_type;create_buffer/destroy_buffer.- Staging: host-visible + coherent; may stay mapped for
memcpyinto staging only. - Device-local:
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;STORAGE_BUFFER+TRANSFER_SRC+TRANSFER_DST; not persistently mapped for upload. TransferEngine(or equivalent on context): one-time command pool on the compute queue family; recordvkCmdCopyBuffer; submit; wait fence. Used byupload_buffer/download_bufferfor device-local targets.upload_buffer/download_buffer: final semantics, host bytes <-> device-local SSBO via staging + GPU copy (bounds checks, clear errors).GpuPack: create/destroy; scalar region = one device-local SSBO with fixedstd430-compatible host mirror struct; eachlist[float|int]= one device-local SSBO; upload/download/writeback helpers.- Empty-list rule (document and implement once): e.g. no
VkBuffer/ zero-size rejected, pick one permanent rule. - Internal / test-only bindings (not product API): round-trip scalars + lists through GpuPack.
- Typed errors: OOM, bad size/dtype, use-after-destroy, not built / not available.
- Pytest: round-trips; empty list; skip if
not available(). - CMake: compile all new GPU sources under
CTHREADS_GPU. - Migrate any WIP host-visible-mapped-as-SSBO code to this model in the same issue (do not leave a parallel path).
Notes
- Interface: users never see Vulkan or
DeviceBuffer. - Arch:
Context= device connection;memory::= stateless buffer ops; transfer engine = reusable copy path;GpuPack= one launch’s scalar + list SSBOs. - Reject: BDA / pointers inside the scalar struct; one monolithic pack buffer; public device buffer type; “map the SSBO and memcpy forever” as the production list path.
Metadata
Metadata
Assignees
Labels
sub-featurePiece of a larger enchancementPiece of a larger enchancement
Activity
Add GPU memory TransferEngine and GpuPack marshal substrate (#20).