picceler
A compiled DSL for image processing, built on MLIR
Loading...
Searching...
No Matches
picceler_ops_to_func_calls_pass.cpp File Reference
#include "passes.h"
#include "spdlog/spdlog.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Conversion/LLVMCommon/MemRefBuilder.h"
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
#include "ops.h"
#include "types.h"
#include "image_access_helper.h"
#include <mlir/IR/BuiltinDialect.h>
#include <mlir/IR/BuiltinOps.h>
#include "piccelerPasses.h.inc"

Classes

struct  picceler::LoadImageToCall
struct  picceler::ShowImageToCall
 Pattern to lower ShowImageOp to a function call. More...
struct  picceler::SaveImageToCall
 Pattern to lower SaveImageOp to a function call. More...
struct  picceler::ReadNumberToCall
struct  picceler::ReadStringToCall
struct  picceler::PrintToCalls
struct  picceler::PiccelerOpsToFuncCallsPass
 A pass that converts image operations (like load, show, save) into function calls. More...

Namespaces

namespace  picceler

Macros

#define GEN_PASS_DEF_PICCELEROPSTOFUNCCALLS

Functions

mlir::func::FuncOp picceler::ensureRuntimeFunc (mlir::ModuleOp module, mlir::StringRef name, llvm::ArrayRef< mlir::Type > inputs, llvm::ArrayRef< mlir::Type > results, mlir::PatternRewriter &rewriter, mlir::Location loc)
 Ensures that a runtime function is declared in the module. If the function does not exist, it is created.
mlir::Value picceler::buildImageMemref (mlir::PatternRewriter &rewriter, mlir::Location loc, mlir::Value dataPtr, mlir::Value heightI64, mlir::Value widthI64)
 Builds a memref<?x?x4xi8> LLVM descriptor directly from a raw data pointer and dynamic height/width (both i64-typed, matching LLVMTypeConverter's default index type), emitting a single UnrealizedConversionCastOp from the LLVM struct to the memref type. This cast is a structural identity (LLVMTypeConverter converts memref<?x?x4xi8> to exactly this struct type), so it folds away cleanly under ReconcileUnrealizedCastsPass, unlike a cast straight from !llvm.ptr to memref.
The following functions create instances of the various passes used in the compilation process.

Each function corresponds to a specific pass that transforms the IR in a particular way.

std::unique_ptr< mlir::Pass > picceler::createPiccelerOpsToFuncCallsPass ()

Macro Definition Documentation

◆ GEN_PASS_DEF_PICCELEROPSTOFUNCCALLS

#define GEN_PASS_DEF_PICCELEROPSTOFUNCCALLS