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

Layers: Resource binding and aliasing checks may be too strict #14

Closed
karl-lunarg opened this issue May 14, 2018 · 4 comments
Closed

Layers: Resource binding and aliasing checks may be too strict #14

karl-lunarg opened this issue May 14, 2018 · 4 comments
Assignees
Labels
Bug Something isn't working
Milestone

Comments

@karl-lunarg
Copy link
Contributor

Issue by yavn (MIGRATED)
Tuesday Dec 13, 2016 at 16:39 GMT
Originally opened as KhronosGroup/Vulkan-LoaderAndValidationLayers#1259


I'm observing errors related to keeping track of allocated memory and resource types that were bound to it. Layers are making assumptions about how the memory range is going to be used by the app and emit errors when the usage pattern seem to be incorrect.

1. Binding a memory range that was also bound to a resource with a different tiling

MEM(ERROR): object: 0xb type: 9 location: 0 msgCode: 3: Linear buffer 0xb is aliased with non-linear image 0x9 which is in violation of the Buffer-Image Granularity section of the Vulkan specification.

Although the layer is trying to highlight what is most likely a bug, there's no spec language (AFAIK) that says this is an error. Violating buffer-image granularity makes the resources alias each other, and aliasing of linear and non-linear resources makes reads/writes undefined to the other resource. So this should probably be a warning instead.

2. Mapping a memory range that is aliased with an unused image

DS(ERROR): object: 0x0 type: 0 location: 11197 msgCode: 6: Cannot map an image with layout VK_IMAGE_LAYOUT_UNDEFINED. Only GENERAL or PREINITIALIZED are supported.

MEM(ERROR): object: 0xf type: 10 location: 0 msgCode: 3: Non-linear image 0xf is aliased with linear image 0xcccccccccccccccc which is in violation of the Buffer-Image Granularity section of the Vulkan specification.

The layer is tracking bound memory ranges and sees that a range is used by an image that was never transitioned from UNDEFINED layout. But this message is a false positive. We're actually mapping the range in order to access a buffer that aliases the image. The image itself is never accessed. Of course there's no way to tell the intent, as this is not visible in the vkMapMemory call... Not sure if this can be improved. Again, layer is trying to do the right thing here, but in presence of aliasing this is just too ambiguous.

The second message outputs an uninitialized variable (0xcccccccccccccccc) because a common code is used that expects image handle but we only set memory range before calling. This is a small bug, not really relevant.

For reference, the Khronos internal Vulkan CTS issue for this is 560 if you want to see the test that causes these problems.

@karl-lunarg karl-lunarg added this to the P2 milestone May 14, 2018
@karl-lunarg karl-lunarg added the Bug Something isn't working label May 14, 2018
@karl-lunarg
Copy link
Contributor Author

Comment by tobine (MIGRATED)
Tuesday Dec 13, 2016 at 19:10 GMT


@yavn Thanks for the bugs and great analysis. I agree that the first needs to change to a warning. The spec language is only telling what you must do to avoid aliasing, but isn't saying that the aliasing in itself is an error.

For the second case I'll leave as an error for now but see if I can at least clean up the printing of un-initialized variable in the near-term.

Longer-term I'd like to keep this open and analyze if we can be a bit smarter about the second aliasing case. I think it's probably a very rare case so don't want to spend too much effort on it, but may be some simple updates that can be made to at least make validation more friendly in this case.

@karl-lunarg
Copy link
Contributor Author

Comment by tobine (MIGRATED)
Tuesday Dec 13, 2016 at 19:48 GMT


#1264 makes this better. Lowering priority.

@karl-lunarg
Copy link
Contributor Author

Comment by yavn (MIGRATED)
Wednesday Dec 14, 2016 at 08:50 GMT


Thanks. For reference, there was a similar issue here: #328

@mark-lunarg
Copy link
Contributor

The memory errors are now warnings, and the DS error is no longer present in current validation.

@mark-lunarg mark-lunarg modified the milestones: P2, sdk-1.1.77.0 Jun 14, 2018
AttilioProvenzano-ARM added a commit to ARM-software/Vulkan-ValidationLayers that referenced this issue Feb 27, 2020
This commit adds checks regarding:
 - Store ops for potentially transient images
 - Framebuffer attachments that should/should not be transient
 - Clearing attachments after load
 - Many instanced vertex buffers in a pipeline

This corresponds to checks KhronosGroup#8, KhronosGroup#10-11, KhronosGroup#14 and KhronosGroup#32 from PerfDoc.
AttilioProvenzano-ARM added a commit to ARM-software/Vulkan-ValidationLayers that referenced this issue Feb 27, 2020
This commit adds checks regarding:
 - Store ops for potentially transient images
 - Framebuffer attachments that should/should not be transient
 - Clearing attachments after load
 - Many instanced vertex buffers in a pipeline

This corresponds to checks KhronosGroup#8, KhronosGroup#10-11, KhronosGroup#14 and KhronosGroup#32 from PerfDoc.
AttilioProvenzano-ARM added a commit to ARM-software/Vulkan-ValidationLayers that referenced this issue Feb 27, 2020
This commit adds checks regarding:
 - Store ops for potentially transient images
 - Framebuffer attachments that should/should not be transient
 - Clearing attachments after load
 - Many instanced vertex buffers in a pipeline

This corresponds to checks KhronosGroup#8, KhronosGroup#10-11, KhronosGroup#14 and KhronosGroup#32 from PerfDoc.
AttilioProvenzano-ARM added a commit to ARM-software/Vulkan-ValidationLayers that referenced this issue Feb 28, 2020
This commit adds checks regarding:
 - Store ops for potentially transient images
 - Framebuffer attachments that should/should not be transient
 - Clearing attachments after load
 - Many instanced vertex buffers in a pipeline

This corresponds to checks KhronosGroup#8, KhronosGroup#10-11, KhronosGroup#14 and KhronosGroup#32 from PerfDoc.
AttilioProvenzano-ARM added a commit to ARM-software/Vulkan-ValidationLayers that referenced this issue Feb 28, 2020
This commit adds checks regarding:
 - Store ops for potentially transient images
 - Framebuffer attachments that should/should not be transient
 - Clearing attachments after load
 - Many instanced vertex buffers in a pipeline

This corresponds to checks KhronosGroup#8, KhronosGroup#10-11, KhronosGroup#14 and KhronosGroup#32 from PerfDoc.
mark-lunarg pushed a commit that referenced this issue Feb 28, 2020
This commit adds checks regarding:
 - Store ops for potentially transient images
 - Framebuffer attachments that should/should not be transient
 - Clearing attachments after load
 - Many instanced vertex buffers in a pipeline

This corresponds to checks #8, #10-11, #14 and #32 from PerfDoc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants