Disable async pipeline compilation on Mac AMD with backend validation

Instead, compile pipelines synchronously.

When backend validation is on with Mac AMD, the driver crashes during
pipeline compilation. This seems to only occur when partition alloc
is enabled.

Bug: dawn:1200
Change-Id: I520087eeae9c356990962d0c4a96eba017735af1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121400
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Austin Eng 2023-02-24 16:26:00 +00:00 committed by Dawn LUCI CQ
parent d436ee4dbd
commit 9ec746e3b9
2 changed files with 20 additions and 0 deletions

View File

@ -15,7 +15,9 @@
#include "dawn/native/metal/ComputePipelineMTL.h"
#include "dawn/common/Math.h"
#include "dawn/native/Adapter.h"
#include "dawn/native/CreatePipelineAsyncTask.h"
#include "dawn/native/Instance.h"
#include "dawn/native/metal/DeviceMTL.h"
#include "dawn/native/metal/ShaderModuleMTL.h"
#include "dawn/native/metal/UtilsMetal.h"
@ -84,9 +86,17 @@ bool ComputePipeline::RequiresStorageBufferLength() const {
void ComputePipeline::InitializeAsync(Ref<ComputePipelineBase> computePipeline,
WGPUCreateComputePipelineAsyncCallback callback,
void* userdata) {
AdapterBase* adapter = computePipeline->GetDevice()->GetAdapter();
std::unique_ptr<CreateComputePipelineAsyncTask> asyncTask =
std::make_unique<CreateComputePipelineAsyncTask>(std::move(computePipeline), callback,
userdata);
// Workaround a crash where the validation layers on AMD crash with partition alloc.
// See crbug.com/dawn/1200.
if (adapter->GetInstance()->IsBackendValidationEnabled() &&
gpu_info::IsAMD(adapter->GetVendorId())) {
asyncTask->Run();
return;
}
CreateComputePipelineAsyncTask::RunAsync(std::move(asyncTask));
}

View File

@ -14,7 +14,9 @@
#include "dawn/native/metal/RenderPipelineMTL.h"
#include "dawn/native/Adapter.h"
#include "dawn/native/CreatePipelineAsyncTask.h"
#include "dawn/native/Instance.h"
#include "dawn/native/VertexFormat.h"
#include "dawn/native/metal/DeviceMTL.h"
#include "dawn/native/metal/PipelineLayoutMTL.h"
@ -508,9 +510,17 @@ NSRef<MTLVertexDescriptor> RenderPipeline::MakeVertexDesc() {
void RenderPipeline::InitializeAsync(Ref<RenderPipelineBase> renderPipeline,
WGPUCreateRenderPipelineAsyncCallback callback,
void* userdata) {
AdapterBase* adapter = renderPipeline->GetDevice()->GetAdapter();
std::unique_ptr<CreateRenderPipelineAsyncTask> asyncTask =
std::make_unique<CreateRenderPipelineAsyncTask>(std::move(renderPipeline), callback,
userdata);
// Workaround a crash where the validation layers on AMD crash with partition alloc.
// See crbug.com/dawn/1200.
if (adapter->GetInstance()->IsBackendValidationEnabled() &&
gpu_info::IsAMD(adapter->GetVendorId())) {
asyncTask->Run();
return;
}
CreateRenderPipelineAsyncTask::RunAsync(std::move(asyncTask));
}