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

The matrix Plugin More...

Classes

class  LowerMatrixHighLevelMapRed
 Resolves lowering of high level operations into medium/other high-level operations. More...
 
class  LowerMatrixLowLevel
 In this phase, we lower all matrix operations and types to the low-level representation using pointers. More...
 
class  LowerMatrixMediumLevel
 In this step, we lower map_reduce operations into affine for loops making the iteration scheme explicit. More...
 

Enumerations

%matrix.Mat
enum class  Mat : flags_t
 
%matrix.constMat
enum class  constMat : flags_t
 
%matrix.init
enum class  init : flags_t
 
%matrix.sum
enum class  sum : flags_t
 
%matrix.lower_matrix_high_level_map_reduce
enum class  lower_matrix_high_level_map_reduce : flags_t
 
%matrix.lower_matrix_medium_level
enum class  lower_matrix_medium_level : flags_t
 
%matrix.internal_map_reduce_cleanup
enum class  internal_map_reduce_cleanup : flags_t
 
%matrix.lower_matrix_low_level
enum class  lower_matrix_low_level : flags_t
 

Functions

const Defzero_int (World &w, Ref n, Ref S, Ref mem, nat_t m)
 mat.zero: [n: Nat, S: «n; Nat», m: Nat] -> mat.Mat (n,S,(Idx m));
 
const Defop_read (Ref mem, Ref matrix, Ref idx)
 
u64 get_max_index (u64 init, Defs inputs)
 Matrix normalizer for product on two-dimensional matrices.
 
std::pair< Lam *, Refcounting_for (Ref bound, DefVec acc, Ref exit, const char *name="for_body")
 
void register_normalizers (Normalizers &normalizers)
 

Variables

static constexpr plugin_t Plugin_Id = 0x3825532990000000
 

%matrix.shape

enum class  shape : flags_t
 
Ref normalize_shape (Ref type, Ref callee, Ref arg)
 Normalizer for transpose operations.
 

%matrix.read

enum class  read : flags_t
 
Ref normalize_read (Ref type, Ref callee, Ref arg)
 Normalizer for read opertions.
 

%matrix.insert

enum class  insert : flags_t
 
Ref normalize_insert (Ref type, Ref callee, Ref arg)
 Normalizer for write operations TODO: implement.
 

%matrix.prod

enum class  prod : flags_t
 
Ref normalize_prod (Ref type, Ref callee, Ref arg)
 

%matrix.transpose

enum class  transpose : flags_t
 
Ref normalize_transpose (Ref type, Ref callee, Ref arg)
 

%matrix.map_reduce

enum class  map_reduce : flags_t
 
Ref normalize_map_reduce (Ref type, Ref callee, Ref arg)
 map_reduce normalizers
 

Detailed Description

Enumeration Type Documentation

◆ constMat

enum class mim::plug::matrix::constMat : flags_t
strong

Definition at line 29 of file autogen.h.

◆ init

enum class mim::plug::matrix::init : flags_t
strong

Definition at line 52 of file autogen.h.

◆ insert

enum class mim::plug::matrix::insert : flags_t
strong

Definition at line 44 of file autogen.h.

◆ internal_map_reduce_cleanup

Definition at line 104 of file autogen.h.

◆ lower_matrix_high_level_map_reduce

Definition at line 90 of file autogen.h.

◆ lower_matrix_low_level

Definition at line 111 of file autogen.h.

◆ lower_matrix_medium_level

Definition at line 97 of file autogen.h.

◆ map_reduce

Definition at line 82 of file autogen.h.

◆ Mat

enum class mim::plug::matrix::Mat : flags_t
strong

Definition at line 14 of file autogen.h.

◆ prod

enum class mim::plug::matrix::prod : flags_t
strong

Definition at line 59 of file autogen.h.

◆ read

enum class mim::plug::matrix::read : flags_t
strong

Definition at line 36 of file autogen.h.

◆ shape

enum class mim::plug::matrix::shape : flags_t
strong

Definition at line 21 of file autogen.h.

◆ sum

enum class mim::plug::matrix::sum : flags_t
strong

