MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::plug::matrix::LowerMatrixMediumLevel Class Reference

In this step, we lower map_reduce operations into affine for loops making the iteration scheme explicit. More...

#include <mim/plug/matrix/pass/lower_matrix_mediumlevel.h>

Inheritance diagram for mim::plug::matrix::LowerMatrixMediumLevel:
[legend]

Public Member Functions

 LowerMatrixMediumLevel (World &world, flags_t annex)
 
const Defrewrite (const Def *) override
 custom rewrite function memoized version of rewrite_
 
const Defrewrite_ (const Def *)
 
- Public Member Functions inherited from mim::RWPass< LowerMatrixMediumLevel, Lam >
 RWPass (World &world, std::string name)
 
 RWPass (World &world, flags_t annex)
 
bool inspect () const override
 Should the PassMan even consider this pass?
 
Lamcurr_mut () const
 
- Public Member Functions inherited from mim::Pass
 Pass (World &world, std::string name)
 
 Pass (World &world, flags_t annex)
 
virtual void init (PassMan *)
 
PassManman ()
 
const PassManman () const
 
size_t index () const
 
virtual const Defrewrite (const Var *var)
 
virtual const Defrewrite (const Proxy *proxy)
 
virtual undo_t analyze (const Def *)
 
virtual undo_t analyze (const Var *)
 
virtual undo_t analyze (const Proxy *)
 
virtual bool fixed_point () const
 
virtual void enter ()
 Invoked just before Pass::rewriteing PassMan::curr_mut's body.
 
virtual void prepare ()
 Invoked once before entering the main rewrite loop.
 
const Proxyproxy (const Def *type, Defs ops, u32 tag=0)
 
const Proxyisa_proxy (const Def *def, u32 tag=0)
 Check whether given def is a Proxy whose Proxy::pass matches this Pass's IPass::index.
 
const Proxyas_proxy (const Def *def, u32 tag=0)
 
- Public Member Functions inherited from mim::Stage
Worldworld ()
 
Driverdriver ()
 
Loglog () const
 
std::string_view name () const
 
flags_t annex () const
 
 Stage (World &world, std::string name)
 
 Stage (World &world, flags_t annex)
 
virtual ~Stage ()=default
 
virtual std::unique_ptr< Stagerecreate ()
 Creates a new instance; needed by a fixed-point PhaseMan.
 
virtual void apply (const App *)
 Invoked if your Stage has additional args.
 
virtual void apply (Stage &)
 Dito, but invoked by Stage::recreate.
 

Additional Inherited Members

static auto create (const Flags2Stages &stages, const Def *def)
 
template<class A, class P>
static void hook (Flags2Stages &stages)
 
- Protected Attributes inherited from mim::Stage
std::string name_
 

Detailed Description

In this step, we lower map_reduce operations into affine for loops making the iteration scheme explicit.

Pseudo-code:

out_matrix = init
for output_indices:
acc = zero
for input_indices:
element_[0..m] = read(matrix[0..m], indices)
acc = f (acc, elements)
insert (out_matrix, output_indices, acc)
return out_matrix
The matrix Plugin
Definition matrix.h:7

Detailed pseudo-code:

  • out indices = (0,1,2, ..., n)
  • bounds in S
  • we assume that certain paramters are constant and statically known to avoid inline-metaprogramming like multiiter e.g. the number of matrizes, the dimensions, the indices
    // iterate over out indices
    output = init_matrix (n,S,T)
    for i_0 in [0, S#0)
    ...
    for i_{n-1} in [0, S#(n-1))
    s = zero
    // iterate over non-out indices
    for j in [0, SI#(...)]:
    // indices depend on the specified access
    // input#k#0
    e_0 = read (input#0#1, (i_1, i_0))
    ...
    e_(m-1) = read (input#(m-1)#1, (i_2, j))
    s = add(s, mul (e_0, ..., e_(m-1)) )
    write (output, (i_0, ..., i_{n-1}), s)

Definition at line 45 of file lower_matrix_mediumlevel.h.

Constructor & Destructor Documentation

◆ LowerMatrixMediumLevel()

mim::plug::matrix::LowerMatrixMediumLevel::LowerMatrixMediumLevel ( World & world,
flags_t annex )
inline

Member Function Documentation

◆ rewrite()

const Def * mim::plug::matrix::LowerMatrixMediumLevel::rewrite ( const Def * def)
overridevirtual

custom rewrite function memoized version of rewrite_

Reimplemented from mim::Pass.

Definition at line 19 of file lower_matrix_mediumlevel.cpp.

References rewrite_().

◆ rewrite_()


The documentation for this class was generated from the following files: