Skip to content

Commit bf36732

Browse files
committed
up
1 parent 0f03f2b commit bf36732

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

backends/mlx/runtime/MLXInterpreter.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ inline std::vector<int> infer_shape_with_minus_one(
9898

9999
inline void exec_noop(const NoopNode&, ExecutionState&, StreamOrDevice) {}
100100

101+
inline void
102+
exec_id_copy(const IdCopyNode& n, ExecutionState& st, StreamOrDevice) {
103+
st.set_tensor(n.out, st.const_tensor_ref(n.x));
104+
}
105+
101106
inline void
102107
exec_addmm(const AddmmNode& n, ExecutionState& st, StreamOrDevice s) {
103108
const auto& mat1 = st.const_tensor_ref(n.mat1);
@@ -154,6 +159,9 @@ class Interpreter {
154159
case OpCode::NOOP:
155160
ops::exec_noop(std::get<NoopNode>(instr.node), st, s);
156161
break;
162+
case OpCode::ID_COPY:
163+
ops::exec_id_copy(std::get<IdCopyNode>(instr.node), st, s);
164+
break;
157165
case OpCode::ADDMM:
158166
ops::exec_addmm(std::get<AddmmNode>(instr.node), st, s);
159167
break;

backends/mlx/serialization/schema.fbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ table IntOrVidOrTid {
7272

7373
table NoopNode {}
7474

75+
table IdCopyNode {
76+
x: Tid (required);
77+
out: Tid (required);
78+
}
79+
7580
table AddmmNode {
7681
mat1: Tid (required); // First matrix
7782
mat2: Tid (required); // Second matrix
@@ -89,6 +94,7 @@ table AddmmNode {
8994
// Reordering or removing members changes numeric type IDs and breaks existing .pte files.
9095
union OpNode {
9196
NoopNode,
97+
IdCopyNode,
9298
AddmmNode
9399
// BC: Add new op nodes here (append only)
94100
}

0 commit comments

Comments
 (0)