-
Notifications
You must be signed in to change notification settings - Fork 504
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
[RFC] Lowering aten::_index_put_impl_ into tm_tensor.scatter op #616
Comments
This op is quite tricky. We need to transform the operands meet the requirement for for tm_tensor.scatter Line 99 in ba29d4f
(assuming readers are familiar with both For all indices tensors:
For
Some steps above are more convenient to be decomposed to other torch ops (like flatten to 1d tensor, unsqueeze, concatenate), some are more convenient to be converted directly to tm_tensor or linalg ops. The conversion should go into We might not be able to handle all the cases |
Do you mean a mix of torch and TMTensor ops? I think this pass would naturally be the scope of a ConvertTorchToTMTensor pass. |
sry, I meant a mixed of torch and linalg/tmtensor ops.
We have another pass called lowerAlgorithmicOps #574 which lowers algorithmic torch ops to linalg and tm_tensor ops. I feel calling |
I left a comment in #574. I think that there should be LowerAlgorithmicOps (similar to DecomposeComplexOps) as a Torch->Torch lowering. Then ConvertTorchToTMTensor which happens in backends (i.e. after the Torch backend contract, just before ConvertTorchToLinalg). |
Ha, I see. There seems to be confusion about passes naming. I updated my comments. Thanks for clarifying this! |
Hi @cathyzhyi @silvasean
I have gone through the comments mentioned above. Since this op seems a bit complex, should we implement this op as of now for the cases required, which is a 1-d tensor of indices and a 1-d tensor of values with |
Starting with the 1D version of this and emitting a clear diagnostic for the unsupported cases seems like a good incremental first step. |
closed by #650 |
…lvm#616) * Generate files per configuration & refer to them as such This is a step towards fully supporting multi-config generators such as VS and Xcode. Right now, the generated files as well as path to files in the project point to a single location which often does not exist unless CMAKE_BUILD_TYPE was specified on the command line which defeats the purpose of multi-config. This change does a few things: 1) Files that are generated by the build now reside in the config directory when using a multi-config generator. For example, instead of: src/ExternalUtil.hpp, when using VS or Xcode, we have: src/Debug/ExternalUtil.hpp, etc. 2) The targets that use the generated files now have an explicit dependency 3) The lit configuration now correctly refers to the binaries in the onnx-mlir build tree per configuration 4) The paths to onnx-mlir and the build directories are correct in the generated files 5) Executables now have the right extensions when they are referenced in tools and scripts 6) A couple of unnecessary variables are removed Bonus: move the CTest includes where they are needed After this change, the path to LLVM_PROJ_BIN is still not correct always since it still refers to CMAKE_BUILD_TYPE which is not always known at configuration time. This can be fixed by using find_package(LLVM) or find_package(MLIR). Using find_package is optimal, but it is a bigger change, so I am splitting it from the file generation for simplicity. The find_package(MLIR) change will be sent for review after this change (and maybe a couple more simple ones) is in. Signed-off-by: Stella Stamenova <stilis@microsoft.com> * Correctly generate the files for single generators as well Signed-off-by: Stella Stamenova <stilis@microsoft.com> * Unfortunately, generator expressions are not enough to make this work and we have to do it the hard way Signed-off-by: Stella Stamenova <stilis@microsoft.com> * Fix a copy-paste error Signed-off-by: Stella Stamenova <stilis@microsoft.com> * Fix another copy-paste error because apparently I need to learn how to copy-paste Signed-off-by: Stella Stamenova <stilis@microsoft.com> * Make all python string raw strings - on (windows) systems where the path contains short directories such as a, \a ends up being treated as a special character causing failures Signed-off-by: Stella Stamenova <stilis@microsoft.com> * Add comments to explain the usage of CMAKE_CFG_INTDIR and add it for lit as well for consistency Signed-off-by: Stella Stamenova <stilis@microsoft.com> * Don't move the ctest include It is not pertinent to the multiconfig changes and it is causing a weird issue with test generation on some platforms Signed-off-by: Stella Stamenova <stilis@microsoft.com> * After thinking through the problem some more, we can simplify the logic for the generation of the files by using generator expressions in a couple of more places including the CMAKE_*_OUTPUT_DIRECTORY properties which support generator expressions. This allows the files to be generated for each config option and then we can always reference them in that location by using CMAKE_BUILD_TYPE when dealing with a single-config generator. By making this change this way, the CMAKE_*_OUTPUT_DIRECTORY set now fully controls where all of the outputs are located which means that if we wanted to align with LLVM for the binary layout, it is a simple 3-line change. Signed-off-by: Stella Stamenova <stilis@microsoft.com> * Add comment in runtime/jni/cmakelists.txt to explain why we need to copy the file. Signed-off-by: Stella Stamenova <stilis@microsoft.com> * Set the build path for both single- and multi-config generators to contain the build mode. For example, build_dir/bin/release and build_dir/lib_release Signed-off-by: Stella Stamenova <stilis@microsoft.com> * Change the build paths for onnx-mlir from build_dir/bin/release to build_dir/release/bin Signed-off-by: Stella Stamenova <stilis@microsoft.com> Co-authored-by: Kevin O'Brien <caomhin@us.ibm.com>
…ering (#3351) Addresses [Shark-Turbine #196](nod-ai/SHARK-TestSuite#196) Related tracker [Shark-Turbine #566](nod-ai/SHARK-ModelDev#566) Related onnx.Resize issues [Shark-Turbine #616](nod-ai/SHARK-ModelDev#616)
…ering (llvm#3351) Addresses [Shark-Turbine llvm#196](nod-ai/SHARK-TestSuite#196) Related tracker [Shark-Turbine llvm#566](nod-ai/SHARK-ModelDev#566) Related onnx.Resize issues [Shark-Turbine llvm#616](nod-ai/SHARK-ModelDev#616)
…ering (llvm#3351) Addresses [Shark-Turbine llvm#196](nod-ai/SHARK-TestSuite#196) Related tracker [Shark-Turbine llvm#566](nod-ai/SHARK-ModelDev#566) Related onnx.Resize issues [Shark-Turbine llvm#616](nod-ai/SHARK-ModelDev#616)
(#614)
The text was updated successfully, but these errors were encountered: