tenstorrent / tt-mlir

Tenstorrent MLIR compiler
https://tenstorrent.github.io/tt-mlir/
Apache License 2.0
76 stars 13 forks source link

Binary op operand swap #1124

Open jnie-TT opened 3 weeks ago

jnie-TT commented 3 weeks ago

We're currently swapping the operands for binary ops in runtime if the lhs operand is smaller (and requires broadcast onto the rhs operand).

  // Switch the order of operands if the second operand requires broadcast
  if ((*rhs)->volume() < (*lhs)->volume()) {
    std::swap(*lhs, *rhs);
  }

Metal will push a fix on their side, once we uplift their fix we should remove this workaround.

Blocked by https://github.com/tenstorrent/tt-metal/issues/13566

uazizTT commented 3 weeks ago

We don't intend to fix it in the compiler as it should be fixed in tt-metal, this is the reported issue in tt-metal to track it. https://github.com/tenstorrent/tt-metal/issues/13566

Once tt-metal fixes it on their end, this workaround can be removed, but until then it can be guarded as a workaround in runtime.

jnie-TT commented 3 weeks ago

Thanks @uazizTT I'll keep this issue open to track this on the mlir side, once metal merges a fix and we uplift it, I'll remove the workaround and close this issue.