Repository navigation
Polyfill non-4-byte-aligned fills in the Vulkan HAL. - #7317
Merged
Merged
Conversation
ScottTodd
force-pushed
the
vulkan-fill
branch
from
October 12, 2021 21:28
21ed19c to
3e51acb
Compare
ScottTodd
force-pushed
the
vulkan-fill
branch
from
October 12, 2021 21:39
3e51acb to
77282de
Compare
ScottTodd
force-pushed
the
vulkan-fill
branch
from
October 13, 2021 19:51
af687d4 to
077b042
Compare
ScottTodd
marked this pull request as ready for review
October 13, 2021 20:28
Fixes this validation layer error when binding an entire buffer that is small: ``` E D:\dev\projects\iree\iree\hal\vulkan\debug_reporter.cc:38] Validation Error: [ VUID-VkDescriptorBufferInfo-range-00342 ] Object 0: handle = 0xec4bec000000000b, type = VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT; | MessageID = 0xe9e00038 | vkCmdPushDescriptorSetKHR() VkWriteDescriptorSet[0] failed update validation: Write update to Push Descriptors defined with VkDescriptorSetLayout 0xec4bec000000000b[] binding #0 failed with error message: Attempted write update to buffer descriptor failed due to: For buffer VkBuffer 0xdcc8fd0000000012[] VkDescriptorBufferInfo range is 4 which is greater than buffer size (2) minus requested offset of 0. The Vulkan spec states: If range is not equal to VK_WHOLE_SIZE, range must be less than or equal to the size of buffer minus offset (https://vulkan.lunarg.com/doc/view/1.2.189.2/windows/1.2-extensions/vkspec.html#VUID-VkDescriptorBufferInfo-range-00342) ```
benvanik
requested changes
Oct 16, 2021
This aggregate library will be simpler to include. If we add more shaders and conditionally include them in builds, we can iterate through the iree_file_toc_t array and check the file names before just touching data/size. YAGNI until then.
Member
Author
|
Addressed the first round of comments, PTAL |
benvanik
approved these changes
Oct 18, 2021
Merged
bjacob
pushed a commit
to bjacob/iree
that referenced
this pull request
Oct 21, 2021
This fixes iree-org#7228 by introducing a new `BuiltinExecutables` class under the Vulkan HAL that uses a 1x1x1 dispatch to fill any unaligned bytes within a buffer fill operation. Aligned regions of buffer fills will still use the native `vkCmdFillBuffer`. New CTS test cases provide coverage for each [pattern_size x offset x fill_length] permutation. Inserting a dispatch into a command buffer (that was expecting to just have a native `vkCmdFillBuffer` transfer operation inside it) requires some special handling: * Descriptor set layout index 3 is used (Android typically only supports 4, so this is the last slot), to avoid overlap with descriptor set layouts used by the compiler. * Push constants are tracked for each command buffer so when this dispatch uses its own push constants it can restore from that backup. * Command buffers that may go down this polyfill path need to run on a queue compatible with dispatch operations (i.e. not transfer exclusive). We had some ideas for adding a compiler analysis and attribute for "will only contain aligned fills", but without that I'm just defaulting to `command_categories |= IREE_HAL_COMMAND_CATEGORY_DISPATCH` where needed. --- I have not yet tested this in a real program and there are still a few TODOs for optimal performance and correct synchronization behavior.
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.
This fixes #7228 by introducing a new
BuiltinExecutablesclass under the Vulkan HAL that uses a 1x1x1 dispatch to fill any unaligned bytes within a buffer fill operation. Aligned regions of buffer fills will still use the nativevkCmdFillBuffer. New CTS test cases provide coverage for each [pattern_size x offset x fill_length] permutation.Inserting a dispatch into a command buffer (that was expecting to just have a native
vkCmdFillBuffertransfer operation inside it) requires some special handling:command_categories |= IREE_HAL_COMMAND_CATEGORY_DISPATCHwhere needed.I have not yet tested this in a real program and there are still a few TODOs for optimal performance and correct synchronization behavior.