Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions build_tools/build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: naming — torch_temp reads as PyTorch-specific, but get_build_ext() is also called from transformer_engine/jax/setup.py:60, so JAX ext objects will land under build/torch_temp/ too. Since both frameworks share this dir, a framework-neutral name like ext_temp (or framework_temp) would be less confusing when someone stumbles into it later. No functional impact — ninja tracks objects by source path so pytorch/jax objects won't collide.

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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading