openxla / stablehlo

Backward compatible ML compute opset inspired by HLO/MHLO
Apache License 2.0
363 stars 101 forks source link

Refactor CMakeList to work for all build types #2430

Closed GleasonK closed 2 weeks ago

GleasonK commented 2 weeks ago

This setup is based on: How_to_Build_your_own_MLIR_Dialect.pdf

# There are 3 build modes, one will be set to ON
#  - Standalone: Build MLIR as a part of StableHLO
#  - External: StableHLO built as an external LLVM project (XLA/MHLO uses this)
#  - Embedded: StableHLO built as a part of another MLIR project (torch-mlir uses this)
#
# If building as part of another project, let it handle the MLIR dependency.
# The dependent project might use a bundled version of MLIR instead of installing.

Tested using mlir-hlo repo. No changes to the EMBEDDED build so should not impact torch-mlir.

GleasonK commented 2 weeks ago

cc @qingyunqu -- I don't think this should change the torch-mlir STABLEHLO_BUILD_EMBEDDED workflow, but would be good to confirm if you have a moment to patch this in

qingyunqu commented 2 weeks ago

cc @qingyunqu -- I don't think this should change the torch-mlir STABLEHLO_BUILD_EMBEDDED workflow, but would be good to confirm if you have a moment to patch this in

Ok, I will confirm this when update stablehlo in torch-mlir.