Currently some control flow patterns cannot be structurized into existing SPIR-V MLIR constructs, e.g., conditional early exits (break). Since the support for early exit cannot be currently added (https://github.com/llvm/llvm-project/pull/138688#pullrequestreview-2830791677) this patch enables structurizer to be disabled to keep the control flow unstructurized. By default, the control flow is structurized.
25 lines
779 B
C++
25 lines
779 B
C++
//===- Deserialization.cpp - MLIR SPIR-V Deserialization ------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/Target/SPIRV/Deserialization.h"
|
|
|
|
#include "Deserializer.h"
|
|
|
|
using namespace mlir;
|
|
|
|
OwningOpRef<spirv::ModuleOp>
|
|
spirv::deserialize(ArrayRef<uint32_t> binary, MLIRContext *context,
|
|
const DeserializationOptions &options) {
|
|
Deserializer deserializer(binary, context, options);
|
|
|
|
if (failed(deserializer.deserialize()))
|
|
return nullptr;
|
|
|
|
return deserializer.collect();
|
|
}
|