Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
929 changes: 929 additions & 0 deletions backends/mlx/_generated_inspector.py

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions backends/mlx/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
AsStridedNode,
AsTypeNode,
Atan2Node,
BitwiseXorNode,
BroadcastToNode,
CeilNode,
ClipNode,
Expand Down Expand Up @@ -490,6 +491,12 @@ def handler(P: MLXProgramBuilder, n: Node) -> Slot:
"aten.ne",
True,
),
(
[torch.ops.aten.bitwise_xor.Tensor, torch.ops.aten.bitwise_xor.Scalar],
BitwiseXorNode,
"aten.bitwise_xor",
True,
),
]


Expand Down
11 changes: 11 additions & 0 deletions backends/mlx/runtime/MLXInterpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,13 @@ exec_logical_or(const LogicalOrNode& n, ExecutionState& st, StreamOrDevice s) {
n.out, logical_or(st.const_tensor_ref(n.a), st.const_tensor_ref(n.b), s));
}

inline void exec_bitwise_xor(
const BitwiseXorNode& n, ExecutionState& st, StreamOrDevice s) {
st.set_tensor(
n.out,
bitwise_xor(st.const_tensor_ref(n.a), st.const_tensor_ref(n.b), s));
}

inline void exec_tri(const TriNode& n, ExecutionState& st, StreamOrDevice s) {
int rows = resolve_int(n.n, st);
int cols = resolve_int(n.m, st);
Expand Down Expand Up @@ -2227,6 +2234,10 @@ class Interpreter {
case OpCode::METAL_KERNEL:
ops::exec_metal_kernel(std::get<MetalKernelNode>(instr.node), st, s);
break;
case OpCode::BITWISE_XOR:
ops::exec_bitwise_xor(
std::get<BitwiseXorNode>(instr.node), st, s);
break;
default:
throw std::runtime_error(
"Unknown opcode: " + std::to_string(static_cast<int>(instr.op)));
Expand Down
Loading
Loading