-
Notifications
You must be signed in to change notification settings - Fork 57
feat(llama): add native Edge execution #1312
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
Open
JCalafato
wants to merge
2
commits into
NVIDIA:main
Choose a base branch
from
JCalafato:feat/llama-edge-20260917
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
There are no files selected for viewing
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
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
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,119 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Optional native dependency provisioning. Model builds never acquire dependencies. | ||
| option(TRTMC_ENABLE_EDGELLM "Install the pinned native Edge-LLM SDK and builder" OFF) | ||
| if(NOT TRTMC_ENABLE_EDGELLM) | ||
| return() | ||
| endif() | ||
| if(CMAKE_CROSSCOMPILING) | ||
| message(FATAL_ERROR "Edge-LLM cross compilation is not supported") | ||
| endif() | ||
| include("${CMAKE_CURRENT_LIST_DIR}/edgellm/CheckNative.cmake") | ||
| option(TRTMC_EDGELLM_ALL_KERNELS "Build all pinned Edge operator groups supported by the native GPU" OFF) | ||
| option(TRTMC_EDGELLM_ONNX "Install the pinned ONNX exporter and native engine builder" OFF) | ||
| set(_edge_cute_groups "fmha|gdn") | ||
| set(_edge_cute_cli_groups "fmha,gdn") | ||
| if(TRTMC_EDGELLM_ALL_KERNELS) | ||
| set(_edge_cute_groups ALL) | ||
| set(_edge_cute_cli_groups ALL) | ||
| endif() | ||
| set(_edge_build_targets edgellmCore NvInfer_edgellm_plugin) | ||
| set(_edge_onnx_byproducts "") | ||
| if(TRTMC_EDGELLM_ONNX) | ||
| list(APPEND _edge_build_targets llm_build) | ||
| list(APPEND _edge_onnx_byproducts "${CMAKE_BINARY_DIR}/_deps/edgellm/install/bin/edgellm-onnx-build") | ||
| endif() | ||
| set(_edge_version "0.10.1") | ||
| set(_edge_revision "e8b29522938901f6df19ebeedd4b69bc8edbcd97") | ||
| set(_edge_root "${CMAKE_BINARY_DIR}/_deps/edgellm") | ||
| set(_edge_prefix "${_edge_root}/install") | ||
| find_package(EdgeLLM ${_edge_version} EXACT CONFIG QUIET) | ||
| if(EdgeLLM_FOUND AND NOT EdgeLLM_PREFIX STREQUAL _edge_prefix) | ||
| _edgellm_json_include(_edge_json_include) | ||
| _edgellm_check_json_headers("${_edge_json_include}" "${EdgeLLM_PREFIX}/include/edgellm/3rdParty/nlohmannJson") | ||
| if(NOT EdgeLLM_REVISION STREQUAL _edge_revision) | ||
| message(FATAL_ERROR "EdgeLLM package does not match the pinned GitHub revision") | ||
| endif() | ||
| if(TRTMC_EDGELLM_ALL_KERNELS AND NOT EdgeLLM_ALL_KERNELS) | ||
| message(FATAL_ERROR "EdgeLLM package lacks requested full native operator coverage; rebuild with TRTMC_EDGELLM_ALL_KERNELS=ON") | ||
| endif() | ||
| if(TRTMC_EDGELLM_ONNX AND (NOT EdgeLLM_ONNX OR NOT EXISTS "${EdgeLLM_ONNX_BUILDER}")) | ||
| message(FATAL_ERROR "EdgeLLM package lacks requested ONNX tools; rebuild with TRTMC_EDGELLM_ONNX=ON") | ||
| endif() | ||
| install(FILES "$<TARGET_FILE:EdgeLLM::Plugin>" DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT EdgeLLM) | ||
| return() | ||
| endif() | ||
|
|
||
| include(ExternalProject) | ||
| include(CMakePackageConfigHelpers) | ||
| find_package(Python3 3.10 REQUIRED COMPONENTS Interpreter) | ||
| find_package(Threads REQUIRED) | ||
| set(TRTMC_EDGELLM_TRT_ROOT "$ENV{TRT_ROOT}" CACHE PATH "Native TensorRT SDK, including its Python wheel") | ||
| set(TRTMC_EDGELLM_CUDA_ARCHITECTURE "${CMAKE_CUDA_ARCHITECTURES}" CACHE STRING "One local GPU architecture for Edge-LLM") | ||
| set(TRTMC_EDGELLM_JOBS 2 CACHE STRING "Parallel Edge-LLM native and AOT compilation jobs") | ||
| set(TRTMC_EDGELLM_WHEELHOUSE "" CACHE PATH "Optional complete offline Python wheelhouse") | ||
| set(TRTMC_EDGELLM_GIT_MIRROR "" CACHE PATH "Optional local mirror of the pinned upstream Git repository") | ||
| if(NOT TRTMC_EDGELLM_CUDA_ARCHITECTURE MATCHES "^[0-9]+$") | ||
| message(FATAL_ERROR "Set TRTMC_EDGELLM_CUDA_ARCHITECTURE to one local GPU architecture, e.g. 80") | ||
| endif() | ||
| if(NOT EXISTS "${TRTMC_EDGELLM_TRT_ROOT}/include/NvInfer.h") | ||
| message(FATAL_ERROR "TRTMC_EDGELLM_TRT_ROOT must contain the native TensorRT SDK") | ||
| endif() | ||
| _edgellm_check_gpu("${TRTMC_EDGELLM_CUDA_ARCHITECTURE}") | ||
| _edgellm_trt_version("${TRTMC_EDGELLM_TRT_ROOT}/include" _edge_trt_version) | ||
| set(_edge_source "${_edge_root}/source") | ||
| set(_edge_build "${_edge_root}/build") | ||
| set(_edge_python "${_edge_prefix}/libexec/trtmc-edge-llm/bin/python") | ||
| set(_edge_repository "https://github.com/NVIDIA/TensorRT-Edge-LLM.git") | ||
| if(TRTMC_EDGELLM_GIT_MIRROR) | ||
| set(_edge_repository "${TRTMC_EDGELLM_GIT_MIRROR}") | ||
| endif() | ||
| set(_edge_template_dir "${CMAKE_CURRENT_LIST_DIR}/edgellm") | ||
| _edgellm_json_include(_edge_json_include) | ||
| file(MAKE_DIRECTORY "${_edge_prefix}/lib/cmake/EdgeLLM" "${_edge_prefix}/include/edgellm/cpp" | ||
| "${_edge_prefix}/include/edgellm/3rdParty/nlohmannJson/include" | ||
| "${_edge_prefix}/include/edgellm/3rdParty/stb" "${_edge_prefix}/include/edgellm/3rdParty/miniaudio") | ||
| configure_file("${_edge_template_dir}/CheckNative.cmake" "${_edge_prefix}/lib/cmake/EdgeLLM/CheckNative.cmake" COPYONLY) | ||
| foreach(_script IN ITEMS Prepare Install) | ||
| configure_file("${_edge_template_dir}/${_script}.cmake.in" "${_edge_root}/${_script}.cmake" @ONLY) | ||
| endforeach() | ||
| configure_file("${_edge_template_dir}/EdgeLLMConfig.cmake.in" | ||
| "${_edge_prefix}/lib/cmake/EdgeLLM/EdgeLLMConfig.cmake" @ONLY) | ||
| write_basic_package_version_file("${_edge_prefix}/lib/cmake/EdgeLLM/EdgeLLMConfigVersion.cmake" | ||
| VERSION "${_edge_version}" COMPATIBILITY ExactVersion) | ||
| ExternalProject_Add(trtmc_edgellm_dependency | ||
| PREFIX "${_edge_root}/ep" SOURCE_DIR "${_edge_source}" BINARY_DIR "${_edge_build}" | ||
| GIT_REPOSITORY "${_edge_repository}" GIT_TAG "${_edge_revision}" | ||
| GIT_SUBMODULES_RECURSE TRUE UPDATE_DISCONNECTED TRUE | ||
| LIST_SEPARATOR | | ||
| # Preparation installs tools; it does not patch upstream sources. Keep it in | ||
| # the configure step so template changes invalidate disconnected builds too. | ||
| CONFIGURE_COMMAND "${CMAKE_COMMAND}" -P "${_edge_root}/Prepare.cmake" | ||
| COMMAND "${_edge_prefix}/libexec/trtmc-edge-llm/bin/cmake" | ||
| -S <SOURCE_DIR> -B <BINARY_DIR> -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON | ||
| "-DCMAKE_CUDA_COMPILER=${CMAKE_CUDA_COMPILER}" | ||
| "-DCMAKE_CUDA_ARCHITECTURES=${TRTMC_EDGELLM_CUDA_ARCHITECTURE}" | ||
| "-DCUDA_DIR=${CUDAToolkit_LIBRARY_ROOT}" "-DCUDAToolkit_ROOT=${CUDAToolkit_LIBRARY_ROOT}" | ||
| "-DCUDA_CTK_VERSION=${CUDAToolkit_VERSION_MAJOR}.${CUDAToolkit_VERSION_MINOR}" | ||
| "-DTRT_PACKAGE_DIR=${TRTMC_EDGELLM_TRT_ROOT}" "-DPython3_EXECUTABLE=${_edge_python}" | ||
| -DEDGELLM_WHEEL_PAYLOAD_DIR=unused "-DENABLE_CUTE_DSL=${_edge_cute_groups}" | ||
| "-DCUTE_DSL_ARTIFACT_TAG=sm_${TRTMC_EDGELLM_CUDA_ARCHITECTURE}" | ||
| BUILD_COMMAND "${CMAKE_COMMAND}" --build <BINARY_DIR> --target ${_edge_build_targets} | ||
| --parallel "${TRTMC_EDGELLM_JOBS}" | ||
| INSTALL_COMMAND "${CMAKE_COMMAND}" -P "${_edge_root}/Install.cmake" | ||
| BUILD_BYPRODUCTS "${_edge_prefix}/lib/libedgellmCore.a" | ||
| "${_edge_prefix}/lib/libNvInfer_edgellm_plugin.so" | ||
| "${_edge_prefix}/lib/libcutedsl.a" ${_edge_onnx_byproducts} | ||
| LOG_DOWNLOAD ON LOG_CONFIGURE ON LOG_BUILD ON LOG_INSTALL ON LOG_OUTPUT_ON_FAILURE ON) | ||
| ExternalProject_Add_StepDependencies(trtmc_edgellm_dependency configure "${_edge_root}/Prepare.cmake") | ||
| ExternalProject_Add_StepDependencies(trtmc_edgellm_dependency install "${_edge_root}/Install.cmake") | ||
| # Generated package targets refer to declared future byproducts; their build dependency | ||
| # prevents consumers from compiling or linking until installation completes. | ||
| find_package(EdgeLLM ${_edge_version} EXACT CONFIG REQUIRED | ||
| PATHS "${_edge_prefix}/lib/cmake/EdgeLLM" NO_DEFAULT_PATH) | ||
| add_dependencies(EdgeLLM::Core trtmc_edgellm_dependency) | ||
| add_dependencies(EdgeLLM::Plugin trtmc_edgellm_dependency) | ||
| install(DIRECTORY "${_edge_prefix}/" DESTINATION . USE_SOURCE_PERMISSIONS COMPONENT EdgeLLM) | ||
| # Family DSOs may use lib64; their dynamically loaded plugin must remain adjacent. | ||
| install(FILES "$<TARGET_FILE:EdgeLLM::Plugin>" DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT EdgeLLM) |
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,73 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Read the complete TensorRT SDK version using the compiler, including aliased macros. | ||
| # include_dir: native SDK include directory; output: caller variable receiving x.y.z.build. | ||
| function(_edgellm_trt_version include_dir output) | ||
| set(_version) | ||
| set(_probe "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/edgellm-version.cpp") | ||
| file(WRITE "${_probe}" "#include <NvInferVersion.h>\n") | ||
| foreach(_part IN ITEMS MAJOR MINOR PATCH BUILD) | ||
| file(APPEND "${_probe}" "TRTMC_EDGE_${_part}=NV_TENSORRT_${_part}\n") | ||
| endforeach() | ||
| execute_process(COMMAND "${CMAKE_CXX_COMPILER}" -E -P -I "${include_dir}" "${_probe}" | ||
| OUTPUT_VARIABLE _expanded COMMAND_ERROR_IS_FATAL ANY) | ||
| foreach(_part IN ITEMS MAJOR MINOR PATCH BUILD) | ||
| if(NOT _expanded MATCHES "TRTMC_EDGE_${_part}=[ \t]*([0-9]+)") | ||
| message(FATAL_ERROR "Cannot determine TensorRT ${_part} from ${include_dir}") | ||
| endif() | ||
| list(APPEND _version "${CMAKE_MATCH_1}") | ||
| endforeach() | ||
| list(JOIN _version "." _version) | ||
| set(${output} "${_version}" PARENT_SCOPE) | ||
| endfunction() | ||
|
|
||
| # Require the installed package GPU architecture to be present on this build host. | ||
| function(_edgellm_check_gpu architecture) | ||
| execute_process(COMMAND nvidia-smi --query-gpu=compute_cap --format=csv,noheader | ||
| OUTPUT_VARIABLE _sms RESULT_VARIABLE _result OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
| string(REPLACE "." "" _sms "${_sms}") | ||
| string(REPLACE "\n" ";" _sms "${_sms}") | ||
| if(NOT _result EQUAL 0 OR NOT architecture IN_LIST _sms) | ||
| message(FATAL_ERROR "EdgeLLM requires a local GPU with architecture ${architecture}") | ||
| endif() | ||
| endfunction() | ||
|
|
||
| # A version label alone is not an ABI guarantee: development headers can retain | ||
| # 3.12.0 while changing parser layouts inside the same C++ ABI namespace. | ||
| function(_edgellm_json_include output) | ||
| get_target_property(_includes nlohmann_json::nlohmann_json INTERFACE_INCLUDE_DIRECTORIES) | ||
| foreach(_include IN LISTS _includes) | ||
| string(REGEX REPLACE "^\\$<BUILD_INTERFACE:(.*)>$" "\\1" _include "${_include}") | ||
| if(EXISTS "${_include}/nlohmann/json.hpp") | ||
| set(${output} "${_include}" PARENT_SCOPE) | ||
| return() | ||
| endif() | ||
| endforeach() | ||
| message(FATAL_ERROR "Cannot locate nlohmann_json headers for EdgeLLM ABI validation") | ||
| endfunction() | ||
|
|
||
| function(_edgellm_check_json_headers include_dir vendor_dir) | ||
| set(_header "${include_dir}/nlohmann/json.hpp") | ||
| set(_single "${vendor_dir}/single_include/nlohmann/json.hpp") | ||
| set(_multiple "${vendor_dir}/include/nlohmann/json.hpp") | ||
| if(NOT EXISTS "${_header}" OR NOT EXISTS "${_single}" OR NOT EXISTS "${_multiple}") | ||
| message(FATAL_ERROR "Missing nlohmann_json headers for EdgeLLM ABI validation") | ||
| endif() | ||
| file(SHA256 "${_header}" _actual) | ||
| file(SHA256 "${_single}" _expected_single) | ||
| if(_actual STREQUAL _expected_single) | ||
| return() | ||
| endif() | ||
| file(GLOB_RECURSE _headers RELATIVE "${vendor_dir}/include" "${vendor_dir}/include/nlohmann/*.hpp") | ||
| foreach(_relative IN LISTS _headers) | ||
| if(EXISTS "${include_dir}/${_relative}") | ||
| file(SHA256 "${include_dir}/${_relative}" _actual) | ||
| file(SHA256 "${vendor_dir}/include/${_relative}" _expected) | ||
| if(_actual STREQUAL _expected) | ||
| continue() | ||
| endif() | ||
| endif() | ||
| message(FATAL_ERROR "EdgeLLM requires the pinned nlohmann_json headers, not only the same version label. Set nlohmann_json_DIR to an installation of the pinned Edge 3rdParty/nlohmannJson dependency. Mismatch: ${_relative}") | ||
| endforeach() | ||
| endfunction() |
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,50 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| include(CMakeFindDependencyMacro) | ||
| find_dependency(CUDAToolkit) | ||
| find_dependency(Threads) | ||
| find_dependency(nlohmann_json 3.12.0 EXACT) | ||
| include("${CMAKE_CURRENT_LIST_DIR}/CheckNative.cmake") | ||
| get_filename_component(EdgeLLM_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) | ||
| _edgellm_json_include(_edge_json_include) | ||
| # During first provisioning these future headers do not exist yet; Prepare | ||
| # performs the same check after checkout and before installing or building tools. | ||
| if(EXISTS "${EdgeLLM_PREFIX}/include/edgellm/3rdParty/nlohmannJson/include/nlohmann/json.hpp") | ||
| _edgellm_check_json_headers("${_edge_json_include}" "${EdgeLLM_PREFIX}/include/edgellm/3rdParty/nlohmannJson") | ||
| endif() | ||
| set(EdgeLLM_VERSION "@_edge_version@") | ||
| set(EdgeLLM_REVISION "@_edge_revision@") | ||
| # Tool availability only; model admission and orchestration remain family-owned. | ||
| set(EdgeLLM_ALL_KERNELS "@TRTMC_EDGELLM_ALL_KERNELS@") | ||
| set(EdgeLLM_ONNX "@TRTMC_EDGELLM_ONNX@") | ||
| set(EdgeLLM_ONNX_BUILDER "${EdgeLLM_PREFIX}/bin/edgellm-onnx-build") | ||
| set(EdgeLLM_CUDA_VERSION "@CUDAToolkit_VERSION@") | ||
| set(EdgeLLM_TENSORRT_VERSION "@_edge_trt_version@") | ||
| set(EdgeLLM_ARCH "@CMAKE_SYSTEM_PROCESSOR@") | ||
| set(EdgeLLM_CUDA_ARCHITECTURE "@TRTMC_EDGELLM_CUDA_ARCHITECTURE@") | ||
| if(CMAKE_CROSSCOMPILING OR NOT CMAKE_SYSTEM_PROCESSOR STREQUAL EdgeLLM_ARCH) | ||
| message(FATAL_ERROR "EdgeLLM is a native-only package for ${EdgeLLM_ARCH}") | ||
| endif() | ||
| if(NOT CUDAToolkit_VERSION_MAJOR EQUAL @CUDAToolkit_VERSION_MAJOR@ OR | ||
| NOT CUDAToolkit_VERSION_MINOR EQUAL @CUDAToolkit_VERSION_MINOR@) | ||
| message(FATAL_ERROR "EdgeLLM requires the CUDA SDK it was built with: ${EdgeLLM_CUDA_VERSION}") | ||
| endif() | ||
| set(EdgeLLM_PYTHON_EXECUTABLE "${EdgeLLM_PREFIX}/libexec/trtmc-edge-llm/bin/python") | ||
| set(EdgeLLM_BUILDER_LAUNCHER "${EdgeLLM_PREFIX}/bin/edgellm-builder") | ||
| find_path(EdgeLLM_TRT_INCLUDE_DIR NvInfer.h HINTS "$ENV{TRT_ROOT}" "@TRTMC_EDGELLM_TRT_ROOT@" PATH_SUFFIXES include REQUIRED) | ||
| find_library(EdgeLLM_TRT_LIBRARY nvinfer HINTS "$ENV{TRT_ROOT}" "@TRTMC_EDGELLM_TRT_ROOT@" PATH_SUFFIXES lib lib64 REQUIRED) | ||
| find_library(EdgeLLM_PARSER_LIBRARY nvonnxparser HINTS "$ENV{TRT_ROOT}" "@TRTMC_EDGELLM_TRT_ROOT@" PATH_SUFFIXES lib lib64 REQUIRED) | ||
| _edgellm_trt_version("${EdgeLLM_TRT_INCLUDE_DIR}" _edge_current_trt) | ||
| if(NOT _edge_current_trt STREQUAL EdgeLLM_TENSORRT_VERSION) | ||
| message(FATAL_ERROR "EdgeLLM requires TensorRT ${EdgeLLM_TENSORRT_VERSION}; found ${_edge_current_trt}") | ||
| endif() | ||
| _edgellm_check_gpu("${EdgeLLM_CUDA_ARCHITECTURE}") | ||
| if(NOT TARGET EdgeLLM::Core) | ||
| add_library(EdgeLLM::Core STATIC IMPORTED) | ||
| set_target_properties(EdgeLLM::Core PROPERTIES | ||
| IMPORTED_LOCATION "${EdgeLLM_PREFIX}/lib/libedgellmCore.a" | ||
| INTERFACE_INCLUDE_DIRECTORIES "${EdgeLLM_PREFIX}/include;${EdgeLLM_PREFIX}/include/edgellm/cpp;${EdgeLLM_PREFIX}/include/edgellm/3rdParty/nlohmannJson/include;${EdgeLLM_PREFIX}/include/edgellm/3rdParty/stb;${EdgeLLM_PREFIX}/include/edgellm/3rdParty/miniaudio;${EdgeLLM_TRT_INCLUDE_DIR}" | ||
| INTERFACE_LINK_LIBRARIES "${EdgeLLM_PREFIX}/lib/libcutedsl.a;${EdgeLLM_TRT_LIBRARY};${EdgeLLM_PARSER_LIBRARY};CUDA::cudart;CUDA::cuda_driver;Threads::Threads;${CMAKE_DL_LIBS}") | ||
| add_library(EdgeLLM::Plugin SHARED IMPORTED) | ||
| set_target_properties(EdgeLLM::Plugin PROPERTIES IMPORTED_LOCATION "${EdgeLLM_PREFIX}/lib/libNvInfer_edgellm_plugin.so") | ||
| endif() |
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,35 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| cmake_minimum_required(VERSION 3.20) | ||
| file(INSTALL "@_edge_build@/cpp/libedgellmCore.a" DESTINATION "@_edge_prefix@/lib") | ||
| file(INSTALL "@_edge_build@/libNvInfer_edgellm_plugin.so" DESTINATION "@_edge_prefix@/lib" FOLLOW_SYMLINK_CHAIN) | ||
| file(INSTALL "@_edge_source@/cpp/kernels/cuteDSLArtifact/@CMAKE_SYSTEM_PROCESSOR@/sm_@TRTMC_EDGELLM_CUDA_ARCHITECTURE@/libcutedsl_@CMAKE_SYSTEM_PROCESSOR@.a" | ||
| DESTINATION "@_edge_prefix@/lib" RENAME libcutedsl.a) | ||
| file(INSTALL "@_edge_source@/cpp" DESTINATION "@_edge_prefix@/include/edgellm" FILES_MATCHING PATTERN "*.h" PATTERN "*.cuh") | ||
| foreach(_third_party IN ITEMS nlohmannJson stb miniaudio) | ||
| file(INSTALL "@_edge_source@/3rdParty/${_third_party}" DESTINATION "@_edge_prefix@/include/edgellm/3rdParty" | ||
| FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") | ||
| endforeach() | ||
| file(MAKE_DIRECTORY "@_edge_prefix@/bin" "@_edge_prefix@/share/trtmc") | ||
| file(WRITE "@_edge_prefix@/bin/edgellm-builder" [=[#!/bin/sh | ||
| set -eu | ||
| prefix=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) | ||
| exec "$prefix/libexec/trtmc-edge-llm/bin/python" -I -c 'from experimental.builder.cli import main; main()' "$@" | ||
| ]=]) | ||
| file(CHMOD "@_edge_prefix@/bin/edgellm-builder" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) | ||
| if("@TRTMC_EDGELLM_ONNX@") | ||
| file(INSTALL "@_edge_build@/examples/llm/llm_build" DESTINATION "@_edge_prefix@/bin" | ||
| TYPE PROGRAM RENAME edgellm-onnx-build) | ||
| endif() | ||
| set(_all_kernels false) | ||
| if("@TRTMC_EDGELLM_ALL_KERNELS@") | ||
| set(_all_kernels true) | ||
| endif() | ||
| set(_onnx false) | ||
| if("@TRTMC_EDGELLM_ONNX@") | ||
| set(_onnx true) | ||
| endif() | ||
| execute_process(COMMAND "@_edge_python@" -I -c "import tensorrt; print(tensorrt.__version__)" | ||
| OUTPUT_VARIABLE _trt_version OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY) | ||
| # Paths are relative to the installation prefix, preserving relocatability. | ||
| file(WRITE "@_edge_prefix@/share/trtmc/edge-llm.json" "{\n \"schema_version\": 1,\n \"version\": \"@_edge_version@\",\n \"revision\": \"@_edge_revision@\",\n \"arch\": \"@CMAKE_SYSTEM_PROCESSOR@\",\n \"architectures\": [@TRTMC_EDGELLM_CUDA_ARCHITECTURE@],\n \"cuda_version\": \"@CUDAToolkit_VERSION_MAJOR@.@CUDAToolkit_VERSION_MINOR@\",\n \"tensorrt_version\": \"${_trt_version}\",\n \"python\": \"libexec/trtmc-edge-llm/bin/python\",\n \"builder\": \"bin/edgellm-builder\",\n \"all_native_kernels\": ${_all_kernels},\n \"onnx\": ${_onnx},\n \"onnx_builder\": \"bin/edgellm-onnx-build\",\n \"plugin\": \"lib/libNvInfer_edgellm_plugin.so\"\n}\n") | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: NVIDIA/TensorRT-Model-Connect
Length of output: 3625
🏁 Script executed:
Repository: NVIDIA/TensorRT-Model-Connect
Length of output: 22151
🏁 Script executed:
Repository: NVIDIA/TensorRT-Model-Connect
Length of output: 21994
🏁 Script executed:
Repository: NVIDIA/TensorRT-Model-Connect
Length of output: 50385
Record the native TensorRT version in the Edge manifest.
Install.cmake.incurrently records the Python binding version, anddetect_local_platform()uses that same value in the bundle target. The runtime instead compares that target with a four-part version built fromgetInferLibVersion()andgetInferLibBuildVersion(). A Python/native mismatch, or a Python version without a build component, can passinstalled_package()and then fail every bundle load.Use the already computed native header version:
🤖 Prompt for AI Agents