Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stable HLO runtime tests #1155

Merged
merged 1 commit into from
Nov 15, 2024
Merged

Stable HLO runtime tests #1155

merged 1 commit into from
Nov 15, 2024

Conversation

mmanzoorTT
Copy link
Contributor

@mmanzoorTT mmanzoorTT commented Nov 5, 2024

Requires #1164

@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/stablehlo-runtime-tests branch from 265a5b4 to ed1125f Compare November 5, 2024 15:33
@ddilbazTT
Copy link
Contributor

concat tests fail because it does not support f64. We can replace f64 with f32. The following worked for me:

// REQUIRES: stablehlo
// RUN: rm -rf %t.ttnn
// RUN: ttmlir-opt --stablehlo-to-ttir-pipeline %s | \
// RUN:     ttmlir-opt --ttir-to-ttnn-backend-pipeline="system-desc-path=%system_desc_path%" | \
// RUN:     ttmlir-translate --ttnn-to-flatbuffer > %t.ttnn

module @jit_concat attributes {} {
  func.func public @test_concat(%arg0: tensor<32x32xf32>, %arg1: tensor<32x64xf32>) -> tensor<32x96xf32> {
    %0 = "stablehlo.concatenate"(%arg0, %arg1) {
    dimension = 1 : i64
    } : (tensor<32x32xf32>, tensor<32x64xf32>) -> tensor<32x96xf32>
    return %0 : tensor<32x96xf32>
  }
  func.func public @test_concat_2(%arg0: tensor<3x2xi64>, %arg1: tensor<1x2xi64>) -> tensor<4x2xi64> {
    %0 = "stablehlo.concatenate"(%arg0, %arg1) {
    dimension = 0 : i64
    } : (tensor<3x2xi64>, tensor<1x2xi64>) -> tensor<4x2xi64>
    return %0 : tensor<4x2xi64>
  }
  func.func public @test_concat_3(%arg0: tensor<4x3xf32>, %arg1: tensor<4x5xf32>) -> tensor<4x8xf32> {
    %0 = "stablehlo.concatenate"(%arg0, %arg1) {
    dimension = 1 : i64
    } : (tensor<4x3xf32>, tensor<4x5xf32>) -> tensor<4x8xf32>
    return %0 : tensor<4x8xf32>
  }
  func.func public @test_concat_4(%arg0: tensor<128x64xf32>, %arg1: tensor<128x96xf32>) -> tensor<128x160xf32> {
    %0 = "stablehlo.concatenate"(%arg0, %arg1) {
      dimension = 1 : i64
    } : (tensor<128x64xf32>, tensor<128x96xf32>) -> tensor<128x160xf32>
    return %0 : tensor<128x160xf32>
  }
   func.func public @test_concat_5(%arg0: tensor<256x512xi64>, %arg1: tensor<256x256xi64>) -> tensor<256x768xi64> {
    %0 = "stablehlo.concatenate"(%arg0, %arg1) {
      dimension = 1 : i64
    } : (tensor<256x512xi64>, tensor<256x256xi64>) -> tensor<256x768xi64>
    return %0 : tensor<256x768xi64>
  }
   func.func public @test_concat_6(%arg0: tensor<64x32xi64>, %arg1: tensor<64x64xi64>) -> tensor<64x96xi64> {
    %0 = "stablehlo.concatenate"(%arg0, %arg1) {
      dimension = 1 : i64
    } : (tensor<64x32xi64>, tensor<64x64xi64>) -> tensor<64x96xi64>
    return %0 : tensor<64x96xi64>
  }
  func.func public @test_concat_7(%arg0: tensor<1000x128xi32>, %arg1: tensor<500x128xi32>) -> tensor<1500x128xi32> {
    %0 = "stablehlo.concatenate"(%arg0, %arg1) {
      dimension = 0 : i64
    } : (tensor<1000x128xi32>, tensor<500x128xi32>) -> tensor<1500x128xi32>
    return %0 : tensor<1500x128xi32>
  }
  func.func public @test_concat_8(%arg0: tensor<3x2x4x5xf32>, %arg1: tensor<3x2x4x3xf32>) -> tensor<3x2x4x8xf32> {
    %0 = "stablehlo.concatenate"(%arg0, %arg1) {
      dimension = 3 : i64
    } : (tensor<3x2x4x5xf32>, tensor<3x2x4x3xf32>) -> tensor<3x2x4x8xf32>
    return %0 : tensor<3x2x4x8xf32>
  }
  func.func public @test_concat_9(%arg0: tensor<8x4x6xi32>, %arg1: tensor<8x4x2xi32>) -> tensor<8x4x8xi32> {
    %0 = "stablehlo.concatenate"(%arg0, %arg1) {
      dimension = 2 : i64
    } : (tensor<8x4x6xi32>, tensor<8x4x2xi32>) -> tensor<8x4x8xi32>
    return %0 : tensor<8x4x8xi32>
  }
}

@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/stablehlo-runtime-tests branch 5 times, most recently from 9ce071b to ca64a8e Compare November 8, 2024 19:04
@mmanzoorTT mmanzoorTT marked this pull request as ready for review November 8, 2024 19:06
@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/stablehlo-runtime-tests branch 4 times, most recently from 9372e07 to f76ba92 Compare November 12, 2024 19:45
Copy link
Contributor

@kmitrovicTT kmitrovicTT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have FileCheck directives in silicon tests or not?

@mmanzoorTT
Copy link
Contributor Author

Should we have FileCheck directives in silicon tests or not?

@kmitrovicTT I'll add FileCheck as per slack discussion.

@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/stablehlo-runtime-tests branch 2 times, most recently from ff509d6 to 138ae23 Compare November 15, 2024 04:09
@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/stablehlo-runtime-tests branch from 138ae23 to 4328e2b Compare November 15, 2024 17:11
* Input stablehlo graphs follow through stablehlo->TTIR->TTNN->Flatbuffer piipeline.
* FileCheck is added for TTNN mlir graph.
* TTRT executes the flatbuffer binaries to ensure the functional correctness.
@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/stablehlo-runtime-tests branch from 4328e2b to 8e682e4 Compare November 15, 2024 17:12
@mmanzoorTT mmanzoorTT enabled auto-merge (squash) November 15, 2024 17:14
@mmanzoorTT mmanzoorTT merged commit 3ee0467 into main Nov 15, 2024
17 checks passed
vwellsTT pushed a commit that referenced this pull request Nov 15, 2024
* Input stablehlo graphs follow through stablehlo->TTIR->TTNN->Flatbuffer piipeline.
* FileCheck is added for TTNN mlir graph.
* TTRT executes the flatbuffer binaries to ensure the functional correctness.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants