#pragma once #include "mlir/IR/IRMapping.h" #include "mlir/IR/PatternMatch.h" #include "mlir/IR/Value.h" namespace onnx_mlir { /// Returns true when a matrix-valued compute operand is ultimately backed by a /// weight-marked constant/view chain and can be promoted into weights. bool isWeightLikeComputeOperand(mlir::Value value); /// Rebuilds the view/transpose chain of a promoted weight operand inside a new /// compute body while reusing already-materialized intermediate values. llvm::FailureOr materializeWeightLikeValueInBlock(mlir::Value value, mlir::IRRewriter& rewriter, mlir::IRMapping& mapper); } // namespace onnx_mlir