Skip to content

Use a temp directory for CMake build - #3254

Merged
ptrendx merged 5 commits into
NVIDIA:mainfrom
fheinecke:fred/cmake-build-isolation-1
Aug 7, 2026
Merged

Use a temp directory for CMake build#3254
ptrendx merged 5 commits into
NVIDIA:mainfrom
fheinecke:fred/cmake-build-isolation-1

Conversation

@fheinecke

Copy link
Copy Markdown
Collaborator

Description

CMake currently always uses ./build/cmake as a build directory when NVTE_CMAKE_BUILD_DIR is not set. This causes a couple of issues:

  • Builds can collide with each other
  • Generated files can become stale and require cleaning prior to every build
  • Build files are not cleaned up upon success nor failure

This creates a temporary directory and cleans it up afterwards. Note: this makes it harder to inspect the build directory, because it will now be cleaned up after every run. For this use case I would recommend setting `NVTE_CMAKE_BUILD_DIR="${PWD}/build/cmake" to retain the current behavior. As a result of moving to a temp directory, object files will now not be reused between builds as well.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

Please list the changes introduced in this PR:

  • CMake extension builds are now isolated

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Signed-off-by: Fred Heinecke <fheinecke@nvidia.com>
@fheinecke

Copy link
Copy Markdown
Collaborator Author

/te-ci

@fheinecke

Copy link
Copy Markdown
Collaborator Author

The failing job is a scheduling timeout for a GPU-specific runner that was having some issues next week. Going to assume that it's unrelated.

@fheinecke

Copy link
Copy Markdown
Collaborator Author

/te-ci

@fheinecke
fheinecke marked this pull request as ready for review August 3, 2026 22:04
@greptile-apps

greptile-apps Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR isolates non-inplace CMake extension builds in automatically cleaned temporary directories while preserving persistent directories for explicit NVTE_CMAKE_BUILD_DIR and inplace builds.

  • Creates temporary CMake directories beneath setuptools’ build-temp location.
  • Retains incremental build behavior when a persistent directory is configured.
  • Skips CMake extensions before invoking the normal setuptools extension build.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
build_tools/build_ext.py Updates CMake build-directory selection and lifecycle management without an eligible follow-up defect identified.

Reviews (3): Last reviewed commit: "Merge branch 'main' into fred/cmake-buil..." | Re-trigger Greptile

@ptrendx

ptrendx commented Aug 4, 2026

Copy link
Copy Markdown
Member

Hmm, this has a potential of being a little disruptive (especially considering that the time needed to build TE is quite long). Could there maybe be some middle ground where e.g. the -e builds (develop and in-place) could use the in-place build directory and the regular installation would use the temp instead?

…nstall

Signed-off-by: Fred Heinecke <fheinecke@nvidia.com>
@fheinecke

Copy link
Copy Markdown
Collaborator Author

Good catch - added

@fheinecke

Copy link
Copy Markdown
Collaborator Author

/te-ci

@fheinecke

Copy link
Copy Markdown
Collaborator Author

/te-ci

1 similar comment
@ptrendx

ptrendx commented Aug 7, 2026

Copy link
Copy Markdown
Member

/te-ci

@ptrendx
ptrendx merged commit 8260f49 into NVIDIA:main Aug 7, 2026
30 of 33 checks passed
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.

2 participants