tenstorrent / tt-mlir

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

Adding sqrt op in ttmlir e2e #438

Closed sdjordjevicTT closed 3 weeks ago

sdjordjevicTT commented 3 weeks ago

We need to implement the square root operation end-to-end for the next milestone of bringing up LLama.

Solves: https://github.com/tenstorrent/tt-mlir/issues/418

tapspatel commented 3 weeks ago

You can add your sqrt.mlir to automatically generate ttnn files. I added docs on how to do that here: https://docs.tenstorrent.com/tt-mlir/ttrt.html#adding-llvm-lit-config-options-inside-a-mlir-file-to-create-flatbuffer-binaries.

  1. Copy your .mlir file into /test/ttmlir/Silicon/TTNN
  2. Add relevant llvm-lit configs (for ex: --ttir-load-system-desc="path=%system_desc_path%")

To test (see https://docs.tenstorrent.com/tt-mlir/ttrt.html#generate-flatbuffer-files-using-llvm-lit)

  1. cmake --build build -- check-ttmlir
  2. ttrt run build/test/ttmlir/Silicon/TTNN

Inside build/test/ttmlir/Silicon, your sqrt.ttnn file should've been generated.

sdjordjevicTT commented 3 weeks ago

You can add your sqrt.mlir to automatically generate ttnn files. I added docs on how to do that here: https://docs.tenstorrent.com/tt-mlir/ttrt.html#adding-llvm-lit-config-options-inside-a-mlir-file-to-create-flatbuffer-binaries.

  1. Copy your .mlir file into /test/ttmlir/Silicon/TTNN
  2. Add relevant llvm-lit configs (for ex: --ttir-load-system-desc="path=%system_desc_path%")

To test (see https://docs.tenstorrent.com/tt-mlir/ttrt.html#generate-flatbuffer-files-using-llvm-lit)

  1. cmake --build build -- check-ttmlir
  2. ttrt run build/test/ttmlir/Silicon/TTNN

Inside build/test/ttmlir/Silicon, your sqrt.ttnn file should've been generated.

Great, thanks for this @tapspatel