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 (PassMan &man)
 
Ref rewrite (Ref) override
 custom rewrite function memoized version of rewrite_
 
Ref rewrite_ (Ref)
 
- Public Member Functions inherited from mim::RWPass< LowerMatrixMediumLevel, Lam >
 RWPass (PassMan &man, std::string_view name)
 
bool inspect () const override
 Should the PassMan even consider this pass?
 
Lamcurr_mut () const
 
- Public Member Functions inherited from mim::Pass
 Pass (PassMan &, std::string_view name)
 
virtual ~Pass ()=default
 
Worldworld ()
 
PassManman ()
 
const PassManman () const
 
std::string_view name () const
 
size_t index () const
 
virtual Ref rewrite (const Var *var)
 
virtual Ref rewrite (const Proxy *proxy)
 
virtual undo_t analyze (Ref)
 
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 (Ref type, Defs ops, u32 tag=0)
 
const Proxyisa_proxy (Ref def, u32 tag=0)
 Check whether given def is a Proxy whose Proxy::pass matches this Pass's IPass::index.
 
const Proxyas_proxy (Ref def, u32 tag=0)
 

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

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 ( PassMan & man)
inline

Definition at line 47 of file lower_matrix_mediumlevel.h.

Member Function Documentation

◆ rewrite()

Ref mim::plug::matrix::LowerMatrixMediumLevel::rewrite ( Ref 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: