MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
matrix.h
Go to the documentation of this file.
1#pragma once
2
3#include <mim/world.h>
4
7
9
10/// Reads element `idx` from a matrix (represented by a `%buffer.Buf`), threading `mem`.
11inline const Def* op_read(const Def* mem, const Def* matrix, const Def* idx) {
12 auto buf_ty = Axm::isa<buffer::Buf>(matrix->type());
13 if (!buf_ty) return matrix;
14 auto [n, S, T] = buf_ty->args<3>();
15 return buffer::op_read(n, S, T, mem, matrix, idx);
16}
17
18} // namespace mim::plug::matrix
static auto isa(const Def *def)
Definition axm.h:107
Base class for all Defs.
Definition def.h:261
const Def * op_read(const Def *r, const Def *s, const Def *T, const Def *mem, const Def *buf, const Def *idx)
buffer.read (r, s, T) (mem, buf, idx) ↦ [mem.M 0, T].
Definition buffer.h:22
The matrix Plugin
Definition matrix.h:8
const Def * op_read(const Def *mem, const Def *matrix, const Def *idx)
Reads element idx from a matrix (represented by a buffer.Buf), threading mem.
Definition matrix.h:11
The mem Plugin
Definition mem.h:11