Fix LTC build

pt2_phase1
Stella Laurenzo 2023-11-02 13:55:45 -07:00
parent 823e051344
commit 8069d8da89
4 changed files with 11 additions and 11 deletions

2
.gitignore vendored
View File

@ -26,7 +26,7 @@ __pycache__
bazel-* bazel-*
# Autogenerated files # Autogenerated files
/python/torch_mlir/csrc/base_lazy_backend/generated /projects/pt1/python/torch_mlir/csrc/base_lazy_backend/generated
#Docker builds #Docker builds
build_oot/ build_oot/

View File

@ -29,7 +29,7 @@ if not TORCH_INCLUDE_DIR.is_dir():
TORCH_INCLUDE_DIR = TORCH_DIR TORCH_INCLUDE_DIR = TORCH_DIR
TORCHGEN_DIR = Path(torchgen.__path__[0]).resolve() TORCHGEN_DIR = Path(torchgen.__path__[0]).resolve()
TORCH_MLIR_DIR = Path(__file__).resolve().parent.parent TORCH_MLIR_DIR = Path(__file__).resolve().parent.parent
TORCH_MLIR_PT1_DIR = TORCH_MLIR_DIR / "projects" / "pt1"
def reindent(text, prefix=""): def reindent(text, prefix=""):
return indent(dedent(text), prefix) return indent(dedent(text), prefix)
@ -114,12 +114,12 @@ class GenTorchMlirLTC:
self.binary_dir = Path(binary_dir) self.binary_dir = Path(binary_dir)
assert self.binary_dir.is_dir(), f"Binary directory not found: {self.binary_dir}" assert self.binary_dir.is_dir(), f"Binary directory not found: {self.binary_dir}"
self.source_yaml = self.binary_dir.joinpath("generated_native_functions.yaml") self.source_yaml = self.binary_dir.joinpath("generated_native_functions.yaml")
self.backend_path = TORCH_MLIR_DIR.joinpath( self.backend_path = TORCH_MLIR_PT1_DIR.joinpath(
"python", "torch_mlir", "csrc", "base_lazy_backend" "python", "torch_mlir", "csrc", "base_lazy_backend"
) )
assert self.backend_path.is_dir() assert self.backend_path.is_dir(), f"Backend path not found: {self.backend_path}"
self.generated_path = self.binary_dir.joinpath( self.generated_path = self.binary_dir.joinpath(
"python", "torch_mlir", "csrc", "base_lazy_backend", "generated" "projects", "pt1", "python", "torch_mlir", "csrc", "base_lazy_backend", "generated"
) )
self.generated_path.mkdir(parents=True, exist_ok=True) self.generated_path.mkdir(parents=True, exist_ok=True)

View File

@ -22,7 +22,7 @@ include_directories(BEFORE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/python ${PROJECT_SOURCE_DIR}/projects/pt1/python
) )
link_directories("${TORCH_INSTALL_PREFIX}/lib") link_directories("${TORCH_INSTALL_PREFIX}/lib")
@ -112,13 +112,13 @@ add_custom_command(
add_custom_command( add_custom_command(
TARGET torch_mlir_ltc_backend POST_BUILD TARGET torch_mlir_ltc_backend POST_BUILD
COMMAND cp COMMAND cp
${PROJECT_SOURCE_DIR}/python/torch_mlir/csrc/base_lazy_backend/*.h ${PROJECT_SOURCE_DIR}/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/*.h
${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/) ${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/)
add_custom_command( add_custom_command(
TARGET torch_mlir_ltc_backend POST_BUILD TARGET torch_mlir_ltc_backend POST_BUILD
COMMAND cp COMMAND cp
${PROJECT_SOURCE_DIR}/python/torch_mlir/csrc/base_lazy_backend/generated/*.h ${PROJECT_SOURCE_DIR}/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/generated/*.h
${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/generated/) ${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/generated/)
add_custom_command( add_custom_command(
@ -129,7 +129,7 @@ add_custom_command(
add_custom_command( add_custom_command(
TARGET torch_mlir_ltc_backend POST_BUILD TARGET torch_mlir_ltc_backend POST_BUILD
COMMAND cp COMMAND cp
${PROJECT_SOURCE_DIR}/python/torch_mlir/csrc/base_lazy_backend/ops/*.h ${PROJECT_SOURCE_DIR}/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/ops/*.h
${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/ops/) ${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/ops/)
add_custom_command( add_custom_command(
@ -140,5 +140,5 @@ add_custom_command(
add_custom_command( add_custom_command(
TARGET torch_mlir_ltc_backend POST_BUILD TARGET torch_mlir_ltc_backend POST_BUILD
COMMAND cp COMMAND cp
${PROJECT_SOURCE_DIR}/python/torch_mlir/csrc/base_lazy_backend/utils/*.h ${PROJECT_SOURCE_DIR}/projects/pt1/python/torch_mlir/csrc/base_lazy_backend/utils/*.h
${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/utils/) ${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/utils/)

View File

@ -39,7 +39,7 @@ if(TORCH_MLIR_ENABLE_LTC)
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}
${PYTHON_H_DIR} ${PYTHON_H_DIR}
${PROJECT_SOURCE_DIR}/python ${PROJECT_SOURCE_DIR}/projects/pt1/python
) )
link_directories("${TORCH_INSTALL_PREFIX}/lib") link_directories("${TORCH_INSTALL_PREFIX}/lib")
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib) link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)