tensoracle 2.1.2__tar.gz → 2.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. {tensoracle-2.1.2 → tensoracle-2.2.3}/CMakeLists.txt +18 -21
  2. {tensoracle-2.1.2 → tensoracle-2.2.3}/PKG-INFO +5 -5
  3. {tensoracle-2.1.2 → tensoracle-2.2.3}/README.md +3 -3
  4. {tensoracle-2.1.2 → tensoracle-2.2.3}/build_backend.py +57 -2
  5. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/CMakeLists.txt +15 -18
  6. tensoracle-2.2.3/cpp/README.md +81 -0
  7. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/cmake/TensoracleCuda.cmake +12 -12
  8. tensoracle-2.2.3/cpp/cmake/TensoracleDependencies.cmake +6 -0
  9. tensoracle-2.2.3/cpp/cmake/tensoracleConfig.cmake.in +47 -0
  10. tensoracle-2.2.3/cpp/conan/bootstrap.cmake +13 -0
  11. tensoracle-2.2.3/cpp/conan/install.cmake +77 -0
  12. tensoracle-2.2.3/cpp/conan/prepare-tests.cmake +7 -0
  13. tensoracle-2.2.3/cpp/conan/profiles/linux-gcc13 +20 -0
  14. tensoracle-2.2.3/cpp/conan/profiles/linux-gcc14 +25 -0
  15. tensoracle-2.2.3/cpp/conan/recipes/cuda-toolkit/conanfile.py +125 -0
  16. tensoracle-2.2.3/cpp/conan/recipes/cuda-toolkit/redist.json +163 -0
  17. tensoracle-2.2.3/cpp/conan/recipes/tensorrt/LICENSE.NVIDIA +180 -0
  18. tensoracle-2.2.3/cpp/conan/recipes/tensorrt/LICENSE.OSS +479 -0
  19. tensoracle-2.2.3/cpp/conan/recipes/tensorrt/conandata.yml +32 -0
  20. tensoracle-2.2.3/cpp/conan/recipes/tensorrt/conanfile.py +93 -0
  21. tensoracle-2.2.3/cpp/conan/recipes.json +5 -0
  22. tensoracle-2.2.3/cpp/conan/recipes.py +190 -0
  23. tensoracle-2.2.3/cpp/conan.lock +15 -0
  24. tensoracle-2.2.3/cpp/conanfile.py +41 -0
  25. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/include/tensoracle/engine.h +23 -3
  26. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/include/tensoracle/engine.hpp +15 -0
  27. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/include/tensoracle/tensoracle.h +2 -2
  28. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/cache.cpp +49 -0
  29. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/cache.hpp +15 -0
  30. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/cache_open.cpp +6 -17
  31. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/engine.cpp +70 -32
  32. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/tensoracle.map +5 -0
  33. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/CMakeLists.txt +32 -27
  34. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/builder.cpp +201 -28
  35. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/builder_probe.cpp +3 -13
  36. tensoracle-2.2.3/cpp/tests/concurrent_builder.hpp +67 -0
  37. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/driver_failures.cpp +29 -0
  38. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/execution.cpp +238 -0
  39. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/installed.cmake +6 -3
  40. tensoracle-2.2.3/cpp/tests/runtime.cmake +40 -0
  41. {tensoracle-2.1.2 → tensoracle-2.2.3}/docs/api/index.md +1 -1
  42. {tensoracle-2.1.2 → tensoracle-2.2.3}/docs/cpp-python-repositories.md +3 -3
  43. tensoracle-2.2.3/docs/cpp-sdk.md +109 -0
  44. {tensoracle-2.1.2 → tensoracle-2.2.3}/docs/index.md +20 -4
  45. {tensoracle-2.1.2 → tensoracle-2.2.3}/docs/migration.md +1 -1
  46. tensoracle-2.2.3/docs/tensorrt-sdk.md +127 -0
  47. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/CMakeLists.txt +7 -7
  48. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/README.md +5 -7
  49. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/pyproject.toml +0 -2
  50. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/wheel_consumer/CMakeLists.txt +8 -7
  51. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/wheel_consumer/README.md +8 -5
  52. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/wheel_consumer/pyproject.toml +0 -2
  53. {tensoracle-2.1.2 → tensoracle-2.2.3}/mkdocs.yml +1 -0
  54. {tensoracle-2.1.2 → tensoracle-2.2.3}/pyproject.toml +3 -5
  55. {tensoracle-2.1.2 → tensoracle-2.2.3}/src/tensoracle/_version.py +2 -2
  56. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/native/cache/CMakeLists.txt +4 -2
  57. tensoracle-2.2.3/tests/native_build.py +149 -0
  58. tensoracle-2.2.3/tests/test_build_distributions.py +530 -0
  59. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_cmake_plugin.py +20 -3
  60. tensoracle-2.2.3/tests/test_conan.py +153 -0
  61. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_cpp_core.py +7 -10
  62. tensoracle-2.2.3/tests/test_cpp_test_runtime.py +130 -0
  63. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_distribution.py +178 -7
  64. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_example_plugin.py +8 -12
  65. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_plugin_io.py +4 -5
  66. tensoracle-2.2.3/tests/test_recipe_acquisition.py +238 -0
  67. tensoracle-2.2.3/tests/test_tensorrt_recipe.py +112 -0
  68. {tensoracle-2.1.2 → tensoracle-2.2.3}/uv.lock +1 -1
  69. tensoracle-2.1.2/cpp/cmake/TensoracleDependencies.cmake +0 -21
  70. tensoracle-2.1.2/cpp/cmake/TensoracleJson.cmake +0 -12
  71. tensoracle-2.1.2/cpp/cmake/tensoracleConfig.cmake.in +0 -4
  72. tensoracle-2.1.2/docs/tensorrt-sdk.md +0 -125
  73. tensoracle-2.1.2/tests/native_build.py +0 -77
  74. {tensoracle-2.1.2 → tensoracle-2.2.3}/.gitignore +0 -0
  75. {tensoracle-2.1.2 → tensoracle-2.2.3}/LICENSE +0 -0
  76. {tensoracle-2.1.2 → tensoracle-2.2.3}/bindings.cpp +0 -0
  77. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/cmake/TensoracleCubinPlugin.cmake +0 -0
  78. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/include/tensoracle/builder.h +0 -0
  79. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/include/tensoracle/builder.hpp +0 -0
  80. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/include/tensoracle/cache.h +0 -0
  81. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/include/tensoracle/cache.hpp +0 -0
  82. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/include/tensoracle/cubin.h +0 -0
  83. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/include/tensoracle/cubin.hpp +0 -0
  84. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/include/tensoracle/cubin_plugin.hpp +0 -0
  85. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/include/tensoracle/plugins.h +0 -0
  86. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/include/tensoracle/plugins.hpp +0 -0
  87. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/include/tensoracle/tensoracle.hpp +0 -0
  88. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/abi.cpp +0 -0
  89. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/builder.cpp +0 -0
  90. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/builder_internal.hpp +0 -0
  91. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/bundle.cpp +0 -0
  92. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/bundle_internal.hpp +0 -0
  93. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/cache_management.cpp +0 -0
  94. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/cache_management_internal.cpp +0 -0
  95. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/cache_management_internal.hpp +0 -0
  96. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/comparison.cpp +0 -0
  97. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/cubin_plugin.cpp +0 -0
  98. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/engine_internal.hpp +0 -0
  99. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/error.cpp +0 -0
  100. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/error.hpp +0 -0
  101. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/native_exports.hpp +0 -0
  102. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/plugins.cpp +0 -0
  103. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/producer.cpp +0 -0
  104. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/safetensors.cpp +0 -0
  105. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/safetensors.hpp +0 -0
  106. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/sha256.hpp +0 -0
  107. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/src/structure.hpp +0 -0
  108. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/abi.cpp +0 -0
  109. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/builder_fixture.hpp +0 -0
  110. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/c_consumer.c +0 -0
  111. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/cache.cpp +0 -0
  112. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/cache_management.cpp +0 -0
  113. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/cache_probe.cpp +0 -0
  114. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/comparison.cpp +0 -0
  115. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/consumer/CMakeLists.txt +0 -0
  116. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/consumer/main.cpp +0 -0
  117. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/core.cpp +0 -0
  118. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/cubin.cpp +0 -0
  119. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/native_exports.cpp +0 -0
  120. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/native_exports_fixture.cpp +0 -0
  121. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/plugin_fixture.cpp +0 -0
  122. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/plugins.cpp +0 -0
  123. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/precision.cpp +0 -0
  124. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/utilities.cpp +0 -0
  125. {tensoracle-2.1.2 → tensoracle-2.2.3}/cpp/tests/weights.cpp +0 -0
  126. {tensoracle-2.1.2 → tensoracle-2.2.3}/cubin_bindings.cpp +0 -0
  127. {tensoracle-2.1.2 → tensoracle-2.2.3}/docs/api/bundle.md +0 -0
  128. {tensoracle-2.1.2 → tensoracle-2.2.3}/docs/api/producer.md +0 -0
  129. {tensoracle-2.1.2 → tensoracle-2.2.3}/docs/optimization.md +0 -0
  130. {tensoracle-2.1.2 → tensoracle-2.2.3}/docs/precision.md +0 -0
  131. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bindings.cpp +0 -0
  132. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/bundle.cpp +0 -0
  133. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/bundle.json +0 -0
  134. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm120/bias.cubin +0 -0
  135. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm120/dot.specialized.cubin +0 -0
  136. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm120/dot.tf32-control.cubin +0 -0
  137. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm120/dot.unspecialized.cubin +0 -0
  138. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm120/scale.cubin +0 -0
  139. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm86/bias.cubin +0 -0
  140. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm86/dot.specialized.cubin +0 -0
  141. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm86/dot.tf32-control.cubin +0 -0
  142. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm86/dot.unspecialized.cubin +0 -0
  143. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm86/scale.cubin +0 -0
  144. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm89/bias.cubin +0 -0
  145. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm89/dot.specialized.cubin +0 -0
  146. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm89/dot.tf32-control.cubin +0 -0
  147. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm89/dot.unspecialized.cubin +0 -0
  148. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/bundle/cubins/sm89/scale.cubin +0 -0
  149. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/example_cubin_plugin/__init__.py +0 -0
  150. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/example_cubin_plugin/weights.safetensors +0 -0
  151. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/kernels.cu +0 -0
  152. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/kernels.py +0 -0
  153. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/cubin_plugin/plugin.cpp +0 -0
  154. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/wheel_consumer/bindings.cpp +0 -0
  155. {tensoracle-2.1.2 → tensoracle-2.2.3}/examples/wheel_consumer/src/tensoracle_consumer/__init__.py +0 -0
  156. {tensoracle-2.1.2 → tensoracle-2.2.3}/src/tensoracle/__init__.py +0 -0
  157. {tensoracle-2.1.2 → tensoracle-2.2.3}/src/tensoracle/_cli.py +0 -0
  158. {tensoracle-2.1.2 → tensoracle-2.2.3}/src/tensoracle/_comparison.py +0 -0
  159. {tensoracle-2.1.2 → tensoracle-2.2.3}/src/tensoracle/bundle.py +0 -0
  160. {tensoracle-2.1.2 → tensoracle-2.2.3}/src/tensoracle/convert.py +0 -0
  161. {tensoracle-2.1.2 → tensoracle-2.2.3}/src/tensoracle/producer.py +0 -0
  162. {tensoracle-2.1.2 → tensoracle-2.2.3}/src/tensoracle/py.typed +0 -0
  163. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/cubin_io/check.cpp +0 -0
  164. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/cubins/ptxas-12.9.86/sm120.cubin +0 -0
  165. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/cubins/ptxas-12.9.86/sm86.cubin +0 -0
  166. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/cubins/ptxas-12.9.86/sm89.cubin +0 -0
  167. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/native/CMakeLists.txt +0 -0
  168. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/native/cache/writer.cpp +0 -0
  169. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/native/export.h +0 -0
  170. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_bundle.py +0 -0
  171. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_cache_cli.py +0 -0
  172. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_cmake_cuda.py +0 -0
  173. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_comparison.py +0 -0
  174. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_comparison_binding.py +0 -0
  175. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_convert.py +0 -0
  176. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_native.py +0 -0
  177. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_producer.py +0 -0
  178. {tensoracle-2.1.2 → tensoracle-2.2.3}/tests/test_public_api.py +0 -0
@@ -1,33 +1,27 @@
1
1
  cmake_minimum_required(VERSION 3.26)
2
+ # A staged sdist has cpp next to CMakeLists.txt; the checkout has ../cpp.
3
+ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cpp/CMakeLists.txt")
4
+ set(_cpp "${CMAKE_CURRENT_SOURCE_DIR}/cpp")
5
+ else()
6
+ set(_cpp "${CMAKE_CURRENT_SOURCE_DIR}/../cpp")
7
+ endif()
8
+ set(BUILD_TESTING OFF CACHE BOOL "Tests are built separately" FORCE)
9
+ include("${_cpp}/conan/bootstrap.cmake")
2
10
  project(tensoracle_python LANGUAGES CXX)
3
11
 
4
12
  find_package(Python 3.12 REQUIRED COMPONENTS Interpreter Development.Module Development.SABIModule)
5
13
  find_package(nanobind CONFIG REQUIRED)
14
+ find_package(TensorRT 11.2.1.2 EXACT CONFIG REQUIRED)
15
+ get_filename_component(_tensorrt_root "${TensorRT_INCLUDE_DIR}" DIRECTORY)
16
+ find_library(_stub_nvinfer NAMES nvinfer PATHS "${_tensorrt_root}/lib"
17
+ NO_DEFAULT_PATH REQUIRED NO_CACHE)
6
18
 
7
- # The build environment supplies headers and the link library from wheels.
8
- # The standalone C++ project receives paths and never discovers Python itself.
9
- execute_process(COMMAND "${Python_EXECUTABLE}" -c
10
- "from importlib.metadata import distribution; print(distribution('tensorrt-cu13-libs').locate_file('tensorrt_libs')); print(distribution('nvidia-cuda-runtime').locate_file('nvidia/cu13'))"
11
- OUTPUT_VARIABLE _dependencies OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY)
12
- string(REPLACE "\n" ";" _dependencies "${_dependencies}")
13
- list(GET _dependencies 0 _tensorrt_libs)
14
- list(GET _dependencies 1 _cuda_root)
15
- find_library(_nvinfer NAMES nvinfer nvinfer_11 libnvinfer.so.11
16
- PATHS "${_tensorrt_libs}" NO_DEFAULT_PATH REQUIRED)
17
- set(TENSORACLE_TENSORRT_LIBRARY "${_nvinfer}" CACHE FILEPATH "TensorRT from the build wheel" FORCE)
18
- set(CUDAToolkit_ROOT "${_cuda_root}" CACHE PATH "CUDA headers from the build wheel" FORCE)
19
19
  set(TENSORACLE_INSTALL_ROOT "tensoracle/cpp" CACHE STRING "Wheel SDK prefix" FORCE)
20
20
  set(TENSORACLE_INSTALL_RPATH "$ORIGIN/../../../tensorrt_libs" CACHE STRING "TensorRT wheel lookup" FORCE)
21
21
  set(CMAKE_INSTALL_LIBDIR lib CACHE STRING "Wheel library directory" FORCE)
22
22
  set(BUILD_TESTING OFF CACHE BOOL "Tests are built separately" FORCE)
23
23
  set(TENSORACLE_BUILD_CUBIN_HELPER OFF CACHE BOOL "Ship the source-based helper" FORCE)
24
24
 
25
- # A staged sdist has cpp next to CMakeLists.txt; the normal checkout has ../cpp.
26
- if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cpp/CMakeLists.txt")
27
- set(_cpp "${CMAKE_CURRENT_SOURCE_DIR}/cpp")
28
- else()
29
- set(_cpp "${CMAKE_CURRENT_SOURCE_DIR}/../cpp")
30
- endif()
31
25
  add_subdirectory("${_cpp}" cpp)
32
26
  nanobind_add_module(_native STABLE_ABI bindings.cpp cubin_bindings.cpp)
33
27
  target_link_libraries(_native PRIVATE tensoracle::tensoracle)
@@ -37,8 +31,11 @@ set_target_properties(_native PROPERTIES
37
31
  LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/tensoracle"
38
32
  BUILD_RPATH_USE_ORIGIN YES INSTALL_RPATH "$ORIGIN/cpp/lib")
39
33
  install(TARGETS _native LIBRARY DESTINATION tensoracle RUNTIME DESTINATION tensoracle)
40
- # The build RPATH finds libtensoracle and the TensorRT wheel while the stub is generated.
34
+ # The build RPATH finds libtensoracle and the Conan TensorRT SDK during stub generation.
41
35
  # Private names are kept because public signatures return _CacheResult.
42
- nanobind_add_stub(_native_stub MODULE tensoracle._native OUTPUT _native.pyi
43
- PYTHON_PATH "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS _native INCLUDE_PRIVATE)
36
+ add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_native.pyi"
37
+ COMMAND "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/build_backend.py"
38
+ "${_stub_nvinfer}" "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/_native.pyi"
39
+ DEPENDS _native "${CMAKE_CURRENT_SOURCE_DIR}/build_backend.py" VERBATIM)
40
+ add_custom_target(_native_stub ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/_native.pyi")
44
41
  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_native.pyi" DESTINATION tensoracle)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tensoracle
3
- Version: 2.1.2
3
+ Version: 2.2.3
4
4
  Summary: Build, save, reuse, and execute TensorRT engines from safetensors weights
5
5
  Author-Email: minamik <mia@sync.dev>
6
6
  License-Expression: MIT
@@ -19,7 +19,7 @@ Project-URL: issues, https://github.com/sync-dev-org/tensoracle/issues
19
19
  Requires-Python: <3.14,>=3.12
20
20
  Requires-Dist: numpy>=2.0
21
21
  Requires-Dist: safetensors>=0.4
22
- Requires-Dist: tensorrt-cu13<12,>=11.0
22
+ Requires-Dist: tensorrt-cu13<12,>=11.2
23
23
  Provides-Extra: convert
24
24
  Requires-Dist: torch>=2.6; extra == "convert"
25
25
  Provides-Extra: producer
@@ -47,10 +47,10 @@ Read the [v2 user guide](https://sync-dev-org.github.io/tensoracle/) and [Migrat
47
47
  | Role | Use | Additional requirements |
48
48
  | --- | --- | --- |
49
49
  | Inference application | Call the model package's inference binding. | NVIDIA GPU and driver; the model package manages CUDA buffers and streams. |
50
- | Model package developer | Open and execute engines through tensoracle's C++ SDK, exposing inference through your own binding. | TensorRT 11 headers, CMake 3.26 or later, C++17 compiler, and a binding framework when needed. |
51
- | Cubin plugin developer | Compile CUDA C++ kernels and package a native plugin with the model. | `tensoracle[producer]`, PyPI CUDA headers and tools, TensorRT SDK, CMake, and a C++17 compiler. |
50
+ | Model package developer | Open and execute engines through tensoracle's C++ SDK, exposing inference through your own binding. | TensorRT 11.2 or later (below 12) headers, CMake 3.26 or later, C++17 compiler, and a binding framework when needed. |
51
+ | Cubin plugin developer | Compile CUDA C++ kernels and package a native plugin with the model. | `tensoracle[producer]`, Conan CUDA headers and TensorRT SDK, PyPI producer tools, CMake, and a C++17 compiler. |
52
52
 
53
- v2 supplies a Linux x86_64 `manylinux_2_28`, `cp312-abi3` wheel, including WSL2. The package currently declares Python 3.12 and 3.13 support. Target GPUs are sm86, sm89, and sm120 with TensorRT 11; fp8 requires sm89 or sm120. Windows x86_64 users must keep using tensoracle 1.x until a later v2 minor release adds a Windows wheel.
53
+ v2 supplies a Linux x86_64 `manylinux_2_28`, `cp312-abi3` wheel, including WSL2. The package currently declares Python 3.12 and 3.13 support. Target GPUs are sm86, sm89, and sm120 with TensorRT 11.2 or later (below 12); fp8 requires sm89 or sm120. Windows x86_64 users must keep using tensoracle 1.x until a later v2 minor release adds a Windows wheel.
54
54
 
55
55
  The wheel contains the C++ public headers, `libtensoracle`, CMake package configuration, and cubin plugin helper sources. TensorRT is resolved through a wheel dependency; the NVIDIA driver is not bundled. Public C++ interfaces and saved engine files remain compatible within a major version.
56
56
 
@@ -15,10 +15,10 @@ Read the [v2 user guide](https://sync-dev-org.github.io/tensoracle/) and [Migrat
15
15
  | Role | Use | Additional requirements |
16
16
  | --- | --- | --- |
17
17
  | Inference application | Call the model package's inference binding. | NVIDIA GPU and driver; the model package manages CUDA buffers and streams. |
18
- | Model package developer | Open and execute engines through tensoracle's C++ SDK, exposing inference through your own binding. | TensorRT 11 headers, CMake 3.26 or later, C++17 compiler, and a binding framework when needed. |
19
- | Cubin plugin developer | Compile CUDA C++ kernels and package a native plugin with the model. | `tensoracle[producer]`, PyPI CUDA headers and tools, TensorRT SDK, CMake, and a C++17 compiler. |
18
+ | Model package developer | Open and execute engines through tensoracle's C++ SDK, exposing inference through your own binding. | TensorRT 11.2 or later (below 12) headers, CMake 3.26 or later, C++17 compiler, and a binding framework when needed. |
19
+ | Cubin plugin developer | Compile CUDA C++ kernels and package a native plugin with the model. | `tensoracle[producer]`, Conan CUDA headers and TensorRT SDK, PyPI producer tools, CMake, and a C++17 compiler. |
20
20
 
21
- v2 supplies a Linux x86_64 `manylinux_2_28`, `cp312-abi3` wheel, including WSL2. The package currently declares Python 3.12 and 3.13 support. Target GPUs are sm86, sm89, and sm120 with TensorRT 11; fp8 requires sm89 or sm120. Windows x86_64 users must keep using tensoracle 1.x until a later v2 minor release adds a Windows wheel.
21
+ v2 supplies a Linux x86_64 `manylinux_2_28`, `cp312-abi3` wheel, including WSL2. The package currently declares Python 3.12 and 3.13 support. Target GPUs are sm86, sm89, and sm120 with TensorRT 11.2 or later (below 12); fp8 requires sm89 or sm120. Windows x86_64 users must keep using tensoracle 1.x until a later v2 minor release adds a Windows wheel.
22
22
 
23
23
  The wheel contains the C++ public headers, `libtensoracle`, CMake package configuration, and cubin plugin helper sources. TensorRT is resolved through a wheel dependency; the NVIDIA driver is not bundled. Public C++ interfaces and saved engine files remain compatible within a major version.
24
24
 
@@ -1,8 +1,11 @@
1
1
  """Supply shared repository sources to scikit-build-core from the Python project."""
2
2
 
3
+ import ctypes
3
4
  import json
4
5
  import os
6
+ import runpy
5
7
  import shutil
8
+ import sys
6
9
  import tempfile
7
10
  from contextlib import contextmanager
8
11
  from pathlib import Path
@@ -16,7 +19,7 @@ get_requires_for_build_wheel = native_build.get_requires_for_build_wheel
16
19
 
17
20
 
18
21
  @contextmanager
19
- def _source_tree(*, editable=False):
22
+ def _source_tree(*, editable=False, include_recipes=False):
20
23
  project = Path(__file__).resolve().parent
21
24
  source_archive = (project / "PKG-INFO").is_file()
22
25
  repository = project if source_archive else project.parent
@@ -67,6 +70,15 @@ def _source_tree(*, editable=False):
67
70
  )
68
71
  else:
69
72
  shutil.copyfile(source, destination)
73
+ if include_recipes:
74
+ recipe_tools = runpy.run_path(str(repository / "cpp/conan/recipes.py"))
75
+ cache = os.environ.get("TENSORACLE_CONAN_CACHE")
76
+ cache_args = ["--core-conf", f"core.cache:storage_path={cache}"] if cache else []
77
+ recipe_tools["copy_recipes"](
78
+ repository / "cpp/conan",
79
+ staged / "cpp/conan/recipes",
80
+ cache_args=cache_args,
81
+ )
70
82
  if editable:
71
83
  # Source redirects must survive deletion of the staging directory.
72
84
  settings = staged / "pyproject.toml"
@@ -98,7 +110,11 @@ def _source_tree(*, editable=False):
98
110
  def _call(hook, directory, config_settings=None, metadata_directory=None, *, editable=False):
99
111
  output = str(Path(directory).resolve())
100
112
  metadata = str(Path(metadata_directory).resolve()) if metadata_directory else None
101
- with _source_tree(editable=editable):
113
+ with _source_tree(
114
+ editable=editable,
115
+ include_recipes=hook
116
+ in (native_build.build_sdist, native_build.build_wheel, native_build.build_editable),
117
+ ):
102
118
  if hook in (native_build.build_wheel, native_build.build_editable):
103
119
  return hook(output, config_settings, metadata)
104
120
  return hook(output, config_settings)
@@ -130,3 +146,42 @@ def prepare_metadata_for_build_editable(metadata_directory, config_settings=None
130
146
  return _call(
131
147
  native_build.prepare_metadata_for_build_editable, metadata_directory, config_settings
132
148
  )
149
+
150
+
151
+ def _generate_stubs(library, module_path, destination):
152
+ """Keep stub generation on the same TensorRT binary used by the native build."""
153
+ import hashlib
154
+ import importlib
155
+
156
+ expected = Path(library).resolve()
157
+ # Load this SONAME before importing the extension, including when the caller
158
+ # has a different TensorRT on its ordinary library search path.
159
+ ctypes.CDLL(str(expected))
160
+ os.environ["NB_STUBGEN"] = "1"
161
+ sys.path.insert(0, module_path)
162
+ importlib.import_module("tensoracle._native")
163
+ loaded = {
164
+ Path(line.split()[-1]).resolve()
165
+ for line in Path("/proc/self/maps").read_text().splitlines()
166
+ if "/libnvinfer.so" in line
167
+ }
168
+ if loaded != {expected}:
169
+ raise RuntimeError(f"Stub generator expected TensorRT {expected}; loaded {loaded}")
170
+ with expected.open("rb") as file:
171
+ digest = hashlib.file_digest(file, "sha256").hexdigest()
172
+ print(
173
+ "TensorRT for stub generation: "
174
+ + json.dumps(
175
+ {
176
+ "library": str(expected),
177
+ "sha256": digest,
178
+ }
179
+ ),
180
+ flush=True,
181
+ )
182
+ sys.argv = ["nanobind.stubgen", "-m", "tensoracle._native", "-o", destination, "-P"]
183
+ runpy.run_module("nanobind.stubgen", run_name="__main__")
184
+
185
+
186
+ if __name__ == "__main__":
187
+ _generate_stubs(*sys.argv[1:])
@@ -1,4 +1,9 @@
1
1
  cmake_minimum_required(VERSION 3.26)
2
+ option(BUILD_TESTING "Build tensoracle tests" ON)
3
+ if(BUILD_TESTING)
4
+ set(TENSORACLE_CONAN_OFFLINE ON CACHE BOOL "Use prepared test dependencies")
5
+ endif()
6
+ include("${CMAKE_CURRENT_LIST_DIR}/conan/bootstrap.cmake")
2
7
  set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
3
8
  "${CMAKE_CURRENT_SOURCE_DIR}/include/tensoracle/tensoracle.h")
4
9
  file(READ "${CMAKE_CURRENT_SOURCE_DIR}/include/tensoracle/tensoracle.h" _tensoracle_header)
@@ -17,27 +22,18 @@ if(TENSORACLE_BUILD_CUBIN_HELPER)
17
22
  _tensoracle_find_cuda()
18
23
  get_target_property(TENSORACLE_CUDA_INCLUDE tensoracle_cuda_driver INTERFACE_INCLUDE_DIRECTORIES)
19
24
  else()
20
- # The shared core only needs headers; wheel builds need no driver link stub.
25
+ # The Conan toolchain supplies the same headers without linking the driver.
21
26
  find_path(TENSORACLE_CUDA_INCLUDE cuda_runtime_api.h
22
- HINTS "${CUDAToolkit_ROOT}/include" "$ENV{CUDAToolkit_ROOT}/include"
23
- /usr/local/cuda/include REQUIRED)
27
+ PATHS "${CUDAToolkit_ROOT}/include" NO_DEFAULT_PATH REQUIRED NO_CACHE)
24
28
  endif()
25
29
 
26
- set(TENSORRT_ROOT "$ENV{TENSORACLE_SDK_ROOT}" CACHE PATH "TensorRT 11 SDK root")
27
- set(TENSORACLE_TENSORRT_LIBRARY "$ENV{TENSORACLE_TENSORRT_LIBRARY}" CACHE FILEPATH
28
- "TensorRT 11 libnvinfer (may be supplied by the tensorrt_libs wheel)")
30
+ include(cmake/TensoracleDependencies.cmake)
29
31
  find_path(TENSORACLE_TENSORRT_INCLUDE NvInfer.h
30
- HINTS "${TENSORRT_ROOT}/include" REQUIRED)
31
- if(NOT TENSORACLE_TENSORRT_LIBRARY)
32
- find_library(_tensoracle_nvinfer NAMES nvinfer nvinfer_11 libnvinfer.so.11
33
- HINTS "${TENSORRT_ROOT}/lib" "${TENSORRT_ROOT}/lib64" REQUIRED)
34
- set(TENSORACLE_TENSORRT_LIBRARY "${_tensoracle_nvinfer}" CACHE FILEPATH "TensorRT 11 libnvinfer" FORCE)
35
- endif()
36
- if(NOT EXISTS "${TENSORACLE_TENSORRT_LIBRARY}")
37
- message(FATAL_ERROR "TensorRT libnvinfer is missing: ${TENSORACLE_TENSORRT_LIBRARY}")
38
- endif()
32
+ PATHS ${TensorRT_INCLUDE_DIRS} NO_DEFAULT_PATH REQUIRED NO_CACHE)
33
+ get_filename_component(_tensoracle_tensorrt_root "${TENSORACLE_TENSORRT_INCLUDE}" DIRECTORY)
34
+ set(TENSORACLE_TENSORRT_LIBRARY "${_tensoracle_tensorrt_root}/lib/libnvinfer.so.11")
35
+ message(STATUS "TensorRT SDK from Conan: ${TENSORACLE_TENSORRT_INCLUDE}; ${TENSORACLE_TENSORRT_LIBRARY}")
39
36
 
