llvm-project/mlir/test/lib/Dialect/Test/TestAttributes.h
River Riddle 5f58e14b36 [mlir] Add a generic DialectResourceBlobManager to simplify resource blob management
The DialectResourceBlobManager class provides functionality for managing resource blobs
in a generic, dialect-agnostic fashion. In addition to this class, a dialect interface and custom
resource handle are provided to simplify referencing and interacting with the manager. These
classes intend to simplify the work required for dialects that want to manage resource blobs
during compilation, such as for large elements attrs.  The old manager for the resource example
in the test dialect has been updated to use this, which provides and cleaner and more consistent API.

This commit also adds new HeapAsmResourceBlob and ImmortalAsmResourceBlob to simplify
creating resource blobs in common scenarios.

Differential Revision: https://reviews.llvm.org/D130021
2022-08-01 12:37:16 -07:00

41 lines
1.2 KiB
C++

//===- TestTypes.h - MLIR Test Dialect Types --------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// This file contains types defined by the TestDialect for testing various
// features of MLIR.
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_TESTATTRIBUTES_H
#define MLIR_TESTATTRIBUTES_H
#include <tuple>
#include "TestTraits.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/DialectImplementation.h"
#include "TestAttrInterfaces.h.inc"
#include "TestOpEnums.h.inc"
#include "mlir/IR/DialectResourceBlobManager.h"
namespace test {
class TestDialect;
/// A handle used to reference external elements instances.
using TestDialectResourceBlobHandle =
mlir::DialectResourceBlobHandle<TestDialect>;
} // namespace test
#define GET_ATTRDEF_CLASSES
#include "TestAttrDefs.h.inc"
#endif // MLIR_TESTATTRIBUTES_H