From 8fd409a4a15b568464ed2dd3d9d931aa4b84b94e Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Mon, 13 Jul 2026 16:12:56 -0500 Subject: [PATCH] fix spurious recompilation on incremental editable builds --- build_tools/build_ext.py | 13 +++++++++++++ .../gemm/ck_grouped_gemm/ck_grouped_gemm_common.h | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/build_tools/build_ext.py b/build_tools/build_ext.py index 31bb4392d6..2559d4c7b9 100644 --- a/build_tools/build_ext.py +++ b/build_tools/build_ext.py @@ -113,6 +113,19 @@ def get_build_ext( class _CMakeBuildExtension(extension_cls): """Setuptools command with support for CMake extension modules""" + def finalize_options(self) -> None: + super().finalize_options() + # Persist the intermediate object directory (build_temp) across builds. + # Framework extensions (e.g. transformer_engine_torch) are compiled by + # setuptools/pip into build_temp, but pip normally points it at an + # ephemeral temp dir, so every `pip install` recompiles all objects from + # scratch. Rooting it at a stable location lets the underlying ninja skip + # unchanged objects. Mirrors the persistent CMake build dir above. + root_dir = Path(__file__).resolve().parent.parent + build_temp = root_dir / "build" / "torch_temp" + build_temp.mkdir(parents=True, exist_ok=True) + self.build_temp = str(build_temp) + def run(self) -> None: # Build CMake extensions for ext in self.extensions: diff --git a/transformer_engine/common/gemm/ck_grouped_gemm/ck_grouped_gemm_common.h b/transformer_engine/common/gemm/ck_grouped_gemm/ck_grouped_gemm_common.h index de2bdb9858..7a75f192f2 100644 --- a/transformer_engine/common/gemm/ck_grouped_gemm/ck_grouped_gemm_common.h +++ b/transformer_engine/common/gemm/ck_grouped_gemm/ck_grouped_gemm_common.h @@ -18,7 +18,7 @@ #include "common/util/cuda_runtime.h" #include "../../common.h" -#include "../../common/util/system.h" +#include "../../util/system.h" #include "ck_tile/core.hpp" #include "ck_tile/host/kernel_launch.hpp"