40
- include(cmake/TensoracleDependencies.cmake)
41
37
  add_library(tensoracle SHARED src/abi.cpp src/error.cpp src/bundle.cpp src/producer.cpp src/comparison.cpp)
42
38
  target_sources(tensoracle PRIVATE src/engine.cpp src/cache.cpp src/plugins.cpp src/cache_open.cpp)
43
39
  target_sources(tensoracle PRIVATE src/cache_management.cpp src/cache_management_internal.cpp)
@@ -95,9 +91,10 @@ install(TARGETS tensoracle EXPORT tensoracleTargets
95
91
  RUNTIME DESTINATION "${_tensoracle_root}${CMAKE_INSTALL_BINDIR}"
96
92
  ARCHIVE DESTINATION "${TENSORACLE_LIBRARY_DIR}")
97
93
  install(DIRECTORY include/ DESTINATION "${TENSORACLE_INCLUDE_DIR}")
98
- install(FILES "${tensoracle_json_SOURCE_DIR}/LICENSE.MIT"
94
+ include("${CMAKE_BINARY_DIR}/conan/tensoracle_licenses.cmake")
95
+ install(FILES "${TENSORACLE_NLOHMANN_JSON_LICENSE}"
99
96
  DESTINATION "${_tensoracle_root}licenses/nlohmann-json")
100
- install(FILES "${tensoracle_miniz_SOURCE_DIR}/LICENSE"
97
+ install(FILES "${TENSORACLE_MINIZ_LICENSE}"
101
98
  DESTINATION "${_tensoracle_root}licenses/miniz")
102
99
  install(FILES src/cubin_plugin.cpp src/sha256.hpp DESTINATION "${_tensoracle_root}src")
103
100
  install(FILES cmake/TensoracleCuda.cmake cmake/TensoracleCubinPlugin.cmake
@@ -0,0 +1,81 @@
1
+ # Building tensoracle's C++ library
2
+
3
+ Applications can use the [prebuilt C and C++ SDK](../docs/cpp-sdk.md) from the public
4
+ GitHub Release: verify the archive's SHA256, extract it, and configure CMake with
5
+ `CMAKE_PREFIX_PATH` pointing to `tensoracle/cpp`. The tensoracle Conan package
6
+ recipe is maintained separately and is not included in this repository.
7
+ The following commands build tensoracle from source.
8
+
9
+ C++ builds require CMake 3.26 or later, Ninja, GCC 13 on Linux x86_64, the pinned
10
+ Conan dependencies. CUDA headers and the driver link stub come from the locked
11
+ `cuda-toolkit/13.2.2` recipe (`compiler=False`), as described in the
12
+ [SDK guide](../docs/tensorrt-sdk.md).
13
+ Python bindings are built separately through `python/`. The supported TensorRT
14
+ runtime is 11.2 or later (below 12); the build SDK is pinned to 11.2.1.2.
15
+
16
+ Install the Conan CLI at the exact version declared by `python/pyproject.toml`:
17
+
18
+ ```bash
19
+ uv tool install "$(python3 -c 'import tomllib; from pathlib import Path; print(next(r for r in tomllib.loads(Path("python/pyproject.toml").read_text())["build-system"]["requires"] if r.startswith("conan==")))')"
20
+ cmake -P cpp/conan/prepare-tests.cmake
21
+ cmake -S cpp -B .nf/tmp/cpp -G Ninja
22
+ cmake --build .nf/tmp/cpp --parallel 8
23
+ ctest --test-dir .nf/tmp/cpp --output-on-failure
24
+ ```
25
+
26
+ Run these commands from the repository root. Test configuration uses prepared
27
+ recipes and binaries with no remotes, package builds, or recipe exports. Prepare
28
+ again after changing a recipe, profile, or lock. Without prepared dependencies,
29
+ configuration fails and prints the preparation command. To build only the library,
30
+ pass `-DBUILD_TESTING=OFF`; dependencies can then be obtained during configuration.
31
+
32
+ CTest needs a full TensorRT runtime, including its builder resources, separately
33
+ from the Conan SDK used for compilation and linking. By default, test configuration
34
+ looks for `tensorrt_libs` under `python/.venv/lib/python*/site-packages/`, as installed
35
+ by running `uv sync` from `python/`. To use a separate runtime without a Python
36
+ environment, add `-DTENSORACLE_TEST_TENSORRT_RUNTIME=/path/to/tensorrt/lib` to the
37
+ configure command. The directory must contain `libnvinfer.so.11` and the TensorRT
38
+ builder resource libraries. Configuration stops with this option in its diagnostic
39
+ if no full runtime is available. CTest supplies the selected directory through
40
+ `LD_LIBRARY_PATH` to the tests and their child processes; no manual environment
41
+ setting is needed. Library builds with `BUILD_TESTING=OFF` do not require a test
42
+ runtime.
43
+
44
+ The C++ cubin producer test uses the CUDA compiler tools from `python/.venv`
45
+ when the producer extra is installed. Its compilation still uses the Conan
46
+ CUDA headers. Without those runtime tools, that optional test is skipped.
47
+
48
+ A source build using `add_subdirectory(cpp)` includes `cpp/conan/bootstrap.cmake`
49
+ in its top-level `CMakeLists.txt` before the first `project()`, so the parent
50
+ project also uses the generated compiler settings and dependency search paths.
51
+
52
+ `cpp/conanfile.py` and `cpp/conan.lock` select nlohmann/json 3.11.3, miniz 3.1.1,
53
+ Catch2 3.16.1, TensorRT SDK 11.2.1.2, and CUDA build inputs 13.2.2. Miniz, nlohmann/json, and Catch2
54
+ come from ConanCenter. Source distributions include the locked TensorRT recipe,
55
+ verified input manifest, and licenses in `cpp/conan/recipes/tensorrt/`, plus the
56
+ CUDA recipe and manifest in `cpp/conan/recipes/cuda-toolkit/`. The generated
57
+ toolchain supplies `CUDAToolkit_ROOT`; an explicit existing CUDA root is still accepted. TensorRT headers
58
+ and the link library come from the same digest-verified recipe for standalone,
59
+ wheel, and test builds; no `TENSORACLE_SDK_ROOT` or `TENSORRT_ROOT` is required. The default profile is `linux-gcc13`; release builds select
60
+ `linux-gcc14` for the manylinux image's compiler. Each profile selects C++17,
61
+ `libstdc++11`, and at most eight build jobs. CMake is supplied by the build
62
+ environment, including isolated Python builds.
63
+ CMake's tool requirement is represented as `cmake/system` in Conan, so the lock
64
+ does not depend on the installed CMake version. Each CMake entry point checks
65
+ the minimum version. Conan does not download or build a CMake package.
66
+
67
+ Set `CONAN_HOME` to isolate Conan's metadata. To isolate its package storage, pass
68
+ `-DTENSORACLE_CONAN_CACHE=/absolute/package/directory` to both preparation and
69
+ configuration. The equivalent environment variable also applies to Python test
70
+ fixtures. Python's editable build accepts
71
+ `-Ccmake.define.TENSORACLE_CONAN_CACHE=/absolute/package/directory`.
72
+ Run Python tests after preparation with `TENSORACLE_CONAN_OFFLINE=ON`; native
73
+ fixtures always use this mode. Conan is a build dependency: installed CMake
74
+ consumers can use the prebuilt SDK archive without Conan or its targets.
75
+
76
+ nanobind stays in Python's build requirements. C++ build inputs come from Conan;
77
+ the CUDA compiler and tools used at runtime by the cubin producer stay in PyPI
78
+ wheels. The release profile uses the CUDA toolkit in the manylinux image through
79
+ the same recipe's `system` mode; development uses verified NVIDIA redist archives. Installed Python wheels resolve
80
+ TensorRT through their existing runtime wheel dependency. Native applications
81
+ install TensorRT and its builder resources on their execution host.
@@ -1,7 +1,7 @@
1
1
  include_guard(GLOBAL)
2
2
 
3
- # Only the Driver API is needed by the C++ helpers. A PyPI CUDA root has neither
4
- # the unversioned cudart linker name nor all the headers of a complete toolkit.
3
+ # Only the Driver API is needed by the C++ helpers. Runtime-only Conan SDKs
4
+ # supply the headers and link stub without nvcc or an OS toolkit installation.
5
5
  function(_tensoracle_find_cuda)
6
6
  if(CUDAToolkit_ROOT)
7
7
  set(_roots "${CUDAToolkit_ROOT}")
@@ -57,8 +57,8 @@ function(_tensoracle_find_cuda)
57
57
  set(_root "${_selected_root}")
58
58
  if(NOT _include)
59
59
  message(FATAL_ERROR "CUDA header cuda.h was not found. Searched: ${_searched_includes}. "
60
- "Install PyPI nvidia-cuda-nvcc and nvidia-cuda-runtime 13.2 and set "
61
- "CUDAToolkit_ROOT to their site-packages/nvidia/cu13 directory.")
60
+ "Prepare cuda-toolkit/13.2.2 with Conan and set CUDAToolkit_ROOT "
61
+ "to its user.cuda:root, or supply an existing CUDA SDK root.")
62
62
  endif()
63
63
 
64
64
  if(WIN32)
@@ -66,23 +66,23 @@ function(_tensoracle_find_cuda)
66
66
  find_library(_tensoracle_cuda_driver_library NAMES cuda
67
67
  PATHS ${_driver_paths} NO_DEFAULT_PATH)
68
68
  else()
69
- set(_driver_paths "/usr/lib/wsl/lib" "${_root}/lib64" "${_root}/lib"
69
+ set(_driver_paths "${_root}/lib64/stubs" "${_root}/lib/stubs"
70
+ "${_root}/targets/x86_64-linux/lib/stubs" "${_root}/lib64" "${_root}/lib"
70
71
  "${_root}/targets/x86_64-linux/lib")
71
- find_library(_tensoracle_cuda_driver_library NAMES cuda HINTS ${_driver_paths})
72
+ find_library(_tensoracle_cuda_driver_library NAMES cuda PATHS ${_driver_paths} NO_DEFAULT_PATH)
72
73
  if(NOT _tensoracle_cuda_driver_library)
73
- list(APPEND _driver_paths "${_root}/lib64/stubs" "${_root}/lib/stubs"
74
- "${_root}/targets/x86_64-linux/lib/stubs")
74
+ list(APPEND _driver_paths "/usr/lib/wsl/lib")
75
75
  find_library(_tensoracle_cuda_driver_library NAMES cuda
76
- PATHS ${_driver_paths} NO_DEFAULT_PATH)
76
+ HINTS "/usr/lib/wsl/lib")
77
77
  endif()
78
78
  endif()
79
79
  set(_driver "${_tensoracle_cuda_driver_library}")
80
80
  unset(_tensoracle_cuda_driver_library CACHE)
81
81
  if(NOT _driver)
82
82
  message(FATAL_ERROR "CUDA driver link library was not found. Searched: ${_driver_paths} "
83
- "and system library directories. Install the NVIDIA driver on Linux; on Windows "
84
- "install PyPI nvidia-cuda-runtime 13.2 and set CUDAToolkit_ROOT to its "
85
- "site-packages/nvidia/cu13 directory (lib/x64/cuda.lib).")
83
+ "and system library directories. Prepare cuda-toolkit/13.2.2 with Conan "
84
+ "and set CUDAToolkit_ROOT to its user.cuda:root. Existing CUDA SDK roots "
85
+ "and the installed NVIDIA driver on Linux remain supported.")
86
86
  endif()
87
87
  message(STATUS "tensoracle CUDA headers: ${_include}")
88
88
  message(STATUS "tensoracle CUDA driver: ${_driver}")
@@ -0,0 +1,6 @@
1
+ include_guard(GLOBAL)
2
+ find_package(nlohmann_json 3.11.3 EXACT CONFIG REQUIRED)
3
+ find_package(miniz 3.1.1 EXACT CONFIG REQUIRED)
4
+ find_package(TensorRT 11.2.1.2 EXACT CONFIG REQUIRED)
5
+ add_library(tensoracle_json ALIAS nlohmann_json::nlohmann_json)
6
+ add_library(tensoracle_miniz ALIAS miniz::miniz)
@@ -0,0 +1,47 @@
1
+ @PACKAGE_INIT@
2
+ include("@PACKAGE_TENSORACLE_HELPER_DIR@/TensoracleCubinPlugin.cmake")
3
+ if(NOT TARGET tensoracle::tensoracle)
4
+ if(NOT TARGET TensorRT::nvinfer)
5
+ find_package(TensorRT QUIET CONFIG)
6
+ endif()
7
+ if(TARGET TensorRT::nvinfer)
8
+ set(_tensoracle_nvinfer TensorRT::nvinfer)
9
+ get_target_property(_tensoracle_nvinfer_type TensorRT::nvinfer TYPE)
10
+ if(_tensoracle_nvinfer_type STREQUAL "INTERFACE_LIBRARY")
11
+ # CMakeDeps exposes its per-configuration library directories here.
12
+ set(_tensoracle_nvinfer_dirs
13
+ "$<TARGET_GENEX_EVAL:TensorRT::nvinfer,$<TARGET_PROPERTY:TensorRT::nvinfer,INTERFACE_LINK_DIRECTORIES>>")
14
+ else()
15
+ set(_tensoracle_nvinfer_dirs "$<TARGET_FILE_DIR:TensorRT::nvinfer>")
16
+ endif()
17
+ else()
18
+ # Native SDKs use a host library. Wheels can use the separate TensorRT
19
+ # distribution beside tensoracle; no build-machine path is recorded here.
20
+ find_library(TENSORACLE_TENSORRT_LIBRARY NAMES nvinfer libnvinfer.so.11
21
+ HINTS "${TENSORRT_ROOT}" "$ENV{TENSORRT_ROOT}"
22
+ "${CMAKE_CURRENT_LIST_DIR}/../../../../../tensorrt_libs"
23
+ PATH_SUFFIXES lib lib64 lib/x86_64-linux-gnu)
24
+ if(NOT TENSORACLE_TENSORRT_LIBRARY OR NOT EXISTS "${TENSORACLE_TENSORRT_LIBRARY}")
25
+ set(tensoracle_FOUND FALSE)
26
+ set(tensoracle_NOT_FOUND_MESSAGE
27
+ "TensorRT 11 link library not found. Supply TensorRT::nvinfer through its CMake package, set TENSORRT_ROOT to its installation directory, or set TENSORACLE_TENSORRT_LIBRARY to the full library path.")
28
+ return()
29
+ endif()
30
+ set(_tensoracle_nvinfer "${TENSORACLE_TENSORRT_LIBRARY}")
31
+ get_filename_component(_tensoracle_nvinfer_dirs "${TENSORACLE_TENSORRT_LIBRARY}" DIRECTORY)
32
+ endif()
33
+ include("${CMAKE_CURRENT_LIST_DIR}/tensoracleTargets.cmake")
34
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
35
+ # Resolve libtensoracle's DT_NEEDED at link time without adding a direct
36
+ # TensorRT dependency to consumers that already rely on its RUNPATH.
37
+ set_property(TARGET tensoracle::tensoracle APPEND PROPERTY
38
+ INTERFACE_LINK_OPTIONS "LINKER:-rpath-link,$<JOIN:${_tensoracle_nvinfer_dirs},:>")
39
+ else()
40
+ set_property(TARGET tensoracle::tensoracle APPEND PROPERTY
41
+ INTERFACE_LINK_LIBRARIES "${_tensoracle_nvinfer}")
42
+ endif()
43
+ unset(_tensoracle_nvinfer)
44
+ unset(_tensoracle_nvinfer_dirs)
45
+ unset(_tensoracle_nvinfer_type)
46
+ endif()
47
+ check_required_components(tensoracle)
@@ -0,0 +1,13 @@
1
+ # Every build entry point includes this before its first project().
2
+ include_guard(GLOBAL)
3
+ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
4
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Build configuration" FORCE)
5
+ endif()
6
+ include("${CMAKE_CURRENT_LIST_DIR}/install.cmake")
7
+ tensoracle_conan_profile()
8
+ file(GLOB_RECURSE dependency_inputs LIST_DIRECTORIES FALSE "${CMAKE_CURRENT_LIST_DIR}/*")
9
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dependency_inputs}
10
+ "${CMAKE_CURRENT_LIST_DIR}/../conanfile.py" "${CMAKE_CURRENT_LIST_DIR}/../conan.lock"
11
+ "${TENSORACLE_CONAN_PROFILE_PATH}")
12
+ tensoracle_install_dependencies("${TENSORACLE_CONAN_PROFILE_PATH}" "${CMAKE_BINARY_DIR}/conan")
13
+ set(CMAKE_TOOLCHAIN_FILE "${CMAKE_BINARY_DIR}/conan/conan_toolchain.cmake" CACHE FILEPATH "Conan generated toolchain" FORCE)
@@ -0,0 +1,77 @@
1
+ include_guard(GLOBAL)
2
+
3
+ function(tensoracle_install_dependencies profile output_folder)
4
+ # The build requirement is the sole definition of the CLI version.
5
+ if(EXISTS "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../pyproject.toml")
6
+ set(metadata "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../pyproject.toml")
7
+ else()
8
+ set(metadata "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../python/pyproject.toml")
9
+ endif()
10
+ file(READ "${metadata}" contents)
11
+ string(REGEX MATCH "conan==([0-9]+\\.[0-9]+\\.[0-9]+)" requirement "${contents}")
12
+ if(NOT requirement)
13
+ message(FATAL_ERROR "Missing exact conan==X.Y.Z build requirement in ${metadata}")
14
+ endif()
15
+ set(version "${CMAKE_MATCH_1}")
16
+ set(TENSORACLE_CONAN_EXECUTABLE "" CACHE FILEPATH "Optional explicit Conan CLI")
17
+ if(TENSORACLE_CONAN_EXECUTABLE)
18
+ set(cli "${TENSORACLE_CONAN_EXECUTABLE}")
19
+ else()
20
+ find_program(cli conan NO_CACHE)
21
+ endif()
22
+ if(cli)
23
+ execute_process(COMMAND "${cli}" --version RESULT_VARIABLE status
24
+ OUTPUT_VARIABLE observed OUTPUT_STRIP_TRAILING_WHITESPACE)
25
+ endif()
26
+ if(NOT cli OR NOT status STREQUAL "0" OR NOT observed STREQUAL "Conan version ${version}")
27
+ message(FATAL_ERROR "${metadata} requires ${requirement}; found '${observed}' (${cli}). Use uv tool install ${requirement}")
28
+ endif()
29
+ set(TENSORACLE_CONAN_CACHE "$ENV{TENSORACLE_CONAN_CACHE}" CACHE PATH "Conan package storage; empty uses the Conan default")
30
+ set(TENSORACLE_CONAN_ARGS "$ENV{TENSORACLE_CONAN_ARGS}" CACHE STRING "Additional Conan install arguments")
31
+ option(TENSORACLE_CONAN_OFFLINE "Use prepared recipes and binaries without exports, remotes or builds" "$ENV{TENSORACLE_CONAN_OFFLINE}")
32
+ set(cache_args)
33
+ if(TENSORACLE_CONAN_CACHE)
34
+ list(APPEND cache_args --core-conf "core.cache:storage_path=${TENSORACLE_CONAN_CACHE}")
35
+ endif()
36
+ # A release container may have no writable HOME.
37
+ if(UNIX AND NOT DEFINED ENV{CONAN_HOME})
38
+ execute_process(COMMAND test -w "$ENV{HOME}" RESULT_VARIABLE unwritable)
39
+ if(unwritable)
40
+ set(ENV{CONAN_HOME} "${output_folder}/home")
41
+ endif()
42
+ endif()
43
+ set(lockfile "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../conan.lock")
44
+ if(NOT TENSORACLE_CONAN_OFFLINE)
45
+ find_program(recipe_python NAMES python3 python REQUIRED NO_CACHE)
46
+ execute_process(COMMAND "${recipe_python}" "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/recipes.py"
47
+ --conan "${cli}" ${cache_args}
48
+ RESULT_VARIABLE status OUTPUT_VARIABLE recipe_path ERROR_VARIABLE diagnostic)
49
+ if(NOT status EQUAL 0)
50
+ message(FATAL_ERROR "Locked SDK recipes are unavailable: ${diagnostic}")
51
+ endif()
52
+ set(policies --build=missing --remote conancenter ${TENSORACLE_CONAN_ARGS})
53
+ else()
54
+ set(policies --no-remote --build=never)
55
+ endif()
56
+ execute_process(COMMAND "${cli}" install "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/.."
57
+ --lockfile "${lockfile}" --profile:host "${profile}" --profile:build "${profile}"
58
+ --output-folder "${output_folder}" ${policies} ${cache_args}
59
+ RESULT_VARIABLE status)
60
+ if(NOT status EQUAL 0)
61
+ message(FATAL_ERROR "Conan dependencies are unavailable. Prepare them with: cmake -DTENSORACLE_CONAN_PROFILE=${profile} -DTENSORACLE_CONAN_CACHE=${TENSORACLE_CONAN_CACHE} -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/prepare-tests.cmake (CONAN_HOME=$ENV{CONAN_HOME})")
62
+ endif()
63
+ endfunction()
64
+
65
+ function(tensoracle_conan_profile)
66
+ set(default_profile "$ENV{TENSORACLE_CONAN_PROFILE}")
67
+ if(NOT default_profile)
68
+ set(default_profile linux-gcc13)
69
+ endif()
70
+ set(TENSORACLE_CONAN_PROFILE "${default_profile}" CACHE STRING "Conan profile name or absolute path")
71
+ if(IS_ABSOLUTE "${TENSORACLE_CONAN_PROFILE}")
72
+ set(profile "${TENSORACLE_CONAN_PROFILE}")
73
+ else()
74
+ set(profile "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/profiles/${TENSORACLE_CONAN_PROFILE}")
75
+ endif()
76
+ set(TENSORACLE_CONAN_PROFILE_PATH "${profile}" PARENT_SCOPE)
77
+ endfunction()
@@ -0,0 +1,7 @@
1
+ cmake_minimum_required(VERSION 3.26)
2
+ include("${CMAKE_CURRENT_LIST_DIR}/install.cmake")
3
+ tensoracle_conan_profile()
4
+ set(TENSORACLE_CONAN_OUTPUT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../.nf/tmp/conan-tests" CACHE PATH "Test dependency generators")
5
+ # Preparation is the single writer of custom recipes before parallel tests.
6
+ set(TENSORACLE_CONAN_OFFLINE OFF)
7
+ tensoracle_install_dependencies("${TENSORACLE_CONAN_PROFILE_PATH}" "${TENSORACLE_CONAN_OUTPUT_DIR}")
@@ -0,0 +1,20 @@
1
+ [settings]
2
+ os=Linux
3
+ arch=x86_64
4
+ compiler=gcc
5
+ compiler.version=13
6
+ compiler.libcxx=libstdc++11
7
+ compiler.cppstd=17
8
+ build_type=Release
9
+
10
+ [conf]
11
+ tools.build:jobs=8
12
+ tools.cmake.cmaketoolchain:generator={{ os.getenv("CMAKE_GENERATOR", "Ninja") }}
13
+ tools.build:compiler_executables={"c": "gcc", "cpp": "g++"}
14
+
15
+ # The invoking CMake supplies the tool; its version is checked by CMakeLists.txt.
16
+ [replace_tool_requires]
17
+ cmake/*: cmake/system
18
+
19
+ [platform_tool_requires]
20
+ cmake/system
@@ -0,0 +1,25 @@
1
+ {% set cc = "/opt/rh/gcc-toolset-14/root/usr/bin/gcc" %}
2
+ {% set cxx = "/opt/rh/gcc-toolset-14/root/usr/bin/g++" %}
3
+ [settings]
4
+ os=Linux
5
+ arch=x86_64
6
+ compiler=gcc
7
+ compiler.version=14
8
+ compiler.libcxx=libstdc++11
9
+ compiler.cppstd=17
10
+ build_type=Release
11
+
12
+ [options]
13
+ cuda-toolkit/*:mode=system
14
+
15
+ [conf]
16
+ user.cuda:root=/usr/local/cuda-13.2
17
+ tools.build:jobs=8
18
+ tools.cmake.cmaketoolchain:generator={{ os.getenv("CMAKE_GENERATOR", "Unix Makefiles") }}
19
+ tools.build:compiler_executables={"c": "{{ cc }}", "cpp": "{{ cxx }}"}
20
+
21
+ [replace_tool_requires]
22
+ cmake/*: cmake/system
23
+
24
+ [platform_tool_requires]
25
+ cmake/system