-
Notifications
You must be signed in to change notification settings - Fork 75
CMake Dependency Validation & Reporting #5740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
114 commits
Select commit
Hold shift + click to select a range
8ddd465
Working example dependency output buffering.
mdavis36 f84b2d0
Reporting basic status of CUDAToolkit & pybind11
mdavis36 a173f30
pretty colors.
mdavis36 7ccfce0
Alligning the report text.
mdavis36 4a16da4
On failure return report before exiting
mdavis36 2925d82
Remove duplicate install logic
mdavis36 dfa35bf
Setting up infrastructure for validating find_package dependencies an…
mdavis36 6f38b6b
Use helper functions to aid in readability of report function
mdavis36 7617ae3
generate a json dependency file with the results from CMake
mdavis36 afaaba3
dep python report.
mdavis36 1042a65
CMake execute python report script.
mdavis36 8b47e83
Remove CMake base reporting.
mdavis36 3b99e75
Creating prereq package.
mdavis36 53fa541
pulling in error/help messages from #5609
mdavis36 6c234bb
compiler, ninja & submodule reports.
mdavis36 90ee1ec
compiler, ninja and submodule checks.
mdavis36 564ab2c
simplify dep failure check.
mdavis36 ae99893
organize python req into modules.
mdavis36 3a890b6
Fail after CMake dump.
mdavis36 9ea74d9
re-order
mdavis36 108dabf
Move validation functions into their own cmake modules.
mdavis36 a0f5f12
Drop unused requirements vars.
mdavis36 e85dc11
Reducing logical overhead in repoting scripts with class structures.
mdavis36 dcc0032
Treat torch.cuda == cudatoolkit as a boolean req.
mdavis36 85967a9
Remove abstraction between python and CMake, just infer CMake variables
mdavis36 3be18cb
Simplify json output from CMake, let python do what it's good at.
mdavis36 3cb8098
explicit arguments for constructors.
mdavis36 0f2ad5a
Drop dependency name list.
mdavis36 529a52d
Drop help files, move function calls in req classes.
mdavis36 2744a3e
clean up ctor calls
mdavis36 75d257d
Compiler req uses direct cmake variables.
mdavis36 d3856cc
Use more explicit instantiations on the CMake side, remove ambiguity.
mdavis36 ad8051b
Remove unnecessary cmake vars in req file.
mdavis36 3c90d4f
PYTHON_EXECUTABLE -> Python_EXECUTABLE
mdavis36 36bab29
Move some generic compiler checks into handle.
mdavis36 480a59c
drop is constraint check
mdavis36 e244e02
Use set_dependency_status for compiler
mdavis36 a8e7a7f
drop indirection on location var.
mdavis36 584b46a
*_status -> *_report_status
mdavis36 c1de2b7
Add NVFUSER_ENABLE_DEPENDENCY_REPORT flag to disable reporting and de…
mdavis36 f153639
Update cmake/LogCapture.cmake header comment
mdavis36 1048742
Disable submodules, this needs further consideration.
mdavis36 eaad1ed
remove include.
mdavis36 e818dfe
user var for components.
mdavis36 7486630
user set_dependency_report_status in torch logic pre-checks.
mdavis36 7c5c597
Fix location report
mdavis36 4331d77
report colors & format.
mdavis36 8b286f1
doc update
mdavis36 adcac39
add platform info to report; remove unused functions in requirements …
mdavis36 f8f6677
clean up imports
mdavis36 59fe38a
check cmake variables are correct in comments.
mdavis36 11fb7ff
Remove unused log functions.
mdavis36 281adf9
var scope.
mdavis36 3918639
print help on non-success optional requirments too.
mdavis36 19da6b5
Ninja configuration instructions.
mdavis36 1b7fc18
Addressing greptile comments.
mdavis36 4353690
lintrunner changes.
mdavis36 476d48d
Add license headers
mdavis36 a2c9053
lint
mdavis36 dad9165
Set python min version to 3.10
mdavis36 d7d8114
Torch min version 2.9
mdavis36 5b0eaea
Disable color report w/ NVFUSER_BUILD_DISABLE_COLOR
mdavis36 8ab4291
Adding nvidia-matmul-heuristic to pip requirements list.
mdavis36 c8471a8
Handling NVMMH in cmake module and adding report module.
mdavis36 78c0836
Bump pybind11 to 3.0 min version (July 2025)
mdavis36 265ae58
Dependencies.cmake -> Submodules.cmake
mdavis36 3c2ff83
Move nvf_cutlass target logic into cutlass dir.
mdavis36 3b49e1e
Set NVFUSER_USE_CUTLASS to remove repeated version constraint.
mdavis36 f71693d
Move FlatBuffers and Cutlass version checking into Submodule cmake file.
mdavis36 c0bf39c
OPTIONAL=False for GNU/CLANG compilers.
mdavis36 ab039ae
Checking git submodules status
mdavis36 b02d591
mxfp8_scaled_mm
mdavis36 538ea1f
Merge branch 'main' into md/cmake-deps-5609-integration
mdavis36 1242d13
Use generic report function for Ninja status.
mdavis36 64cb6ce
handle_torch should not use return() calls.
mdavis36 6e16a2c
handle_git_submodules remove return() calls.
mdavis36 b30d079
Move torch dependent logic after we find torch.
mdavis36 2a3d9d8
Adding version to pybind11 in req.txt
mdavis36 ef58e8f
move submodule eval earlier in dep process.
mdavis36 43b8e39
spelling
mdavis36 d9842c0
handle_torch failed regex case.
mdavis36 5e6bca0
lint
mdavis36 d59e40c
remove references to specific versions in python reports
mdavis36 e978780
lint
mdavis36 94aac19
warning w/ non gcc/clang compilers.
mdavis36 047a6a6
fix hole in logic
mdavis36 64d84d3
Try a more specific delimiter string.
mdavis36 4a5588a
Clarify submodule specific output.
mdavis36 8f5f3f5
remove unnecessary status var assignments.
mdavis36 91a14f7
compiler option logic.
mdavis36 5169cdb
single regex check on submodule output.
mdavis36 0d88a52
Fix comment - we do return non 0 on failed reports.
mdavis36 b79420a
undefined var.
mdavis36 438d6ca
Testing GH clang build - disable CUTLASS always.
mdavis36 92dac9c
handle empty string case on bad regex.
mdavis36 93226ba
Throw warning & skip report if json fails to generate.
mdavis36 1c88d67
Rerport a reporducable command as part of warning when report script …
mdavis36 baaa3e0
NVFUSER_DISABLE_CUTLASS to explicitly disable cutlass even w/ cuda 12.8+
mdavis36 7846d48
Development.Module python target.
mdavis36 3661cbb
Merge branch 'main' into md/cmake-deps-5609-integration
mdavis36 b28004c
Conditionally pass CUTLASS_MAX_JOBS to cmake; Default MAX_JOBS to 2 s…
mdavis36 3af3644
Ensure output nvf_cutlass in CMAKE_BINARY_DIR
mdavis36 ea619a8
colors.WHITE -> colors.RESET for light themes.
mdavis36 d5c4d00
comment and abstract method attribute.
mdavis36 578a9f8
Default cutlass_max_jobs = None
mdavis36 3551f93
lint
mdavis36 2ff0a6c
Merge branch 'main' into md/cmake-deps-5609-integration
mdavis36 f39ef91
Check for missing delimiter.
mdavis36 ecaa34e
format.
mdavis36 de4d9bb
int | None
mdavis36 463493b
Add colorize helper function.
mdavis36 cd2c663
move validation
mdavis36 df06620
Merge branch 'main' into md/cmake-deps-5609-integration
mdavis36 55bce4e
Merge branch 'main' into md/cmake-deps-5609-integration
mdavis36 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2023-present NVIDIA CORPORATION & AFFILIATES. | ||
| # All rights reserved. | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| # ============================================================================== | ||
| # nvFuser Dependency Requirements | ||
| # ============================================================================== | ||
| # | ||
| # This file centralizes all dependency requirement metadata for nvFuser. | ||
| # Each requirement entry contains: | ||
| # - VERSION_MIN: Minimum version required (can be empty for "any version") | ||
| # - OPTIONAL: TRUE/FALSE (default FALSE) | ||
| # - COMPONENTS: Components required (for find_package, semicolon-separated) | ||
| # | ||
| # ============================================================================== | ||
|
|
||
| # Ninja | ||
| set(NVFUSER_REQUIREMENT_Ninja_OPTIONAL "TRUE") | ||
|
|
||
| # Compiler (GCC or Clang) | ||
| set(NVFUSER_REQUIREMENT_GNU_VERSION_MIN "13.1") | ||
| set(NVFUSER_REQUIREMENT_Clang_VERSION_MIN "19") | ||
|
|
||
| # Python | ||
| set(NVFUSER_REQUIREMENT_Python_VERSION_MIN "3.10") | ||
| set(NVFUSER_REQUIREMENT_Python_COMPONENTS "Interpreter;Development.Module") | ||
|
|
||
| # Torch | ||
| set(NVFUSER_REQUIREMENT_Torch_VERSION_MIN "2.9") | ||
|
|
||
| # pybind11 | ||
| set(NVFUSER_REQUIREMENT_pybind11_VERSION_MIN "3.0") | ||
|
|
||
| # CUDAToolkit | ||
| set(NVFUSER_REQUIREMENT_CUDAToolkit_VERSION_MIN "12.6") | ||
| set(NVFUSER_REQUIREMENT_CUDAToolkit_COMPONENTS "Cupti;cuda_driver") | ||
|
|
||
| # LLVM | ||
| set(NVFUSER_REQUIREMENT_LLVM_VERSION_MIN "18.1") | ||
|
|
||
| # NVMMH | ||
| set(NVFUSER_REQUIREMENT_NVMMH_OPTIONAL "TRUE") | ||
|
|
||
| # Git Submodules (required for build) | ||
| # No version requirement - just checks if submodules are initialized |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2023-present NVIDIA CORPORATION & AFFILIATES. | ||
| # All rights reserved. | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| # ============================================================================== | ||
| # nvFuser Dependency Utilities | ||
| # ============================================================================== | ||
| # | ||
| # This file provides utilities for dependency status tracking and reporting. | ||
| # Dependency metadata is defined in DependencyRequirements.cmake | ||
| # Individual dependency handlers are in cmake/deps/ | ||
| # | ||
| # ============================================================================== | ||
|
|
||
| # -------------------------- | ||
| # Conditionally add REQUIRED to find_package calls | ||
| # -------------------------- | ||
|
|
||
| # When dependency report is enabled, we don't use REQUIRED so we can collect | ||
| # all failures and show a comprehensive Python report. | ||
| # When disabled, we use REQUIRED for immediate failure with standard CMake errors. | ||
| if(NVFUSER_ENABLE_DEPENDENCY_REPORT) | ||
| set(MAYBE_REQUIRED "") | ||
| else() | ||
| set(MAYBE_REQUIRED "REQUIRED") | ||
| endif() | ||
|
|
||
| # -------------------------- | ||
| # Status Tracking for JSON Export | ||
| # -------------------------- | ||
|
|
||
| # Set dependency status based on found state and version check | ||
| macro(set_dependency_report_status name) | ||
| set(optional "${NVFUSER_REQUIREMENT_${name}_OPTIONAL}") | ||
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if(${name}_FOUND) | ||
| # Check version compatibility | ||
| set(min_version "${NVFUSER_REQUIREMENT_${name}_VERSION_MIN}") | ||
| set(version "${${name}_VERSION}") | ||
|
|
||
| if(DEFINED min_version AND NOT "${min_version}" STREQUAL "") | ||
| if("${version}" VERSION_GREATER_EQUAL "${min_version}") | ||
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| set(NVFUSER_REQUIREMENT_${name}_STATUS "SUCCESS") | ||
| else() | ||
| set(NVFUSER_REQUIREMENT_${name}_STATUS "INCOMPATIBLE") | ||
| # Mark dependencies as failed if this is a required dependency | ||
| if(NOT optional) | ||
| set(NVFUSER_DEPENDENCIES_OK FALSE) | ||
| endif() | ||
| endif() | ||
| else() | ||
| set(NVFUSER_REQUIREMENT_${name}_STATUS "SUCCESS") | ||
| endif() | ||
| else() | ||
| set(NVFUSER_REQUIREMENT_${name}_STATUS "NOT_FOUND") | ||
| # Mark dependencies as failed if this is a required dependency | ||
| if(NOT optional) | ||
| set(NVFUSER_DEPENDENCIES_OK FALSE) | ||
| endif() | ||
| endif() | ||
| endmacro() | ||
|
|
||
| # -------------------------- | ||
| # Python Export for Dependency Reporting | ||
| # -------------------------- | ||
|
|
||
| function(export_dependency_json output_file) | ||
| # Get all CMake variables | ||
| get_cmake_property(all_vars VARIABLES) | ||
|
|
||
| # Write JSON file with flat variable dict | ||
| file(WRITE "${output_file}" "{\n") | ||
| file(APPEND "${output_file}" " \"cmake_vars\": {\n") | ||
|
|
||
| # Export all variables (sorted for consistency) | ||
| list(SORT all_vars) | ||
| list(LENGTH all_vars var_count) | ||
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| set(var_index 0) | ||
| foreach(var ${all_vars}) | ||
| set(value "${${var}}") | ||
| # Escape for JSON strings | ||
| string(REPLACE "\\" "\\\\" value "${value}") | ||
| string(REPLACE "\"" "\\\"" value "${value}") | ||
| string(REPLACE "\n" "\\n" value "${value}") | ||
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| string(REPLACE "\t" "\\t" value "${value}") | ||
| string(REPLACE "\r" "\\r" value "${value}") | ||
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Add comma if not last item | ||
| math(EXPR var_index "${var_index} + 1") | ||
| if(var_index LESS var_count) | ||
| file(APPEND "${output_file}" " \"${var}\": \"${value}\",\n") | ||
| else() | ||
| file(APPEND "${output_file}" " \"${var}\": \"${value}\"\n") | ||
| endif() | ||
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| endforeach() | ||
|
|
||
| file(APPEND "${output_file}" " }\n") | ||
| file(APPEND "${output_file}" "}\n") | ||
| endfunction() | ||
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # -------------------------- | ||
| # Report Dependencies (Python-based with fallback) | ||
| # -------------------------- | ||
|
|
||
| macro(report_dependencies) | ||
| # Export dependency data to JSON with error handling | ||
| set(json_file "${CMAKE_BINARY_DIR}/nvfuser_dependencies.json") | ||
| export_dependency_json("${json_file}") | ||
| if(NOT EXISTS "${json_file}") | ||
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| message(WARNING "Failed to export dependency data to ${json_file} - skipping enhanced dependency report") | ||
| else() | ||
|
|
||
| # Try to use Python script for enhanced reporting | ||
| set(python_script "${CMAKE_SOURCE_DIR}/python/tools/check_dependencies.py") | ||
|
|
||
| if(NOT EXISTS "${python_script}") | ||
| message(WARNING "Python reporting script not found: ${python_script}") | ||
| elseif(NOT DEFINED Python_EXECUTABLE OR NOT Python_FOUND) | ||
| message(WARNING "Python is not available - skipping enhanced dependency report") | ||
| else() | ||
| # Run Python reporting script | ||
| execute_process( | ||
| COMMAND ${Python_EXECUTABLE} ${python_script} ${json_file} | ||
| RESULT_VARIABLE python_result | ||
| OUTPUT_VARIABLE python_output | ||
| ERROR_VARIABLE python_error | ||
| ) | ||
|
|
||
| if(NOT python_result EQUAL 0) | ||
| message(WARNING "Python reporting failed (${python_result}): ${python_error} To reproduce: ${Python_EXECUTABLE} ${python_script} ${json_file}") | ||
| else() | ||
| # Display Python output | ||
| message("${python_output}") | ||
| endif() | ||
| endif() | ||
|
|
||
| endif() | ||
|
|
||
| endmacro() | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2023-present NVIDIA CORPORATION & AFFILIATES. | ||
| # All rights reserved. | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| # ============================================================================== | ||
| # nvFuser Log Capture Utilities | ||
| # ============================================================================== | ||
|
|
||
| # Global switch to control logging behavior | ||
| set(LOG_CAPTURE_MODE FALSE CACHE INTERNAL "") | ||
| set(GLOBAL_LOG_BUFFER "" CACHE INTERNAL "") | ||
|
|
||
| # 1. Override message() ONCE for the whole project. | ||
| # This acts as a "Gatekeeper" for BOTH capture and suppression. | ||
| function(message) | ||
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Handle empty lines | ||
| if(NOT ARGV) | ||
| if(LOG_CAPTURE_MODE) | ||
| # Store empty line marker when capturing | ||
| set_property(GLOBAL APPEND PROPERTY GLOBAL_LOG_BUFFER "EMPTY_LINE") | ||
| elseif(NOT SUPPRESS_MESSAGE_OUTPUT) | ||
| # Print empty line when not suppressing | ||
| _message("") | ||
| endif() | ||
| return() | ||
| endif() | ||
|
|
||
| # Get the message type (STATUS, WARNING, FATAL_ERROR, etc.) | ||
| list(GET ARGV 0 type) | ||
|
|
||
| # Pass through FATAL_ERROR and SEND_ERROR immediately (Fail Fast) | ||
| if(type STREQUAL "FATAL_ERROR" OR type STREQUAL "SEND_ERROR") | ||
| _message(${ARGV}) | ||
| return() | ||
| endif() | ||
|
|
||
| # Logic: Capture, Suppress, or Print? | ||
| if(LOG_CAPTURE_MODE) | ||
| # CAPTURE MODE: Store type and content separately | ||
| # Remove the type from ARGV to get just the content | ||
| set(_argv_copy ${ARGV}) | ||
| list(REMOVE_AT _argv_copy 0) | ||
| string(JOIN " " msg_content ${_argv_copy}) | ||
| # Use a delimiter (<<<DELIM>>>) to separate type from content | ||
| set_property(GLOBAL APPEND PROPERTY GLOBAL_LOG_BUFFER "${type}<<<DELIM>>>${msg_content}") | ||
| elseif(SUPPRESS_MESSAGE_OUTPUT) | ||
| # SUPPRESS MODE: Block all non-critical messages (already handled errors above) | ||
| # Do nothing | ||
| else() | ||
| # NORMAL MODE: Pass through to internal CMake message | ||
| _message(${ARGV}) | ||
| endif() | ||
| endfunction() | ||
|
|
||
| # 2. Macros to control the switch | ||
| macro(start_capture) | ||
| set(LOG_CAPTURE_MODE TRUE) | ||
| set_property(GLOBAL PROPERTY GLOBAL_LOG_BUFFER "") # Clear buffer | ||
| endmacro() | ||
|
|
||
| macro(stop_capture target_var) | ||
| set(LOG_CAPTURE_MODE FALSE) | ||
| # Move global buffer to user variable | ||
| get_property(_logs GLOBAL PROPERTY GLOBAL_LOG_BUFFER) | ||
| set(${target_var} "${_logs}") | ||
| endmacro() | ||
|
|
||
| # 3. Helper to print the logs later | ||
| function(dump_captured_logs log_list) | ||
| foreach(entry ${log_list}) | ||
| if("${entry}" STREQUAL "EMPTY_LINE") | ||
| _message("") | ||
| else() | ||
| # Split "TYPE|||CONTENT" | ||
| # Split "TYPE<<<DELIM>>>CONTENT" | ||
| string(FIND "${entry}" "<<<DELIM>>>" pos) | ||
| if(pos EQUAL -1) | ||
| message(WARNING "Log entry missing delimiter: ${entry}") | ||
| continue() | ||
| endif() | ||
| string(SUBSTRING "${entry}" 0 ${pos} type) | ||
| math(EXPR content_start "${pos} + 11") | ||
| string(SUBSTRING "${entry}" ${content_start} -1 content) | ||
mdavis36 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Print using the original type (STATUS, WARNING, etc.) | ||
| # This preserves color and formatting! | ||
| _message(${type} "${content}") | ||
| endif() | ||
| endforeach() | ||
| endfunction() | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.