-
Notifications
You must be signed in to change notification settings - Fork 515
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
[cmake] Enable accepting external stablehlo project #3927
base: main
Are you sure you want to change the base?
Conversation
@powderluv can you please help review? |
This MR enables `torch_mlir` project to accept path to external stablehlo and include those directories. This in turn enables `torch_mlir` to be part of bigger compiler project when `stablehlo` is already a dependency.
09e7068
to
e782023
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marbre for visibility (he was talking about possibly modernizing some of the cmake goo around this)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/externals/stablehlo) | ||
if (NOT "${TORCH_MLIR_EXTERNAL_STABLEHLO_DIR}" STREQUAL "") | ||
# Only include directories. It is assumed that stablehlo targets are made available by external project. | ||
include_directories(${TORCH_MLIR_EXTERNAL_STABLEHLO_DIR}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have assumed that the external project also makes the includes available.
if (NOT "${TORCH_MLIR_EXTERNAL_STABLEHLO_DIR}" STREQUAL "") | ||
# Only include directories. It is assumed that stablehlo targets are made available by external project. | ||
include_directories(${TORCH_MLIR_EXTERNAL_STABLEHLO_DIR}) | ||
else() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually
if (NOT "${TORCH_MLIR_EXTERNAL_STABLEHLO_DIR}" STREQUAL "") | |
# Only include directories. It is assumed that stablehlo targets are made available by external project. | |
include_directories(${TORCH_MLIR_EXTERNAL_STABLEHLO_DIR}) | |
else() | |
# Only configure StableHLO if it isn't provided from a top-level project | |
if ("${TORCH_MLIR_EXTERNAL_STABLEHLO_DIR}" STREQUAL "") |
should be sufficient. In that case I would probably replace the string with a boolean as it seems that the string isn't used elsewhere.
Depending on how the super project is set up (and pulls in torch-mlir and stablehlo) we could consider to add a TORCH_BUILD_EMBEDDED
option, as some parts in the current out-of tree build config might be in responsibility of the super project as well.
This MR enables
torch_mlir
project to accept path to external stablehlo and include those directories. This in turn enablestorch_mlir
to be part of bigger compiler project whenstablehlo
is already adependency.