MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / DetectAsyncHazard

Method DetectAsyncHazard

layers/sync/sync_access_state.cpp:273–295  ·  view source on GitHub ↗

Asynchronous Hazards occur between subpasses with no connection through the DAG

Source from the content-addressed store, hash-verified

271
272// Asynchronous Hazards occur between subpasses with no connection through the DAG
273HazardResult AccessState::DetectAsyncHazard(const SyncAccessInfo& usage_info, const ResourceUsageTag start_tag,
274 QueueId queue_id) const {
275 // Async checks need to not go back further than the start of the subpass, as we only want to find hazards between the async
276 // subpasses. Anything older than that should have been checked at the start of each subpass, taking into account all of
277 // the raster ordering rules.
278 if (IsRead(usage_info.access_index)) {
279 if (last_write.has_value() && last_write->queue == queue_id && (last_write->tag >= start_tag)) {
280 return HazardResult::HazardVsPriorWrite(this, usage_info, READ_RACING_WRITE, *last_write);
281 }
282 } else {
283 if (last_write.has_value() && last_write->queue == queue_id && (last_write->tag >= start_tag)) {
284 return HazardResult::HazardVsPriorWrite(this, usage_info, WRITE_RACING_WRITE, *last_write);
285 } else if (HasReads()) {
286 // Any reads during the other subpass will conflict with this write, so we need to check them all.
287 for (const auto& read_access : GetReads()) {
288 if (read_access.queue == queue_id && read_access.tag >= start_tag) {
289 return HazardResult::HazardVsPriorRead(this, usage_info, WRITE_RACING_READ, read_access);
290 }
291 }
292 }
293 }
294 return {};
295}
296
297HazardResult AccessState::DetectAsyncHazard(const AccessState& recorded_use, const ResourceUsageRange& tag_range,
298 ResourceUsageTag start_tag, QueueId queue_id) const {

Callers

nothing calls this directly

Calls 4

IsReadFunction · 0.85
has_valueMethod · 0.80
IsHazardMethod · 0.80
AddRecordedAccessMethod · 0.80

Tested by

no test coverage detected