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

[cmake] Enable accepting external stablehlo project #3927

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shelkesagar29
Copy link

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.

@shelkesagar29
Copy link
Author

@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.
Copy link
Collaborator

@stellaraccident stellaraccident left a 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})
Copy link
Member

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.

Comment on lines +244 to +247
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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually

Suggested change
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.

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

Successfully merging this pull request may close these issues.

3 participants