Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
thorin::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  Mat : flags_t
 
%matrix.constMat
enum  constMat : flags_t
 
%matrix.init
enum  init : flags_t
 
%matrix.sum
enum  sum : flags_t
 
%matrix.lower_matrix_high_level_map_reduce
enum  lower_matrix_high_level_map_reduce : flags_t
 
%matrix.lower_matrix_medium_level
enum  lower_matrix_medium_level : flags_t
 
%matrix.internal_map_reduce_cleanup
enum  internal_map_reduce_cleanup : flags_t
 
%matrix.lower_matrix_low_level
enum  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  shape : flags_t
 
Ref normalize_shape (Ref type, Ref callee, Ref arg)
 Normalizer for transpose operations.
 

%matrix.read

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

%matrix.insert

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

%matrix.prod

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

%matrix.transpose

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

%matrix.map_reduce

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

Detailed Description

Enumeration Type Documentation

◆ constMat

Definition at line 38 of file autogen.h.

◆ init

Definition at line 73 of file autogen.h.

◆ insert

Definition at line 61 of file autogen.h.

◆ internal_map_reduce_cleanup

◆ lower_matrix_high_level_map_reduce

◆ lower_matrix_low_level

◆ lower_matrix_medium_level

◆ map_reduce

Definition at line 119 of file autogen.h.

◆ Mat

Definition at line 15 of file autogen.h.

◆ prod

Definition at line 84 of file autogen.h.

◆ read

Definition at line 49 of file autogen.h.

◆ shape

Definition at line 26 of file autogen.h.

◆ sum

Definition at line 108 of file autogen.h.

◆ transpose

Definition at line 96 of file autogen.h.

Function Documentation

◆ counting_for()

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

◆ get_max_index()

u64 thorin::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 thorin::Lit::isa(), and thorin::Def::projs().

◆ normalize_insert()

Ref thorin::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 thorin::World::raw_app(), and thorin::Def::world().

◆ normalize_map_reduce()

Ref thorin::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 thorin::World::raw_app(), and thorin::Def::world().

◆ normalize_prod()

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

Definition at line 104 of file normalizers.cpp.

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

◆ normalize_read()

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

Normalizer for read opertions.

Definition at line 19 of file normalizers.cpp.

References thorin::Def::projs(), and thorin::Def::world().

◆ normalize_shape()

Ref thorin::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 thorin::Def::projs(), and thorin::Def::world().

◆ normalize_transpose()

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

Definition at line 109 of file normalizers.cpp.

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

◆ op_read()

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

◆ register_normalizers()

void thorin::plug::matrix::register_normalizers ( Normalizers normalizers)

Referenced by thorin_get_plugin().

◆ zero_int()

const Def * thorin::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

constexpr plugin_t thorin::plug::matrix::Plugin_Id = 0x3825532990000000
staticconstexpr

Definition at line 10 of file autogen.h.