#include "mlir/Dialect/Polynomial/IR/PolynomialOps.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Polynomial/IR/Polynomial.h"
#include "mlir/Dialect/Polynomial/IR/PolynomialAttributes.h"
#include "mlir/Dialect/Polynomial/IR/PolynomialTypes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/PatternMatch.h"
#include "llvm/ADT/APInt.h"
usingnamespacemlir;
usingnamespacemlir::polynomial;
void FromTensorOp::build(OpBuilder &builder, OperationState &result,
Value input, RingAttr ring) { … }
LogicalResult FromTensorOp::verify() { … }
LogicalResult ToTensorOp::verify() { … }
LogicalResult MulScalarOp::verify() { … }
bool isPrimitiveNthRootOfUnity(const APInt &root, const APInt &n,
const APInt &cmod) { … }
static LogicalResult verifyNTTOp(Operation *op, RingAttr ring,
RankedTensorType tensorType,
std::optional<PrimitiveRootAttr> root) { … }
LogicalResult NTTOp::verify() { … }
LogicalResult INTTOp::verify() { … }
ParseResult ConstantOp::parse(OpAsmParser &parser, OperationState &result) { … }
void ConstantOp::print(OpAsmPrinter &p) { … }
LogicalResult ConstantOp::inferReturnTypes(
MLIRContext *context, std::optional<mlir::Location> location,
ConstantOp::Adaptor adaptor,
llvm::SmallVectorImpl<mlir::Type> &inferredReturnTypes) { … }
namespace {
#include "PolynomialCanonicalization.inc"
}
void SubOp::getCanonicalizationPatterns(RewritePatternSet &results,
MLIRContext *context) { … }
void NTTOp::getCanonicalizationPatterns(RewritePatternSet &results,
MLIRContext *context) { … }
void INTTOp::getCanonicalizationPatterns(RewritePatternSet &results,
MLIRContext *context) { … }