Skip to content

Conversation

@qining
Copy link
Contributor

@qining qining commented Jun 27, 2018

For a typical Vulkan application, this saves ~200MB memory used for
storing the slice data.

func (sb *stateBuilder) allocAndFillScratchBuffer(device DeviceObjectʳ, data []uint8, usages ...VkBufferUsageFlagBits) (VkBuffer, VkDeviceMemory) {
buffer := VkBuffer(newUnusedID(true, func(x uint64) bool { return sb.s.Buffers().Contains(VkBuffer(x)) }))
deviceMemory := VkDeviceMemory(newUnusedID(true, func(x uint64) bool { return sb.s.DeviceMemories().Contains(VkDeviceMemory(x)) }))
type bufSubRngFillInfo struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For class names, can we use the full words, bufferSubRangeFillInfo.

Copy link
Contributor

@AWoloszyn AWoloszyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor requests.

For a typical Vulkan application, this saves ~300MB memory used for
storing the slice data.
@qining qining force-pushed the do-not-duplicate-state-building-data branch from 8ec5077 to b113ceb Compare June 27, 2018 18:39
@qining
Copy link
Contributor Author

qining commented Jun 27, 2018

@AWoloszyn

  1. struct renamed
  2. add mustReadSlice() to stateBuilder to take care of slice data: reserve, then read the slice at the reserved address.

Do not handle the data used in "image priming through imageStore", as

  1. If the data get truncated into multiple batches of vkCmdDispatch, new ID and record in database will always be required. This is also the case for sparse resident images.
  2. If truncation is not required, the data used for AllocDataOrPanic() will be exactly the same to the data slice already in the database so is the hash, so no new record will be created.

@qining qining changed the title Vulkan: Allocation optimization for byte slice during state rebuilding WIP: Vulkan: Allocation optimization for byte slice during state rebuilding Jun 28, 2018
@qining qining changed the title WIP: Vulkan: Allocation optimization for byte slice during state rebuilding Vulkan: Allocation optimization for byte slice during state rebuilding Jun 28, 2018
@qining qining merged commit c421b96 into google:master Jun 28, 2018
@qining qining deleted the do-not-duplicate-state-building-data branch October 23, 2018 17:32
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