Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan: Allocation optimization for byte slice during state rebuilding #2017

Merged
merged 2 commits into from
Jun 28, 2018

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