commit | 8da4564c4689f529d05611887423077eaacbfd01 | [log] [tgz] |
---|---|---|
author | Nirvedh Meshram <96096277+nirvedhmeshram@users.noreply.github.com> | Thu Aug 22 18:49:29 2024 -0500 |
committer | GitHub <noreply@github.com> | Thu Aug 22 23:49:29 2024 +0000 |
tree | d357de0664b60482e2e4e61fcbc4180f7ef71a6f | |
parent | 588732ce4402618aa6b339228efbbee2d35f222a [diff] |
Revert "[Flow] Convert from tensor.cast to flow.tensor.reshape early …(#18256)" (#18331) This reverts commit 1c0c5a6ff64bedb1cb1275eaba16aab3fc26acdf. This is causing an issue with https://github.com/iree-org/iree/actions/runs/10505447157/job/29119827242#step:5:2269 iree/tests/e2e/regression/check_regression_llvm-cpu_layernorm.mlir Triaging the bug I see that one of the dispatches is slightly different but should result to the same numerics but it does not Here is how the problem dispatch used to be originally ``` func.func @old_dispatch2(%11 : tensor<128x384xf32>, %12: tensor<128xf32>) -> tensor<128x384xf32> { %cst = arith.constant 5.000000e+00 : f32 %cst_0 = arith.constant 0.000000e+00 : f32 %13 = tensor.empty() : tensor<128x384xf32> %14 = tensor.empty() : tensor<128xf32> %15 = linalg.fill ins(%cst_0 : f32) outs(%14 : tensor<128xf32>) -> tensor<128xf32> %16 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = ["parallel", "reduction"]} ins(%11 : tensor<128x384xf32>) outs(%15 : tensor<128xf32>) { ^bb0(%in: f32, %out: f32): %18 = arith.addf %in, %out : f32 linalg.yield %18 : f32 } -> tensor<128xf32> %17 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%11, %16, %12 : tensor<128x384xf32>, tensor<128xf32>, tensor<128xf32>) outs(%13 : tensor<128x384xf32>) { ^bb0(%og_in : f32, %in: f32, %in_1: f32, %out: f32): %18 = arith.mulf %in, %in_1 : f32 %19 = arith.subf %og_in, %18 : f32 linalg.yield %19 : f32 } -> tensor<128x384xf32> return %17 : tensor<128x384xf32> } ``` with the reverting PR this dispatch is becoming ``` func.func @new_dispatch2(%11 : tensor<128x384xf32>, %12: tensor<128xf32>) -> tensor<128x384xf32> { %cst = arith.constant 5.000000e+00 : f32 %cst_0 = arith.constant 0.000000e+00 : f32 %13 = tensor.empty() : tensor<128x384xf32> %14 = tensor.empty() : tensor<128xf32> %15 = linalg.fill ins(%cst_0 : f32) outs(%14 : tensor<128xf32>) -> tensor<128xf32> %16 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = ["parallel", "reduction"]} ins(%11 : tensor<128x384xf32>) outs(%15 : tensor<128xf32>) { ^bb0(%in: f32, %out: f32): %18 = arith.addf %in, %out : f32 linalg.yield %18 : f32 } -> tensor<128xf32> %17 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = ["parallel", "parallel"]} ins(%16, %12 : tensor<128xf32>, tensor<128xf32>) outs(%13 : tensor<128x384xf32>) { ^bb0(%in: f32, %in_1: f32, %out: f32): %18 = arith.mulf %in, %in_1 : f32 %19 = arith.subf %cst, %18 : f32 linalg.yield %19 : f32 } -> tensor<128x384xf32> return %17 : tensor<128x384xf32> } ``` The difference is at `%19 = arith.subf %cst, %18 : f32` Note that in both cases `%11 : tensor<128x384xf32>` is `5.0` from the model input and hence the output *should* be same, however on `arch64` it is not but on x86 it is, the IR at the mlir llvm dialect is identicalbetween x86 and arch64 so its not some easy to spot intrinsics / fast math kind of bug AFAICS
IREE (Intermediate Representation Execution Environment, pronounced as “eerie”) is an MLIR-based end-to-end compiler and runtime that lowers Machine Learning (ML) models to a unified IR that scales up to meet the needs of the datacenter and down to satisfy the constraints and special considerations of mobile and edge deployments.
See our website for project details, user guides, and instructions on building from source.
IREE is still in its early phase. We have settled down on the overarching infrastructure and are actively improving various software components as well as project logistics. It is still quite far from ready for everyday use and is made available without any support at the moment. With that said, we welcome any kind of feedback on any communication channels
Package | Release status |
---|---|
GitHub release (stable) | |
GitHub release (nightly) | |
Python iree-compiler | |
Python iree-runtime |
Host platform | Build status |
---|---|
Linux | |
macOS | |
Windows |
For the full list of workflows see https://iree.dev/developers/general/github-actions/.
See our website for more information.
Community meeting recordings: IREE YouTube channel
IREE is licensed under the terms of the Apache 2.0 License with LLVM Exceptions. See LICENSE for more information.