Definition at line 75 of file autogen.h.

◆ transpose

Definition at line 67 of file autogen.h.

Function Documentation

◆ counting_for()

std::pair< Lam *, Ref > mim::plug::matrix::counting_for ( Ref bound,
DefVec acc,
Ref exit,
const char * name = "for_body" )

◆ get_max_index()

u64 mim::plug::matrix::get_max_index ( u64 init,
Defs inputs )

Matrix normalizer for product on two-dimensional matrices.

  • product (constMat v1, constMat v2) -> constMat v1 * v2 * dim (TODO: implement)
  • product (constMat v, m) -> ... (TODO: implement)
  • product (m, constMat v) -> ... (TODO: implement)
  • product (id, m) -> m (TODO: check)
  • product (m, id) -> m
  • map(constMat v, f) -> constMat f(v) (TODO: implement)
  • map f (map g m) -> map (f . g) m (TODO: implement)
  • map f (zipWith g m1 m2) -> zipWith (f . g) m1 m2 (TODO: implement)

Definition at line 76 of file normalizers.cpp.

References mim::Lit::isa().

◆ normalize_insert()

Ref mim::plug::matrix::normalize_insert ( Ref type,
Ref callee,
Ref arg )

Normalizer for write operations TODO: implement.

Definition at line 41 of file normalizers.cpp.

References mim::World::raw_app(), and mim::Def::world().

◆ normalize_map_reduce()

Ref mim::plug::matrix::normalize_map_reduce ( Ref type,
Ref callee,
Ref arg )

map_reduce normalizers

  • TODO: map_reduce (..., ((idx,map_reduce([out, ]...), ...))) -> unify idx, out (out is implicit), name vars apart requires: same reduction, distributive reduction we assume distributivity of the reduction function

Definition at line 97 of file normalizers.cpp.

References mim::World::raw_app(), and mim::Def::world().

◆ normalize_prod()

Ref mim::plug::matrix::normalize_prod ( Ref type,
Ref callee,
Ref arg )

Definition at line 104 of file normalizers.cpp.

References mim::World::raw_app(), and mim::Def::world().

◆ normalize_read()

Ref mim::plug::matrix::normalize_read ( Ref type,
Ref callee,
Ref arg )

Normalizer for read opertions.

Definition at line 19 of file normalizers.cpp.

References mim::match(), mim::Def::projs(), and mim::Def::world().

◆ normalize_shape()

Ref mim::plug::matrix::normalize_shape ( Ref type,
Ref callee,
Ref arg )

Normalizer for transpose operations.

  • transpose (constMat v) -> cosntMat v (TODO: implement)
  • transpose (insert m v (i,j)) -> insert (transpose m) v (j,i) (TODO: implement, maybe other way around?)
  • transpose (tranpose m) -> m (TODO: implement)
  • shape (@mat n (k1,k2,...,kn) i) -> (k1,k2,...,kn)#i (TODO: implement)

Definition at line 57 of file normalizers.cpp.

References mim::match(), mim::Def::projs(), and mim::Def::world().

◆ normalize_transpose()

Ref mim::plug::matrix::normalize_transpose ( Ref type,
Ref callee,
Ref arg )

Definition at line 109 of file normalizers.cpp.

References mim::World::raw_app(), and mim::Def::world().

◆ op_read()

const Def * mim::plug::matrix::op_read ( Ref mem,
Ref matrix,
Ref idx )
inline

◆ register_normalizers()

void mim::plug::matrix::register_normalizers ( Normalizers & normalizers)

Referenced by mim_get_plugin().

◆ zero_int()

const Def * mim::plug::matrix::zero_int ( World & w,
Ref n,
Ref S,
Ref mem,
nat_t m )
inline

mat.zero: [n: Nat, S: «n; Nat», m: Nat] -> mat.Mat (n,S,(Idx m));

Definition at line 14 of file matrix.h.

Variable Documentation

◆ Plugin_Id

plugin_t mim::plug::matrix::Plugin_Id = 0x3825532990000000
staticconstexpr

Definition at line 10 of file autogen.h.