mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Delete functorch C extension entirely. (#163340)
Signed-off-by: Edward Yang <ezyang@meta.com> Pull Request resolved: https://github.com/pytorch/pytorch/pull/163340 Approved by: https://github.com/aorenste, https://github.com/wdvr, https://github.com/albanD, https://github.com/malfet
This commit is contained in:
committed by
PyTorch MergeBot
parent
f68de58c9d
commit
2c5a3d7e60
26
setup.py
26
setup.py
@ -382,12 +382,6 @@ def _get_package_path(package_name: str) -> Path:
|
||||
BUILD_LIBTORCH_WHL = str2bool(os.getenv("BUILD_LIBTORCH_WHL"))
|
||||
BUILD_PYTHON_ONLY = str2bool(os.getenv("BUILD_PYTHON_ONLY"))
|
||||
|
||||
# set up appropriate env variables
|
||||
if BUILD_LIBTORCH_WHL:
|
||||
# Set up environment variables for ONLY building libtorch.so and not libtorch_python.so
|
||||
# functorch is not supported without python
|
||||
os.environ["BUILD_FUNCTORCH"] = "OFF"
|
||||
|
||||
if BUILD_PYTHON_ONLY:
|
||||
os.environ["BUILD_LIBTORCHLESS"] = "ON"
|
||||
os.environ["LIBTORCH_LIB_PATH"] = (_get_package_path("torch") / "lib").as_posix()
|
||||
@ -1250,21 +1244,6 @@ class build_ext(setuptools.command.build_ext.build_ext):
|
||||
def build_extensions(self) -> None:
|
||||
self.create_compile_commands()
|
||||
|
||||
build_lib = Path(self.build_lib).resolve()
|
||||
|
||||
# Copy functorch extension
|
||||
for ext in self.extensions:
|
||||
if ext.name != "functorch._C":
|
||||
continue
|
||||
fullname = self.get_ext_fullname(ext.name)
|
||||
filename = Path(self.get_ext_filename(fullname))
|
||||
src = filename.with_stem("functorch")
|
||||
dst = build_lib / filename
|
||||
if src.exists():
|
||||
report(f"Copying {ext.name} from {src} to {dst}")
|
||||
dst.parent.mkdir(parents=True, exist_ok=True)
|
||||
self.copy_file(src, dst)
|
||||
|
||||
super().build_extensions()
|
||||
|
||||
def get_outputs(self) -> list[str]:
|
||||
@ -1552,11 +1531,6 @@ def configure_extension_build() -> tuple[
|
||||
)
|
||||
ext_modules.append(C)
|
||||
|
||||
# These extensions are built by cmake and copied manually in build_extensions()
|
||||
# inside the build_ext implementation
|
||||
if cmake_cache_vars["BUILD_FUNCTORCH"]:
|
||||
ext_modules.append(Extension(name="functorch._C", sources=[]))
|
||||
|
||||
cmdclass = {
|
||||
"bdist_wheel": bdist_wheel,
|
||||
"build_ext": build_ext,
|
||||
|
Reference in New Issue
Block a user