tenstorrent / tt-mlir

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

[StableHLO] get_dimension op failure for unsupported data types #1318

Closed mmanzoorTT closed 3 days ago

mmanzoorTT commented 4 days ago

StableHLO->TTIR conversion fails for get_dimension op for unsupported HW datatypes (e.g. boolean, i64, f64). Some example stablehlo graph

  func.func public @test_get_dimension_size_f64(%arg0: tensor<64x64xf64>) -> tensor<i32> {
    %0 = stablehlo.get_dimension_size %arg0, dim = 1 : (tensor<64x64xf64>) -> tensor<i32>
    return %0 : tensor<i32>
  }

Error message

error: failed to legalize unresolved materialization from ('tensor<64x64xf32>') to 'tensor<64x64xf64>' that remained live after conversion
    func.func public @test_get_dimension_size_f64(%arg0: tensor<64x64xf64>) -> tensor<i32> {
                                                  ^
tt-mlir/test/ttmlir/Conversion/StableHLOToTTIR/test.mlir:4:51: note: see current operation: %0 = "builtin.unrealized_conversion_cast"(%arg0) : (tensor<64x64xf32>) -> tensor<64x64xf64>
tt-mlir/test/ttmlir/Conversion/StableHLOToTTIR/test.mlir:6:10: note: see existing live user here: %1 = "ttir.get_dimension_size"(%0) <{dimension = 1 : i32}> : (tensor<64x64xf64>) -> tensor<1xi32>
    %0 = stablehlo.get_dimension_size %arg0, dim = 1 : (tensor<64x64xf64>) -> tensor<i32>