Skip to content
This repository was archived by the owner on Jul 19, 2018. It is now read-only.

Commit ea09fe0

Browse files
committed
layers:Disable memory access callback
This is a conservative measure to simplify landing and integration of the memory access checks. For now turning off the callback and also disabling some draw-time checks that seem to have ~10-20% perf hit in limited testing. Turning off callback also means turning off tests that rely on the callback. Will continue advancing this code and testing with checks enabled to reach desired functionality before enabling code on master.
1 parent 69fafd4 commit ea09fe0

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

layers/buffer_validation.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,11 @@ bool MemoryConflict(MemoryAccess const *initial_access, MemoryAccess const *seco
688688

689689
bool FlagMemoryAccessError(debug_report_data const *report_data, VkCommandBuffer command_buffer, const MemoryAccess *first_access,
690690
const MemoryAccess *second_access, const char *caller) {
691+
#ifdef ENABLE_MEMORY_ACCESS_CALLBACK
692+
// TODO: Temporarily disabling this callback until memory access code more thoroughly tested
693+
// Remove this early return to enable the callback
694+
return false;
695+
#endif
691696
const char *first_type = first_access->write ? "write" : "read";
692697
const char *second_type = second_access->write ? "write" : "read";
693698
std::string inter_cb_info = "";

layers/core_validation.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5857,6 +5857,12 @@ static bool ValidateCmdDrawType(layer_data *dev_data, VkCommandBuffer cmd_buffer
58575857
skip |= ValidateDrawState(dev_data, *cb_state, indexed, bind_point, caller, dynamic_state_msg_code);
58585858
skip |= (VK_PIPELINE_BIND_POINT_GRAPHICS == bind_point) ? outsideRenderPass(dev_data, *cb_state, caller, msg_code)
58595859
: insideRenderPass(dev_data, *cb_state, caller, msg_code);
5860+
#ifdef ENABLE_MEMORY_ACCESS_CALLBACK
5861+
// TODO : Early return here to skip the memory access checking below. The checks are functional but cause a perf hit
5862+
// and the callback that's used is disabled, so also turning off these checks for now.
5863+
// To re-enable the checks, just remove this early return
5864+
return skip;
5865+
#endif
58605866
// Grab mem accesses for this draw & check for missing synchs
58615867
auto const &state = (*cb_state)->lastBound[bind_point];
58625868
PIPELINE_STATE *pPipe = state.pipeline_state;

tests/layer_validation_tests.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10197,6 +10197,7 @@ TEST_F(VkLayerTest, UpdateBufferWithinRenderPass) {
1019710197
m_errorMonitor->VerifyFound();
1019810198
}
1019910199

10200+
#ifdef ENABLE_MEMORY_ACCESS_CALLBACK
1020010201
TEST_F(VkLayerTest, DrawWithBufferWaRandRaWConflicts) {
1020110202
TEST_DESCRIPTION(
1020210203
"Attempt a draw that reads from a buffer that was written to and writes"
@@ -10483,11 +10484,7 @@ TEST_F(VkPositiveLayerTest, MultiCBDrawWithBufferWaRandRaWSynchChain) {
1048310484
vkCmdSetViewport(cmd_bufs[2], 0, 1, &viewport);
1048410485
VkRect2D scissor = {{0, 0}, {16, 16}};
1048510486
vkCmdSetScissor(cmd_bufs[2], 0, 1, &scissor);
10486-
// Should now trigger RaW and WaR errors at Draw time
10487-
// m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_WARNING_BIT_EXT, " causes a read after write conflict with ");
10488-
// m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_WARNING_BIT_EXT, " causes a write after read conflict with ");
1048910487
vkCmdDraw(cmd_bufs[2], 3, 1, 0, 0);
10490-
// m_errorMonitor->VerifyFound();
1049110488
vkCmdEndRenderPass(cmd_bufs[2]);
1049210489
vkEndCommandBuffer(cmd_bufs[2]);
1049310490

@@ -10501,7 +10498,7 @@ TEST_F(VkPositiveLayerTest, MultiCBDrawWithBufferWaRandRaWSynchChain) {
1050110498
m_errorMonitor->VerifyNotFound();
1050210499
vkDestroyPipelineLayout(m_device->device(), pipeline_layout, nullptr);
1050310500
}
10504-
10501+
#endif
1050510502
TEST_F(VkPositiveLayerTest, UpdateBufferRaWDependencyWithBarrier) {
1050610503
TEST_DESCRIPTION("Update buffer used in CmdDrawIndirect w/ barrier before use");
1050710504

@@ -10597,6 +10594,7 @@ TEST_F(VkPositiveLayerTest, UpdateBufferWaRDependencyWithTwoBarrierChain) {
1059710594
m_errorMonitor->VerifyNotFound();
1059810595
}
1059910596

10597+
#ifdef ENABLE_MEMORY_ACCESS_CALLBACK
1060010598
TEST_F(VkLayerTest, UpdateBufferRaWDependencyMissingBarrier) {
1060110599
TEST_DESCRIPTION("Update buffer used in CmdDrawIndirect without a barrier before use");
1060210600

@@ -10740,7 +10738,7 @@ TEST_F(VkLayerTest, TwoCommandBufferUpdateBufferRaWDependencyMissingBarrier) {
1074010738

1074110739
vkDestroyPipelineLayout(m_device->device(), pipeline_layout, nullptr);
1074210740
}
10743-
10741+
#endif
1074410742
TEST_F(VkLayerTest, ClearColorImageWithBadRange) {
1074510743
TEST_DESCRIPTION("Record clear color with an invalid VkImageSubresourceRange");
1074610744

0 commit comments

Comments
 (0)