llvm-project/mlir/test/lib/Dialect/Test/TestAttributes.h
Andrei Golubev 3141bdefff
[mlir][bufferization] Test tensor encoding -> memref layout conversion (#161166)
Support custom types (4/N): test that it is possible to customize memref
layout specification for custom operations and function boundaries.

This is purely a test setup (no API modifications) to ensure users are
able to pass information from tensors to memrefs within bufferization
process. To achieve this, a test pass is required (since bufferization
options have to be set manually). As there is already a
--test-one-shot-module-bufferize pass present, it is extended for the
purpose.
2025-10-15 12:44:17 +02:00

58 lines
1.8 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/Dialect/Ptr/IR/MemorySpaceInterfaces.h"
#include "mlir/Dialect/Utils/StructuredOpsUtils.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/DialectResourceBlobManager.h"
#include "mlir/IR/TensorEncoding.h"
// generated files require above includes to come first
#include "TestAttrInterfaces.h.inc"
#include "TestOpEnums.h.inc"
namespace test {
class TestDialect;
// Payload class for the CopyCountAttr.
class CopyCount {
public:
CopyCount(std::string value) : value(value) {}
CopyCount(const CopyCount &rhs);
CopyCount &operator=(const CopyCount &rhs);
CopyCount(CopyCount &&rhs) = default;
CopyCount &operator=(CopyCount &&rhs) = default;
static int counter;
std::string value;
};
llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
const test::CopyCount &value);
/// 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