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

Issues to folders used for shape refinement #2278

Open
sdasgup3 opened this issue May 2, 2024 · 0 comments
Open

Issues to folders used for shape refinement #2278

sdasgup3 opened this issue May 2, 2024 · 0 comments
Labels

Comments

@sdasgup3
Copy link
Member

sdasgup3 commented May 2, 2024

Here are some of the problematic shape-refinement foldings.

$ cat file1.mlir 
func.func @add_op_test_i1() {
  %0 = stablehlo.constant dense<[false, false, true, true]> : tensor<4xi1>
  %1 = stablehlo.constant dense<[false, true, false, true]> : tensor<4xi1>
  %2 = stablehlo.add %0, %1 : tensor<4xi1>
  check.expect_eq_const %2, dense<[false, true, true, true]> : tensor<4xi1>
  func.return
}

$ ./bin/stablehlo-opt --stablehlo-refine-shapes  file.mlir
func.func @add_op_test_i1() {
    %c = stablehlo.constant dense<[false, true, true, false]> : tensor<4xi1>
    check.expect_eq_const %c, dense<[false, true, true, true]> : tensor<4xi1>
    return
  }


$ cat file.mlir
func.func @select_op_test_si64_scalar() {
  %pred = stablehlo.constant dense<false> : tensor<i1>
  %on_true = stablehlo.constant dense<[2, 3, -1]> : tensor<3xi64>
  %on_false = stablehlo.constant dense<[3, 7, -3]> : tensor<3xi64>
  %result = stablehlo.select %pred, %on_true, %on_false : (tensor<i1>, tensor<3xi64>, tensor<3xi64>) -> tensor<3xi64>
  check.expect_eq_const %result, dense<[3, 7, -3]> : tensor<3xi64>
  func.return
}

$ ./bin/stablehlo-opt --stablehlo-refine-shapes  file.mlir
 func.func @select_op_test_si64_scalar() {
    %c = stablehlo.constant dense<3> : tensor<3xi64>
    check.expect_eq_const %c, dense<[3, 7, -3]> : tensor<3xi64>
    return
  }

$ cat file.mlir
func.func @clamp_op_test_si64_min_scalar() {
  %min = stablehlo.constant dense<[0, 0, -2]> : tensor<3xi64>
  %operand = stablehlo.constant dense<[2, 3, -1]> : tensor<3xi64>
  %max = stablehlo.constant dense<1> : tensor<i64>
  %result = stablehlo.clamp %min, %operand, %max : (tensor<3xi64>, tensor<3xi64>, tensor<i64>) -> tensor<3xi64>
  check.expect_eq_const %result, dense<[1, 1, -1]> : tensor<3xi64>
  func.return
}

$ ./bin/stablehlo-opt --stablehlo-refine-shapes  file.mlir
 func.func @clamp_op_test_si64_min_scalar() {
    %c = stablehlo.constant dense<1> : tensor<3xi64>
    check.expect_eq_const %c, dense<[1, 1, -1]> : tensor<3xi64>
    return
  }

The issues can be categorised into the following:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant