tensoracle 1.2.0__tar.gz → 1.3.0__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 (93) hide show
  1. {tensoracle-1.2.0 → tensoracle-1.3.0}/PKG-INFO +10 -4
  2. {tensoracle-1.2.0 → tensoracle-1.3.0}/README.md +5 -3
  3. {tensoracle-1.2.0 → tensoracle-1.3.0}/cpp/CMakeLists.txt +3 -2
  4. {tensoracle-1.2.0 → tensoracle-1.3.0}/cpp/cmake/TensoracleCubinPlugin.cmake +5 -3
  5. tensoracle-1.3.0/cpp/cmake/TensoracleCuda.cmake +95 -0
  6. tensoracle-1.3.0/docs/api/producer.md +11 -0
  7. {tensoracle-1.2.0 → tensoracle-1.3.0}/docs/index.md +5 -3
  8. {tensoracle-1.2.0 → tensoracle-1.3.0}/docs/tensorrt-sdk.md +24 -8
  9. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/README.md +12 -7
  10. {tensoracle-1.2.0 → tensoracle-1.3.0}/pyproject.toml +7 -1
  11. {tensoracle-1.2.0 → tensoracle-1.3.0}/src/tensoracle/_version.py +2 -2
  12. {tensoracle-1.2.0 → tensoracle-1.3.0}/src/tensoracle/producer.py +15 -11
  13. tensoracle-1.3.0/tests/cubin_io/kernels.cu +17 -0
  14. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/native/CMakeLists.txt +10 -4
  15. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/native_build.py +13 -0
  16. tensoracle-1.3.0/tests/test_cmake_plugin.py +130 -0
  17. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_cpp_core.py +6 -5
  18. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_example_plugin.py +6 -2
  19. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_plugin_io.py +3 -3
  20. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_producer.py +69 -33
  21. {tensoracle-1.2.0 → tensoracle-1.3.0}/uv.lock +78 -15
  22. tensoracle-1.2.0/docs/api/producer.md +0 -7
  23. tensoracle-1.2.0/tests/cubin_io/kernels.cu +0 -11
  24. tensoracle-1.2.0/tests/test_cmake_plugin.py +0 -56
  25. {tensoracle-1.2.0 → tensoracle-1.3.0}/.gitignore +0 -0
  26. {tensoracle-1.2.0 → tensoracle-1.3.0}/LICENSE +0 -0
  27. {tensoracle-1.2.0 → tensoracle-1.3.0}/build_backend.py +0 -0
  28. {tensoracle-1.2.0 → tensoracle-1.3.0}/cpp/include/tensoracle/cubin_plugin.hpp +0 -0
  29. {tensoracle-1.2.0 → tensoracle-1.3.0}/cpp/src/cubin_plugin.cpp +0 -0
  30. {tensoracle-1.2.0 → tensoracle-1.3.0}/cpp/tests/core.cpp +0 -0
  31. {tensoracle-1.2.0 → tensoracle-1.3.0}/docs/api/bundle.md +0 -0
  32. {tensoracle-1.2.0 → tensoracle-1.3.0}/docs/api/index.md +0 -0
  33. {tensoracle-1.2.0 → tensoracle-1.3.0}/docs/cpp-python-repositories.md +0 -0
  34. {tensoracle-1.2.0 → tensoracle-1.3.0}/docs/optimization.md +0 -0
  35. {tensoracle-1.2.0 → tensoracle-1.3.0}/docs/precision.md +0 -0
  36. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/CMakeLists.txt +0 -0
  37. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/bundle.cpp +0 -0
  38. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/bundle.json +0 -0
  39. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm120/bias.cubin +0 -0
  40. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm120/dot.specialized.cubin +0 -0
  41. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm120/dot.tf32-control.cubin +0 -0
  42. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm120/dot.unspecialized.cubin +0 -0
  43. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm120/scale.cubin +0 -0
  44. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm86/bias.cubin +0 -0
  45. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm86/dot.specialized.cubin +0 -0
  46. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm86/dot.tf32-control.cubin +0 -0
  47. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm86/dot.unspecialized.cubin +0 -0
  48. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm86/scale.cubin +0 -0
  49. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm89/bias.cubin +0 -0
  50. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm89/dot.specialized.cubin +0 -0
  51. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm89/dot.tf32-control.cubin +0 -0
  52. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm89/dot.unspecialized.cubin +0 -0
  53. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/bundle/cubins/sm89/scale.cubin +0 -0
  54. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/example_cubin_plugin/__init__.py +0 -0
  55. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/example_cubin_plugin/weights.safetensors +0 -0
  56. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/kernels.py +0 -0
  57. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/plugin.cpp +0 -0
  58. {tensoracle-1.2.0 → tensoracle-1.3.0}/examples/cubin_plugin/pyproject.toml +0 -0
  59. {tensoracle-1.2.0 → tensoracle-1.3.0}/mkdocs.yml +0 -0
  60. {tensoracle-1.2.0 → tensoracle-1.3.0}/src/tensoracle/__init__.py +0 -0
  61. {tensoracle-1.2.0 → tensoracle-1.3.0}/src/tensoracle/_build.py +0 -0
  62. {tensoracle-1.2.0 → tensoracle-1.3.0}/src/tensoracle/_cache.py +0 -0
  63. {tensoracle-1.2.0 → tensoracle-1.3.0}/src/tensoracle/_comparison.py +0 -0
  64. {tensoracle-1.2.0 → tensoracle-1.3.0}/src/tensoracle/_execution.py +0 -0
  65. {tensoracle-1.2.0 → tensoracle-1.3.0}/src/tensoracle/_memory.py +0 -0
  66. {tensoracle-1.2.0 → tensoracle-1.3.0}/src/tensoracle/_plugins.py +0 -0
  67. {tensoracle-1.2.0 → tensoracle-1.3.0}/src/tensoracle/bundle.py +0 -0
  68. {tensoracle-1.2.0 → tensoracle-1.3.0}/src/tensoracle/convert.py +0 -0
  69. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/build_memory_runtime.py +0 -0
  70. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/cubin_io/check.cpp +0 -0
  71. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/cubin_io/plugin.cpp +0 -0
  72. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/cubins/ptxas-12.9.86/sm120.cubin +0 -0
  73. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/cubins/ptxas-12.9.86/sm86.cubin +0 -0
  74. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/cubins/ptxas-12.9.86/sm89.cubin +0 -0
  75. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/example_runtime.py +0 -0
  76. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/native/export.h +0 -0
  77. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/plugin_io_runtime.py +0 -0
  78. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/precision_runtime.py +0 -0
  79. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_build.py +0 -0
  80. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_build_memory.py +0 -0
  81. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_bundle.py +0 -0
  82. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_cache.py +0 -0
  83. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_comparison.py +0 -0
  84. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_convert.py +0 -0
  85. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_cuda_graphs.py +0 -0
  86. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_distribution.py +0 -0
  87. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_engine_io.py +0 -0
  88. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_execution.py +0 -0
  89. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_gpu_cache.py +0 -0
  90. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_plugins.py +0 -0
  91. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_precision.py +0 -0
  92. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_shape_tensor_outputs.py +0 -0
  93. {tensoracle-1.2.0 → tensoracle-1.3.0}/tests/test_weight_hash.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tensoracle
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Build, save, reuse, and execute TensorRT engines from safetensors weights
5
5
  Project-URL: documentation, https://sync-dev-org.github.io/tensoracle/
6
6
  Project-URL: repository, https://github.com/sync-dev-org/tensoracle
@@ -24,6 +24,10 @@ Requires-Dist: tensorrt-cu13<12,>=11.0
24
24
  Provides-Extra: convert
25
25
  Requires-Dist: torch>=2.6; extra == 'convert'
26
26
  Provides-Extra: producer
27
+ Requires-Dist: nvidia-cuda-crt==13.2.*; extra == 'producer'
28
+ Requires-Dist: nvidia-cuda-cuobjdump==13.2.*; extra == 'producer'
29
+ Requires-Dist: nvidia-cuda-nvcc==13.2.*; extra == 'producer'
30
+ Requires-Dist: nvidia-nvvm==13.2.*; extra == 'producer'
27
31
  Requires-Dist: triton==3.8.0; extra == 'producer'
28
32
  Description-Content-Type: text/markdown
29
33
 
@@ -43,7 +47,7 @@ Choose the path that matches your work:
43
47
  | --- | --- | --- |
44
48
  | Inference application | [Reopen a saved engine](#use-a-saved-engine-for-inference) and enqueue it with `handle.create_execution()`. | The application supplies device buffers and CUDA streams, for example through CuPy or `cuda-python`. |
45
49
  | Standard graph developer | [Define and build a graph](#define-and-build-a-standard-graph), [save and reopen](#save-and-reopen-an-engine), and [compare outputs](#compare-output-arrays). | None for standard TensorRT layers. |
46
- | Cubin plugin developer | [Build a cubin plugin](#build-a-cubin-plugin) and package it with the model. | `tensoracle[producer]`, CUDA toolkit, TensorRT SDK, CMake 3.20 or later, and a C++17 compiler. |
50
+ | Cubin plugin developer | [Build a cubin plugin](#build-a-cubin-plugin) and package it with the model. | `tensoracle[producer]`, PyPI CUDA headers, TensorRT SDK, CMake 3.20 or later, and a C++17 compiler. |
47
51
 
48
52
  | Requirement | Inference application | Standard graph developer | Cubin plugin developer |
49
53
  | --- | --- | --- | --- |
@@ -52,7 +56,7 @@ Choose the path that matches your work:
52
56
  | NVIDIA GPU and driver | Open and run engines | Build and run engines | Run and test engines; cubin production itself can run without a GPU |
53
57
  | CuPy or `cuda-python` | The application chooses its buffer and stream library | The application chooses its buffer and stream library | `cuda-python` is used by the example runtime and tests, not by `tensoracle` |
54
58
  | Triton 3.8.0 | Not needed | Not needed | Installed with `tensoracle[producer]` for cubin production |
55
- | CUDA toolkit | Not needed | Not needed | Cubin production (`ptxas >=13.2,<14` and `cuobjdump`) and native plugin build |
59
+ | PyPI CUDA tools and headers | Not needed | Not needed | `tensoracle[producer]` supplies cubin tools; `nvidia-cuda-nvcc` and `nvidia-cuda-runtime` 13.2 supply the native build inputs |
56
60
  | TensorRT 11 SDK | Not needed | Not needed | Native plugin build |
57
61
  | CMake 3.20 or later and C++17 compiler | Not needed | Not needed | Native plugin build |
58
62
 
@@ -344,7 +348,9 @@ python/
344
348
 
345
349
  Keep C++ sources in `cpp/`, with a CMake project that builds and runs its tests through CTest without Python. Keep the Python project, its src-layout package, and its uv environment in `python/`; run the project's uv commands from that directory. Tensoracle itself follows this layout, and the installed C++ helper paths described below remain inside its Python package.
346
350
 
347
- `tensoracle.producer.compile_bundle` uses the extra's **Triton 3.8.0** with **ptxas >=13.2,<14** and **cuobjdump** from the host CUDA toolkit. It uses the toolkit directory named by `CUDA_HOME`, or `/usr/local/cuda` when `CUDA_HOME` is unset; explicit `ptxas` and `cuobjdump` paths override these defaults independently. The normal import, engine build, and engine reuse paths do not import the producer or Triton. Cubin production does not need a GPU or import torch; run it without importing torch first. The caller supplies Triton functions and `KernelSpec` records with their public argument types, compile time constants, and any divisibility assumptions. The producer writes sm86, sm89, and sm120 cubins, `bundle.json`, and a C++ translation unit that embeds exactly those cubins. The generated C++ entry records carry each public argument's order, type, count, and divisibility rule into the common launcher. It rejects an unexpected parameter ABI or nonzero scratch requirement. The included [example](https://github.com/sync-dev-org/tensoracle/blob/main/examples/cubin_plugin/README.md#rebuild-the-cubins) has the command to rebuild its cubins from a repository clone.
351
+ `tensoracle.producer.compile_bundle` uses the extra's **Triton 3.8.0** with **ptxas >=13.2,<14** and **cuobjdump** from the PyPI `nvidia-cuda-nvcc` and `nvidia-cuda-cuobjdump` wheels. The extra pins those tools, `nvidia-cuda-crt`, and `nvidia-nvvm` to the 13.2 series. It does not read `CUDA_HOME`; explicit `ptxas` and `cuobjdump` paths override the wheel defaults independently. A missing tool identifies its package and searched path and explains how to install the extra or pass a path. The normal import, engine build, and engine reuse paths do not import the producer or Triton. Cubin production does not need a GPU or import torch; run it without importing torch first. The caller supplies Triton functions and `KernelSpec` records with their public argument types, compile time constants, and any divisibility assumptions. The producer writes sm86, sm89, and sm120 cubins, `bundle.json`, and a C++ translation unit that embeds exactly those cubins. The generated C++ entry records carry each public argument's order, type, count, and divisibility rule into the common launcher. It rejects an unexpected parameter ABI or nonzero scratch requirement. The included [example](https://github.com/sync-dev-org/tensoracle/blob/main/examples/cubin_plugin/README.md#rebuild-the-cubins) has the command to rebuild its cubins from a repository clone.
352
+
353
+ Neither cubin production nor native plugin building requires an OS-installed CUDA Toolkit. For the native build, install PyPI `nvidia-cuda-nvcc==13.2.*` and `nvidia-cuda-runtime==13.2.*`, then pass their `site-packages/nvidia/cu13` directory as `CUDAToolkit_ROOT` (a CMake variable or environment variable). The helper uses its `cuda.h` and links the NVIDIA driver's `libcuda.so` on Linux, including `/usr/lib/wsl/lib/libcuda.so` on WSL, or the wheel's `lib/x64/cuda.lib` on Windows. TensorRT headers still come from the separately prepared SDK. The [SDK guide](https://github.com/sync-dev-org/tensoracle/blob/main/docs/tensorrt-sdk.md#5-pass-the-verified-root-to-the-build-and-tests) gives the setup commands. An explicit OS Toolkit root and the existing default locations remain supported for native builds.
348
354
 
349
355
  The wheel also contains `tensoracle/cpp/include`, `tensoracle/cpp/src`, and `tensoracle/cpp/cmake`. Pass the installed `tensoracle/cpp` directory to CMake as `TENSORACLE_CPP_ROOT` and include `TensoracleCubinPlugin.cmake`. Its `tensoracle_add_cubin_plugin` function compiles the common C++ source, the caller's plugin source, and the generated `bundle.cpp` into the caller's library. The caller implements the graph's meaning, field meanings, weight placement, launch sequence, and variant selection. The common source owns typed fields in their original order, handles `IPluginV3` lifecycle methods, checks cubin digests and resources, loads one module per CUDA context, checks the generated argument count and specialization rules, appends the two supported zero scratch pointers, and launches kernels. The caller selects a variant using `Kernel::accepts` and derives the count passed to `Kernel::launch` from its argument array. The common source releases modules and device allocations in their owning contexts. The library must export TensorRT's `getCreators`; a static registration constructor is not supported.
350
356
 
@@ -14,7 +14,7 @@ Choose the path that matches your work:
14
14
  | --- | --- | --- |
15
15
  | Inference application | [Reopen a saved engine](#use-a-saved-engine-for-inference) and enqueue it with `handle.create_execution()`. | The application supplies device buffers and CUDA streams, for example through CuPy or `cuda-python`. |
16
16
  | Standard graph developer | [Define and build a graph](#define-and-build-a-standard-graph), [save and reopen](#save-and-reopen-an-engine), and [compare outputs](#compare-output-arrays). | None for standard TensorRT layers. |
17
- | Cubin plugin developer | [Build a cubin plugin](#build-a-cubin-plugin) and package it with the model. | `tensoracle[producer]`, CUDA toolkit, TensorRT SDK, CMake 3.20 or later, and a C++17 compiler. |
17
+ | Cubin plugin developer | [Build a cubin plugin](#build-a-cubin-plugin) and package it with the model. | `tensoracle[producer]`, PyPI CUDA headers, TensorRT SDK, CMake 3.20 or later, and a C++17 compiler. |
18
18
 
19
19
  | Requirement | Inference application | Standard graph developer | Cubin plugin developer |
20
20
  | --- | --- | --- | --- |
@@ -23,7 +23,7 @@ Choose the path that matches your work:
23
23
  | NVIDIA GPU and driver | Open and run engines | Build and run engines | Run and test engines; cubin production itself can run without a GPU |
24
24
  | CuPy or `cuda-python` | The application chooses its buffer and stream library | The application chooses its buffer and stream library | `cuda-python` is used by the example runtime and tests, not by `tensoracle` |
25
25
  | Triton 3.8.0 | Not needed | Not needed | Installed with `tensoracle[producer]` for cubin production |
26
- | CUDA toolkit | Not needed | Not needed | Cubin production (`ptxas >=13.2,<14` and `cuobjdump`) and native plugin build |
26
+ | PyPI CUDA tools and headers | Not needed | Not needed | `tensoracle[producer]` supplies cubin tools; `nvidia-cuda-nvcc` and `nvidia-cuda-runtime` 13.2 supply the native build inputs |
27
27
  | TensorRT 11 SDK | Not needed | Not needed | Native plugin build |
28
28
  | CMake 3.20 or later and C++17 compiler | Not needed | Not needed | Native plugin build |
29
29
 
@@ -315,7 +315,9 @@ python/
315
315
 
316
316
  Keep C++ sources in `cpp/`, with a CMake project that builds and runs its tests through CTest without Python. Keep the Python project, its src-layout package, and its uv environment in `python/`; run the project's uv commands from that directory. Tensoracle itself follows this layout, and the installed C++ helper paths described below remain inside its Python package.
317
317
 
318
- `tensoracle.producer.compile_bundle` uses the extra's **Triton 3.8.0** with **ptxas >=13.2,<14** and **cuobjdump** from the host CUDA toolkit. It uses the toolkit directory named by `CUDA_HOME`, or `/usr/local/cuda` when `CUDA_HOME` is unset; explicit `ptxas` and `cuobjdump` paths override these defaults independently. The normal import, engine build, and engine reuse paths do not import the producer or Triton. Cubin production does not need a GPU or import torch; run it without importing torch first. The caller supplies Triton functions and `KernelSpec` records with their public argument types, compile time constants, and any divisibility assumptions. The producer writes sm86, sm89, and sm120 cubins, `bundle.json`, and a C++ translation unit that embeds exactly those cubins. The generated C++ entry records carry each public argument's order, type, count, and divisibility rule into the common launcher. It rejects an unexpected parameter ABI or nonzero scratch requirement. The included [example](https://github.com/sync-dev-org/tensoracle/blob/main/examples/cubin_plugin/README.md#rebuild-the-cubins) has the command to rebuild its cubins from a repository clone.
318
+ `tensoracle.producer.compile_bundle` uses the extra's **Triton 3.8.0** with **ptxas >=13.2,<14** and **cuobjdump** from the PyPI `nvidia-cuda-nvcc` and `nvidia-cuda-cuobjdump` wheels. The extra pins those tools, `nvidia-cuda-crt`, and `nvidia-nvvm` to the 13.2 series. It does not read `CUDA_HOME`; explicit `ptxas` and `cuobjdump` paths override the wheel defaults independently. A missing tool identifies its package and searched path and explains how to install the extra or pass a path. The normal import, engine build, and engine reuse paths do not import the producer or Triton. Cubin production does not need a GPU or import torch; run it without importing torch first. The caller supplies Triton functions and `KernelSpec` records with their public argument types, compile time constants, and any divisibility assumptions. The producer writes sm86, sm89, and sm120 cubins, `bundle.json`, and a C++ translation unit that embeds exactly those cubins. The generated C++ entry records carry each public argument's order, type, count, and divisibility rule into the common launcher. It rejects an unexpected parameter ABI or nonzero scratch requirement. The included [example](https://github.com/sync-dev-org/tensoracle/blob/main/examples/cubin_plugin/README.md#rebuild-the-cubins) has the command to rebuild its cubins from a repository clone.
319
+
320
+ Neither cubin production nor native plugin building requires an OS-installed CUDA Toolkit. For the native build, install PyPI `nvidia-cuda-nvcc==13.2.*` and `nvidia-cuda-runtime==13.2.*`, then pass their `site-packages/nvidia/cu13` directory as `CUDAToolkit_ROOT` (a CMake variable or environment variable). The helper uses its `cuda.h` and links the NVIDIA driver's `libcuda.so` on Linux, including `/usr/lib/wsl/lib/libcuda.so` on WSL, or the wheel's `lib/x64/cuda.lib` on Windows. TensorRT headers still come from the separately prepared SDK. The [SDK guide](https://github.com/sync-dev-org/tensoracle/blob/main/docs/tensorrt-sdk.md#5-pass-the-verified-root-to-the-build-and-tests) gives the setup commands. An explicit OS Toolkit root and the existing default locations remain supported for native builds.
319
321
 
320
322
  The wheel also contains `tensoracle/cpp/include`, `tensoracle/cpp/src`, and `tensoracle/cpp/cmake`. Pass the installed `tensoracle/cpp` directory to CMake as `TENSORACLE_CPP_ROOT` and include `TensoracleCubinPlugin.cmake`. Its `tensoracle_add_cubin_plugin` function compiles the common C++ source, the caller's plugin source, and the generated `bundle.cpp` into the caller's library. The caller implements the graph's meaning, field meanings, weight placement, launch sequence, and variant selection. The common source owns typed fields in their original order, handles `IPluginV3` lifecycle methods, checks cubin digests and resources, loads one module per CUDA context, checks the generated argument count and specialization rules, appends the two supported zero scratch pointers, and launches kernels. The caller selects a variant using `Kernel::accepts` and derives the count passed to `Kernel::launch` from its argument array. The common source releases modules and device allocations in their owning contexts. The library must export TensorRT's `getCreators`; a static registration constructor is not supported.
321
323
 
@@ -5,13 +5,14 @@ set(TENSORRT_ROOT "" CACHE PATH "TensorRT 11 SDK root containing include/NvInfer
5
5
  if(NOT EXISTS "${TENSORRT_ROOT}/include/NvInfer.h")
6
6
  message(FATAL_ERROR "TensorRT SDK headers are missing; set TENSORRT_ROOT to the TensorRT 11 SDK")
7
7
  endif()
8
- find_package(CUDAToolkit REQUIRED)
8
+ include(cmake/TensoracleCuda.cmake)
9
+ _tensoracle_find_cuda()
9
10
 
10
11
  add_library(tensoracle_cubin STATIC src/cubin_plugin.cpp)
11
12
  target_compile_features(tensoracle_cubin PUBLIC cxx_std_17)
12
13
  target_include_directories(tensoracle_cubin PUBLIC
13
14
  "${CMAKE_CURRENT_SOURCE_DIR}/include" "${TENSORRT_ROOT}/include")
14
- target_link_libraries(tensoracle_cubin PUBLIC CUDA::cuda_driver)
15
+ target_link_libraries(tensoracle_cubin PUBLIC tensoracle_internal_cuda_driver)
15
16
  target_compile_options(tensoracle_cubin PRIVATE
16
17
  $<$<CXX_COMPILER_ID:GNU,Clang>:-Wno-deprecated-declarations>)
17
18
 
@@ -1,4 +1,5 @@
1
1
  include_guard(GLOBAL)
2
+ include("${CMAKE_CURRENT_LIST_DIR}/TensoracleCuda.cmake")
2
3
 
3
4
  function(tensoracle_add_cubin_plugin)
4
5
  cmake_parse_arguments(ARG "" "TARGET;TENSORRT_ROOT;BUNDLE_ROOT" "SOURCES" ${ARGN})
@@ -7,7 +8,7 @@ function(tensoracle_add_cubin_plugin)
7
8
  endif()
8
9
 
9
10
  get_filename_component(_tensoracle_cpp "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/.." ABSOLUTE)
10
- find_package(CUDAToolkit REQUIRED)
11
+ _tensoracle_find_cuda()
11
12
  find_path(TENSORACLE_NVINFER_INCLUDE NvInfer.h
12
13
  PATHS "${ARG_TENSORRT_ROOT}/include" NO_DEFAULT_PATH REQUIRED)
13
14
  set(_tensoracle_nvinfer_names nvinfer)
@@ -26,8 +27,9 @@ function(tensoracle_add_cubin_plugin)
26
27
  target_compile_options(${ARG_TARGET} PRIVATE
27
28
  $<$<CXX_COMPILER_ID:GNU,Clang>:-Wno-deprecated-declarations>)
28
29
  target_include_directories(${ARG_TARGET} PRIVATE
29
- "${_tensoracle_cpp}/include" "${TENSORACLE_NVINFER_INCLUDE}" ${CUDAToolkit_INCLUDE_DIRS})
30
- target_link_libraries(${ARG_TARGET} PRIVATE "${TENSORACLE_NVINFER_LIBRARY}" CUDA::cuda_driver)
30
+ "${_tensoracle_cpp}/include" "${TENSORACLE_NVINFER_INCLUDE}")
31
+ target_link_libraries(${ARG_TARGET} PRIVATE
32
+ "${TENSORACLE_NVINFER_LIBRARY}" tensoracle_internal_cuda_driver)
31
33
  set_target_properties(${ARG_TARGET} PROPERTIES
32
34
  CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN YES)
33
35
  endfunction()
@@ -0,0 +1,95 @@
1
+ include_guard(GLOBAL)
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.
5
+ function(_tensoracle_find_cuda)
6
+ if(CUDAToolkit_ROOT)
7
+ set(_roots "${CUDAToolkit_ROOT}")
8
+ elseif(DEFINED ENV{CUDAToolkit_ROOT} AND NOT "$ENV{CUDAToolkit_ROOT}" STREQUAL "")
9
+ set(_roots "$ENV{CUDAToolkit_ROOT}")
10
+ else()
11
+ set(_roots "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}")
12
+ foreach(_compiler IN ITEMS "${CMAKE_CUDA_COMPILER}" "$ENV{CUDACXX}")
13
+ if(EXISTS "${_compiler}")
14
+ get_filename_component(_bin "${_compiler}" DIRECTORY)
15
+ get_filename_component(_root "${_bin}/.." ABSOLUTE)
16
+ list(APPEND _roots "${_root}")
17
+ endif()
18
+ endforeach()
19
+ find_program(_tensoracle_cuda_nvcc NAMES nvcc nvcc.exe)
20
+ if(_tensoracle_cuda_nvcc)
21
+ get_filename_component(_nvcc "${_tensoracle_cuda_nvcc}" REALPATH)
22
+ get_filename_component(_bin "${_nvcc}" DIRECTORY)
23
+ get_filename_component(_root "${_bin}/.." ABSOLUTE)
24
+ list(APPEND _roots "${_root}")
25
+ endif()
26
+ # Remove private find results before CMake writes its cache (CMake 3.20
27
+ # predates find_program/find_library's NO_CACHE option).
28
+ unset(_tensoracle_cuda_nvcc CACHE)
29
+ if(DEFINED ENV{CUDA_PATH})
30
+ list(APPEND _roots "$ENV{CUDA_PATH}")
31
+ endif()
32
+ if(WIN32)
33
+ file(GLOB _defaults "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v*")
34
+ else()
35
+ file(GLOB _defaults "/usr/local/cuda-*")
36
+ list(APPEND _roots "/usr/local/cuda")
37
+ endif()
38
+ list(SORT _defaults COMPARE NATURAL ORDER DESCENDING)
39
+ list(APPEND _roots ${_defaults})
40
+ endif()
41
+
42
+ set(_searched_includes)
43
+ set(_include)
44
+ foreach(_root IN LISTS _roots)
45
+ foreach(_candidate IN ITEMS "${_root}/include" "${_root}/targets/x86_64-linux/include")
46
+ list(APPEND _searched_includes "${_candidate}")
47
+ if(EXISTS "${_candidate}/cuda.h")
48
+ set(_include "${_candidate}")
49
+ set(_selected_root "${_root}")
50
+ break()
51
+ endif()
52
+ endforeach()
53
+ if(_include)
54
+ break()
55
+ endif()
56
+ endforeach()
57
+ set(_root "${_selected_root}")
58
+ if(NOT _include)
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.")
62
+ endif()
63
+
64
+ if(WIN32)
65
+ set(_driver_paths "${_root}/lib/x64")
66
+ find_library(_tensoracle_cuda_driver_library NAMES cuda
67
+ PATHS ${_driver_paths} NO_DEFAULT_PATH)
68
+ else()
69
+ set(_driver_paths "/usr/lib/wsl/lib" "${_root}/lib64" "${_root}/lib"
70
+ "${_root}/targets/x86_64-linux/lib")
71
+ find_library(_tensoracle_cuda_driver_library NAMES cuda HINTS ${_driver_paths})
72
+ 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")
75
+ find_library(_tensoracle_cuda_driver_library NAMES cuda
76
+ PATHS ${_driver_paths} NO_DEFAULT_PATH)
77
+ endif()
78
+ endif()
79
+ set(_driver "${_tensoracle_cuda_driver_library}")
80
+ unset(_tensoracle_cuda_driver_library CACHE)
81
+ if(NOT _driver)
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).")
86
+ endif()
87
+ message(STATUS "tensoracle CUDA headers: ${_include}")
88
+ message(STATUS "tensoracle CUDA driver: ${_driver}")
89
+ if(NOT TARGET tensoracle_internal_cuda_driver)
90
+ add_library(tensoracle_internal_cuda_driver UNKNOWN IMPORTED GLOBAL)
91
+ set_target_properties(tensoracle_internal_cuda_driver PROPERTIES
92
+ IMPORTED_LOCATION "${_driver}" INTERFACE_INCLUDE_DIRECTORIES "${_include}")
93
+ endif()
94
+ set(_tensoracle_cuda_root "${_root}" PARENT_SCOPE)
95
+ endfunction()
@@ -0,0 +1,11 @@
1
+ # Cubin producer API
2
+
3
+ The following names are available from `tensoracle.producer`. Install `tensoracle[producer]` for Triton 3.8.0 and the PyPI CUDA tools; no OS-installed CUDA Toolkit is required. The extra declares `nvidia-cuda-nvcc`, `nvidia-cuda-cuobjdump`, `nvidia-cuda-crt`, and `nvidia-nvvm` in the 13.2 series.
4
+
5
+ `compile_bundle` obtains `ptxas` from `nvidia-cuda-nvcc` at `nvidia/cu13/bin/ptxas` and `cuobjdump` from `nvidia-cuda-cuobjdump` at `nvidia/cu13/bin/cuobjdump` (with `.exe` on Windows). It ignores `CUDA_HOME`. Explicit `ptxas` and `cuobjdump` paths override the defaults independently. A missing wheel or executable reports the package and searched path and explains how to install `tensoracle[producer]` or pass an explicit path. The producer rejects ptxas versions outside `>=13.2,<14` before writing cubins or a manifest.
6
+
7
+ Cubin production does not need a GPU. Triton production runs on Linux; the resulting cubins can also be embedded in a Windows plugin DLL. Normal imports, engine building, and engine reuse do not import the producer or Triton.
8
+
9
+ ::: tensoracle.producer.KernelSpec
10
+
11
+ ::: tensoracle.producer.compile_bundle
@@ -18,7 +18,7 @@ Follow [Build a C++ and Python repository](cpp-python-repositories.md) for sourc
18
18
  | --- | --- | --- |
19
19
  | Inference application | Use `open_engine` to reopen a matching saved engine, then enqueue it with `handle.create_execution()`. | The application supplies buffers and streams, for example through CuPy or `cuda-python`. |
20
20
  | Standard graph developer | Define a TensorRT graph, build it with `build_serialized_engine` or `open_engine`, and measure outputs with `compare_outputs`. | None for standard TensorRT layers. |
21
- | Cubin plugin developer | Produce cubins, build a native TensorRT plugin, and package it with the model. | `tensoracle[producer]`, CUDA toolkit, TensorRT SDK, CMake 3.20 or later, and a C++17 compiler. |
21
+ | Cubin plugin developer | Produce cubins, build a native TensorRT plugin, and package it with the model. | `tensoracle[producer]`, PyPI CUDA headers, TensorRT SDK, CMake 3.20 or later, and a C++17 compiler. |
22
22
 
23
23
  | Requirement | Inference application | Standard graph developer | Cubin plugin developer |
24
24
  | --- | --- | --- | --- |
@@ -27,7 +27,7 @@ Follow [Build a C++ and Python repository](cpp-python-repositories.md) for sourc
27
27
  | NVIDIA GPU and driver | Open and run engines | Build and run engines | Run and test engines; cubin production itself can run without a GPU |
28
28
  | CuPy or `cuda-python` | The application chooses its buffer and stream library | The application chooses its buffer and stream library | `cuda-python` is used by the example runtime and tests, not by `tensoracle` |
29
29
  | Triton 3.8.0 | Not needed | Not needed | Installed with `tensoracle[producer]` for cubin production |
30
- | CUDA toolkit | Not needed | Not needed | Cubin production (`ptxas >=13.2,<14` and `cuobjdump`) and native plugin build |
30
+ | PyPI CUDA tools and headers | Not needed | Not needed | `tensoracle[producer]` supplies cubin tools; `nvidia-cuda-nvcc` and `nvidia-cuda-runtime` 13.2 supply the native build inputs |
31
31
  | TensorRT 11 SDK | Not needed | Not needed | Native plugin build |
32
32
  | CMake 3.20 or later and C++17 compiler | Not needed | Not needed | Native plugin build |
33
33
 
@@ -242,7 +242,9 @@ Install `tensoracle[producer]` when you need to compile cubins from your own ker
242
242
  pip install 'tensoracle[producer]'
243
243
  ```
244
244
 
245
- `tensoracle.producer.compile_bundle` uses the extra's Triton 3.8.0 with `ptxas >=13.2,<14` and `cuobjdump` from the host CUDA toolkit to produce cubins for sm86, sm89, and sm120. It uses the toolkit directory named by `CUDA_HOME`, or `/usr/local/cuda` when `CUDA_HOME` is unset, and accepts explicit paths as independent overrides. Cubin production does not need a GPU or import torch; run it without importing torch first. Build the native plugin with a TensorRT 11 SDK, CUDA toolkit, CMake, and a C++17 compiler. Inspect the resulting bundle or wheel with `tensoracle.bundle`. The [cubin plugin example](https://github.com/sync-dev-org/tensoracle/tree/main/examples/cubin_plugin) covers rebuilding from a repository clone, packaging, and runtime use. Normal import, engine building, and engine reuse do not import the producer or Triton, and do not need the producer extra or native build tools.
245
+ `tensoracle.producer.compile_bundle` uses Triton 3.8.0, `ptxas >=13.2,<14`, and `cuobjdump` from the extra's PyPI wheels to produce cubins for sm86, sm89, and sm120. The extra declares `nvidia-cuda-nvcc`, `nvidia-cuda-cuobjdump`, `nvidia-cuda-crt`, and `nvidia-nvvm` in the 13.2 series. The producer ignores `CUDA_HOME` and accepts explicit tool paths as independent overrides. A missing tool identifies the wheel and searched path and explains how to install the extra or pass a path. Cubin production does not need a GPU or import torch; run it without importing torch first.
246
+
247
+ Build the native plugin with a TensorRT 11 SDK, CMake, a C++17 compiler, and PyPI `nvidia-cuda-nvcc==13.2.*` and `nvidia-cuda-runtime==13.2.*`. Pass their `site-packages/nvidia/cu13` directory as `CUDAToolkit_ROOT`, through CMake or the environment. The helper uses the wheel's `cuda.h` and the NVIDIA driver's `libcuda.so` on Linux (including WSL), or the wheel's `lib/x64/cuda.lib` on Windows. Neither workflow needs an OS-installed CUDA Toolkit. TensorRT headers are supplied separately using [Prepare a TensorRT SDK](tensorrt-sdk.md), which also gives the PyPI CUDA setup commands. Inspect the resulting bundle or wheel with `tensoracle.bundle`. The [cubin plugin example](https://github.com/sync-dev-org/tensoracle/tree/main/examples/cubin_plugin) covers rebuilding from a repository clone, packaging, and runtime use. Normal import, engine building, and engine reuse do not import the producer or Triton, and do not need the producer extra or native build tools.
246
248
 
247
249
  Pass a `tensoracle::cubin::PluginIO` declaration as the fourth argument to `PluginBase(name, plugin_namespace, fields, io)`. The `inputs` vector determines the input count and declares each input's TensorRT `type` and `format` through `TensorSpec`; `output` declares the single output's type and format. `shape_input_index` selects the input whose shape the output copies. This example declares two fp16 / HWC8 inputs and an fp16 / HWC8 output with input 0's shape:
248
250
 
@@ -1,6 +1,6 @@
1
1
  # Prepare a TensorRT SDK
2
2
 
3
- Use the Linux procedure below to prepare the headers and `libnvinfer` needed to build a native cubin plugin on Linux x86_64, including WSL2. For Windows x86_64, use the [Windows procedure](#windows-x86_64). The Linux SDK root contains 13 headers in `include/`, `lib/libnvinfer.so.11`, and a relative `lib/libnvinfer.so` symlink pointing to `libnvinfer.so.11`. The CUDA toolkit, CMake, and a C++17 compiler are separate build prerequisites. Normal engine reuse does not need this SDK root.
3
+ Use the Linux procedure below to prepare the headers and `libnvinfer` needed to build a native cubin plugin on Linux x86_64, including WSL2. For Windows x86_64, use the [Windows procedure](#windows-x86_64). The Linux SDK root contains 13 headers in `include/`, `lib/libnvinfer.so.11`, and a relative `lib/libnvinfer.so` symlink pointing to `libnvinfer.so.11`. CMake, a C++17 compiler, and the CUDA headers from PyPI are separate build prerequisites; no OS-installed CUDA Toolkit is required. TensorRT headers are absent from the Python wheels and must be prepared separately. Normal engine reuse does not need this SDK root.
4
4
 
5
5
  The inputs below are fixed for SDK **11.2.1.2**: headers from a release commit of [NVIDIA TensorRT OSS](https://github.com/NVIDIA/TensorRT), and the exact `tensorrt-cu13-libs` wheel from [NVIDIA's package index](https://pypi.nvidia.com/tensorrt-cu13-libs/). The wheel platform is `manylinux_2_28_x86_64`; use that file rather than an aarch64 or Windows wheel.
6
6
 
@@ -98,14 +98,23 @@ The SONAME identifies only the major version. Matching `libnvinfer.so.11` does n
98
98
 
99
99
  ## 5. Pass the verified root to the build and tests
100
100
 
101
- Keep `TENSORRT_ROOT` set to the absolute path of the verified `sdk` directory. From the tensoracle repository root, build the example wheel and pass the same root to its tests:
101
+ Keep `TENSORRT_ROOT` set to the absolute path of the verified `sdk` directory. From the tensoracle repository root, install the producer extra into the development environment and locate its PyPI CUDA root. The lock selects `nvidia-cuda-nvcc` and `nvidia-cuda-runtime` 13.2.86. For a separate build environment, install `nvidia-cuda-nvcc==13.2.*` and `nvidia-cuda-runtime==13.2.*` with that environment's package manager and locate `nvidia/cu13` in the same way.
102
102
 
103
103
  ```bash
104
- CMAKE_ARGS="-DTENSORRT_ROOT=$TENSORRT_ROOT" uv build examples/cubin_plugin --wheel
105
- TENSORACLE_SDK_ROOT="$TENSORRT_ROOT" uv run --project python pytest -q python/tests/test_example_plugin.py
104
+ uv sync --project python --extra producer
105
+ export CUDAToolkit_ROOT="$(uv run --project python --extra producer python -c 'from importlib.metadata import distribution; print(distribution("nvidia-cuda-runtime").locate_file("nvidia/cu13"))')"
106
+ cmake -S cpp -B build/cpp -DCMAKE_BUILD_TYPE=Release \
107
+ "-DTENSORRT_ROOT=$TENSORRT_ROOT" "-DCUDAToolkit_ROOT=$CUDAToolkit_ROOT"
108
+ cmake --build build/cpp
109
+ ctest --test-dir build/cpp --output-on-failure
110
+ uv build examples/cubin_plugin --wheel \
111
+ "--config-setting=cmake.define.TENSORRT_ROOT=$TENSORRT_ROOT" \
112
+ "--config-setting=cmake.define.CUDAToolkit_ROOT=$CUDAToolkit_ROOT"
113
+ TENSORACLE_SDK_ROOT="$TENSORRT_ROOT" TENSORACLE_CUDA_ROOT="$CUDAToolkit_ROOT" \
114
+ uv run --project python --extra producer pytest -q python/tests/test_example_plugin.py
106
115
  ```
107
116
 
108
- The tests also need the CUDA toolkit; tests marked `gpu` require an NVIDIA GPU and driver. The SDK is a build input. The application still selects the TensorRT runtime and verifies its own plugin with that runtime.
117
+ The native helper reads `cuda.h` from this root and links the installed NVIDIA driver's `libcuda.so`; on WSL it searches `/usr/lib/wsl/lib`. It prints the selected headers and driver library during configuration. `CUDAToolkit_ROOT` can also be passed through the environment. Existing OS Toolkit roots and the default search through `nvcc` on `PATH` and `/usr/local/cuda` remain supported. Tests marked `gpu` require an NVIDIA GPU and driver. The SDK is a build input. The application still selects the TensorRT runtime and verifies its own plugin with that runtime.
109
118
 
110
119
  ## Use another TensorRT 11 release
111
120
 
@@ -115,7 +124,7 @@ Use the same acquisition and verification steps for another TensorRT 11 release,
115
124
 
116
125
  Use NVIDIA's official Windows ZIP to obtain both the headers and the MSVC import library. The TensorRT runtime wheel supplies DLLs, but it does not replace the SDK's `include/` directory and `lib/nvinfer_11.lib`. See NVIDIA's [Windows ZIP installation guide](https://docs.nvidia.com/deeplearning/tensorrt/latest/installing-tensorrt/install-zip.html) and [TensorRT 11 downloads](https://developer.nvidia.com/tensorrt/download/11x).
117
126
 
118
- The following inputs are fixed for **11.4.0.106**, Windows amd64, CUDA 13.4. Use Visual Studio 2022 with MSVC, CMake, Ninja, and a CUDA toolkit available in an **x64 Native Tools Command Prompt for VS 2022**, then start PowerShell from that prompt. The example below selects CUDA toolkit 12.8 as a build input; tensoracle's Python runtime dependencies select the CUDA 13 TensorRT runtime separately. Do not combine Windows import libraries with Linux shared libraries.
127
+ The following inputs are fixed for **11.4.0.106**, Windows amd64, CUDA 13.4. Use Visual Studio 2022 with MSVC, CMake, and Ninja available in an **x64 Native Tools Command Prompt for VS 2022**, then start PowerShell from that prompt. The CUDA build inputs below come from PyPI's 13.2 wheels; an OS-installed CUDA Toolkit is not needed. tensoracle's Python runtime dependencies select the CUDA 13 TensorRT runtime separately. Do not combine Windows import libraries with Linux shared libraries.
119
128
 
120
129
  Choose a new workspace. The command creating it must fail if the directory already exists. Download the fixed ZIP, record its digest, and extract it without installing software system-wide:
121
130
 
@@ -180,7 +189,14 @@ From the tensoracle repository root, configure and test the standalone C++ proje
180
189
 
181
190
  ```powershell
182
191
  $env:TENSORACLE_SDK_ROOT = $env:TENSORRT_ROOT
183
- $env:TENSORACLE_CUDA_ROOT = 'C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.8'
192
+ uv sync --project python
193
+ if ($LASTEXITCODE) { throw 'Development environment setup failed' }
194
+ uv pip install --python python/.venv/Scripts/python.exe `
195
+ 'nvidia-cuda-nvcc==13.2.*' 'nvidia-cuda-runtime==13.2.*'
196
+ if ($LASTEXITCODE) { throw 'PyPI CUDA installation failed' }
197
+ $env:CUDAToolkit_ROOT = (& python/.venv/Scripts/python.exe -c 'from importlib.metadata import distribution; print(distribution("nvidia-cuda-runtime").locate_file("nvidia/cu13"))')
198
+ if ($LASTEXITCODE) { throw 'PyPI CUDA root lookup failed' }
199
+ $env:TENSORACLE_CUDA_ROOT = $env:CUDAToolkit_ROOT
184
200
  cmake -S cpp -B build/windows -G Ninja -DCMAKE_BUILD_TYPE=Release `
185
201
  "-DTENSORRT_ROOT=$env:TENSORRT_ROOT" "-DCUDAToolkit_ROOT=$env:TENSORACLE_CUDA_ROOT"
186
202
  if ($LASTEXITCODE) { throw 'CMake configuration failed' }
@@ -196,4 +212,4 @@ uv run --project python pytest python/tests/test_example_plugin.py
196
212
  if ($LASTEXITCODE) { throw 'Example plugin tests failed' }
197
213
  ```
198
214
 
199
- The example build uses `cpp/cmake/TensoracleCubinPlugin.cmake`, which finds `nvinfer_11.lib` in the SDK's `lib/` directory. The built plugin is a DLL. Keep its TensorRT runtime available through the application's installed Python dependencies; the SDK directory is a build input and does not need to be added to the runtime `PATH`. For another TensorRT 11 release, establish new expected digests and check that release's exact header version before building.
215
+ The example build uses `cpp/cmake/TensoracleCubinPlugin.cmake`, which finds `nvinfer_11.lib` in the SDK's `lib/` directory, `cuda.h` in the PyPI root's `include/`, and the CUDA driver import library at `lib/x64/cuda.lib` in that root. The built plugin is a DLL. Keep its TensorRT runtime available through the application's installed Python dependencies; the SDK directory is a build input and does not need to be added to the runtime `PATH`. For another TensorRT 11 release, establish new expected digests and check that release's exact header version before building.
@@ -6,13 +6,13 @@ The first plugin computes an fp32 32 by 16 dot product and then scales it in a s
6
6
 
7
7
  ## Rebuild the cubins
8
8
 
9
- Provide a CUDA toolkit with `ptxas >=13.2,<14` and `cuobjdump`. Set `CUDA_HOME` to its directory; when unset, the producer uses `/usr/local/cuda`. From the tensoracle repository root, run:
9
+ The producer extra supplies Triton 3.8.0 and the PyPI CUDA tools, including `ptxas >=13.2,<14` and `cuobjdump`. No OS-installed CUDA Toolkit is required. From the tensoracle repository root, run:
10
10
 
11
11
  ```bash
12
12
  uv run --project python --extra producer python -c 'from pathlib import Path; from examples.cubin_plugin.kernels import kernel_specs; from tensoracle.producer import compile_bundle; compile_bundle(kernel_specs(), Path("examples/cubin_plugin/bundle"))'
13
13
  ```
14
14
 
15
- This installs Triton 3.8.0 with `tensoracle[producer]` and recreates `bundle/` with the host toolkit tools without using a GPU. Explicit `ptxas` and `cuobjdump` paths passed to `compile_bundle` override the toolkit defaults independently. The producer checks the cubin ELF SM, public and hidden argument layout, register count, and zero scratch sizes before writing the manifest. Run the tests below with the producer extra alone so torch is absent; `compile_bundle` rejects an already imported torch.
15
+ This installs Triton 3.8.0 and the 13.2 series of `nvidia-cuda-nvcc`, `nvidia-cuda-cuobjdump`, `nvidia-cuda-crt`, and `nvidia-nvvm` with `tensoracle[producer]`, then recreates `bundle/` without using a GPU. The tools come from `nvidia/cu13/bin/` in the installed wheels, and `CUDA_HOME` is ignored. Explicit `ptxas` and `cuobjdump` paths passed to `compile_bundle` override the wheel defaults independently. The producer checks the cubin ELF SM, public and hidden argument layout, register count, and zero scratch sizes before writing the manifest. Run the tests below with the producer extra alone so torch is absent; `compile_bundle` rejects an already imported torch.
16
16
 
17
17
  Check that the generated bundle has the expected files and passes inspection without using a GPU:
18
18
 
@@ -20,26 +20,31 @@ Check that the generated bundle has the expected files and passes inspection wit
20
20
  uv run --project python --extra producer pytest -m "not gpu" python/tests/test_producer.py
21
21
  ```
22
22
 
23
- Without Triton or the toolkit tools, the compilation tests skip with an explanation of what is missing.
23
+ Without Triton or the wheel tools, the compilation tests skip with an explanation of what is missing.
24
24
 
25
25
  ## Build and inspect the wheel
26
26
 
27
27
  Follow [Prepare a TensorRT SDK](../../docs/tensorrt-sdk.md) to obtain and verify the headers and library, then set `TENSORRT_ROOT` to that TensorRT 11 SDK containing `include/NvInfer.h` and a `lib` directory. The procedure supplies fixed inputs for SDK 11.2.1.2 and explains how to verify other TensorRT 11 releases. The example has been built against SDK 11.0.0.114, 11.1.0.106, 11.2.1.2, 11.3.0.99, and 11.4.0.106 and run on sm86, sm89, and sm120; see the [tested environments](../../README.md#tested-environments). `TENSORACLE_CPP_ROOT` may point to the `cpp` directory inside an installed tensoracle wheel; when building from this repository it defaults to `../../cpp`.
28
28
 
29
29
  ```bash
30
- CMAKE_ARGS="-DTENSORRT_ROOT=$TENSORRT_ROOT" uv build examples/cubin_plugin --wheel
30
+ uv sync --project python --extra producer
31
+ export CUDAToolkit_ROOT="$(uv run --project python --extra producer python -c 'from importlib.metadata import distribution; print(distribution("nvidia-cuda-runtime").locate_file("nvidia/cu13"))')"
32
+ uv build examples/cubin_plugin --wheel \
33
+ "--config-setting=cmake.define.TENSORRT_ROOT=$TENSORRT_ROOT" \
34
+ "--config-setting=cmake.define.CUDAToolkit_ROOT=$CUDAToolkit_ROOT"
31
35
  ```
32
36
 
33
- The example's build backend and CUDA tooling belong to this project, not to tensoracle's runtime dependencies. Before installation, inspect the wheel with `tensoracle.bundle.inspect_wheel(wheel, plugin="example_cubin_plugin/libtensoracle_example_plugin.so")`. For a wheel built on Windows, pass `plugin="example_cubin_plugin/tensoracle_example_plugin.dll"`. This compares the library's embedded digest and cubin bytes with the manifest and cubin files.
37
+ The native build uses the PyPI `nvidia-cuda-nvcc` and `nvidia-cuda-runtime` 13.2 root's `cuda.h` and the NVIDIA driver's `libcuda.so` on Linux, including WSL. Windows builds use the wheel's `lib/x64/cuda.lib`; follow the SDK guide's Windows commands to prepare that environment without the Linux-only Triton producer. Neither build needs an OS-installed CUDA Toolkit. The example's build backend and CUDA tooling belong to this project, not to tensoracle's runtime dependencies. Before installation, inspect the wheel with `tensoracle.bundle.inspect_wheel(wheel, plugin="example_cubin_plugin/libtensoracle_example_plugin.so")`. For a wheel built on Windows, pass `plugin="example_cubin_plugin/tensoracle_example_plugin.dll"`. This compares the library's embedded digest and cubin bytes with the manifest and cubin files.
34
38
 
35
39
  Install the tensoracle wheel and this example wheel into a runtime Python environment with TensorRT 11 and `cuda-python`, but without Triton, torch, or the TensorRT SDK. `open_engine` registers the library before calling `graph` or opening a saved engine. The tests use two separate processes and an `XDG_CACHE_HOME` directory to verify that the second process reuses the saved engine without building a graph.
36
40
 
37
41
  ## Test on each GPU generation
38
42
 
39
- Run from the tensoracle repository with the SDK and CUDA toolkit paths set. The GPU tests build the example wheel, install it in a temporary runtime environment, and run dynamic shapes, direct builds, saved engine reuse, simultaneous execution in two distinct CUDA contexts, and an fp32 versus TF32 control. Each GPU subprocess has a 50 second limit.
43
+ Run from the tensoracle repository with the SDK and PyPI CUDA root paths set. The GPU tests build the example wheel, install it in a temporary runtime environment, and run dynamic shapes, direct builds, saved engine reuse, simultaneous execution in two distinct CUDA contexts, and an fp32 versus TF32 control. Each GPU subprocess has a 50 second limit.
40
44
 
41
45
  ```bash
42
- TENSORACLE_SDK_ROOT="$TENSORRT_ROOT" uv run --project python pytest -q python/tests/test_example_plugin.py
46
+ TENSORACLE_SDK_ROOT="$TENSORRT_ROOT" TENSORACLE_CUDA_ROOT="$CUDAToolkit_ROOT" \
47
+ uv run --project python pytest -q python/tests/test_example_plugin.py
43
48
  ```
44
49
 
45
50
  Record the GPU name, SM, TensorRT runtime version, test result, and wheel digest on sm86, sm89, and sm120 separately. The code and wheel contain all three cubin generations; successful execution on one generation does not establish the other two.
@@ -31,7 +31,13 @@ issues = "https://github.com/sync-dev-org/tensoracle/issues"
31
31
 
32
32
  [project.optional-dependencies]
33
33
  convert = ["torch>=2.6"]
34
- producer = ["triton==3.8.0"]
34
+ producer = [
35
+ "triton==3.8.0",
36
+ "nvidia-cuda-nvcc==13.2.*",
37
+ "nvidia-cuda-cuobjdump==13.2.*",
38
+ "nvidia-cuda-crt==13.2.*",
39
+ "nvidia-nvvm==13.2.*",
40
+ ]
35
41
 
36
42
  [build-system]
37
43
  requires = ["hatchling", "hatch-vcs"]
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '1.2.0'
22
- __version_tuple__ = version_tuple = (1, 2, 0)
21
+ __version__ = version = '1.3.0'
22
+ __version_tuple__ = version_tuple = (1, 3, 0)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -1,6 +1,6 @@
1
1
  """Compile pinned Triton kernels into a portable cubin bundle.
2
2
 
3
- Install tensoracle[producer] to supply Triton and use a host CUDA toolkit for its tools.
3
+ Install tensoracle[producer] to supply Triton and the NVIDIA wheel tools.
4
4
  Importing tensoracle for inference never imports this module or Triton.
5
5
  """
6
6
 
@@ -10,6 +10,7 @@ import re
10
10
  import subprocess
11
11
  import sys
12
12
  from dataclasses import dataclass, field
13
+ from importlib.metadata import PackageNotFoundError, distribution
13
14
  from pathlib import Path
14
15
  from typing import Any
15
16
 
@@ -27,13 +28,16 @@ class KernelSpec:
27
28
  divisible_by: dict[str, int] = field(default_factory=dict)
28
29
 
29
30
 
30
- def _toolkit_tool(tool: str) -> Path:
31
- path = Path(os.environ.get("CUDA_HOME", "/usr/local/cuda")) / "bin" / tool
31
+ def _wheel_tool(package: str, tool: str) -> Path:
32
+ suffix = ".exe" if sys.platform == "win32" else ""
33
+ relative = f"nvidia/cu13/bin/{tool}{suffix}"
34
+ remedy = f"install it with pip install 'tensoracle[producer]' or pass {tool}=... explicitly"
35
+ try:
36
+ path = Path(distribution(package).locate_file(relative))
37
+ except PackageNotFoundError as exc:
38
+ raise ImportError(f"{tool} requires {package} at {relative}; {remedy}") from exc
32
39
  if not path.is_file():
33
- raise FileNotFoundError(
34
- f"{tool} was not found at {path}; set CUDA_HOME to a CUDA toolkit "
35
- f"or pass {tool}=... explicitly"
36
- )
40
+ raise FileNotFoundError(f"{tool} was not found in the {package} wheel at {path}; {remedy}")
37
41
  return path
38
42
 
39
43
 
@@ -98,8 +102,8 @@ def compile_bundle(
98
102
  ) -> dict:
99
103
  """Produce and inspect sm86, sm89, and sm120 cubins without importing torch.
100
104
 
101
- Omitted tool paths use the CUDA toolkit in CUDA_HOME, or /usr/local/cuda if unset.
102
- The toolkit must provide ptxas >=13.2,<14 and cuobjdump.
105
+ Omitted tool paths use the NVIDIA wheels installed by tensoracle[producer].
106
+ ptxas must be >=13.2,<14. CUDA_HOME is not used.
103
107
  Explicit ptxas and cuobjdump paths override those defaults independently.
104
108
  """
105
109
  if "torch" in sys.modules:
@@ -115,9 +119,9 @@ def compile_bundle(
115
119
  if triton.__version__ != "3.8.0":
116
120
  raise ValueError(f"Triton 3.8.0 is required, got {triton.__version__}")
117
121
  if ptxas is None:
118
- ptxas = _toolkit_tool("ptxas")
122
+ ptxas = _wheel_tool("nvidia-cuda-nvcc", "ptxas")
119
123
  if cuobjdump is None:
120
- cuobjdump = _toolkit_tool("cuobjdump")
124
+ cuobjdump = _wheel_tool("nvidia-cuda-cuobjdump", "cuobjdump")
121
125
  version = _ptxas_version(ptxas)
122
126
  if not (13, 2, 0) <= tuple(map(int, version.split("."))) < (14, 0, 0):
123
127
  raise ValueError(f"ptxas >=13.2,<14 is required, got {version}")
@@ -0,0 +1,17 @@
1
+ // Use half-precision PTX directly so the fixture needs no CCCL headers.
2
+ __device__ unsigned short half_add(unsigned short left, unsigned short right)
3
+ {
4
+ unsigned short result;
5
+ asm("add.rn.f16 %0, %1, %2;" : "=h"(result) : "h"(left), "h"(right));
6
+ return result;
7
+ }
8
+
9
+ // All tensors use the same packed HWC8 storage. Channels are padded by the caller.
10
+ extern "C" __global__ void half_io(unsigned short const* x, unsigned short const* residual,
11
+ unsigned short* output, int count, int mode)
12
+ {
13
+ int index = blockIdx.x * blockDim.x + threadIdx.x;
14
+ if (index >= count) return;
15
+ output[index] = mode == 0 ? half_add(x[index], x[index])
16
+ : mode == 1 ? half_add(x[index], residual[index]) : residual[index];
17
+ }
@@ -2,10 +2,15 @@ cmake_minimum_required(VERSION 3.20)
2
2
  project(tensoracle_test_fixtures LANGUAGES C CXX)
3
3
 
4
4
  if(TEST_CUBIN_SOURCE)
5
- find_package(CUDAToolkit REQUIRED)
5
+ include("${TENSORACLE_CPP_ROOT}/cmake/TensoracleCuda.cmake")
6
+ _tensoracle_find_cuda()
7
+ set(_nvcc "${_tensoracle_cuda_root}/bin/nvcc${CMAKE_EXECUTABLE_SUFFIX}")
8
+ if(NOT EXISTS "${_nvcc}")
9
+ message(FATAL_ERROR "nvcc is missing at ${_nvcc}; install PyPI nvidia-cuda-nvcc 13.2")
10
+ endif()
6
11
  set(_cubin "${CMAKE_CURRENT_BINARY_DIR}/kernel.cubin")
7
12
  add_custom_command(OUTPUT "${_cubin}"
8
- COMMAND "${CUDAToolkit_NVCC_EXECUTABLE}" --cubin "-arch=sm_${TEST_CUDA_ARCH}"
13
+ COMMAND "${_nvcc}" --cubin "-arch=sm_${TEST_CUDA_ARCH}"
9
14
  "${TEST_CUBIN_SOURCE}" -o "${_cubin}"
10
15
  DEPENDS "${TEST_CUBIN_SOURCE}"
11
16
  VERBATIM)
@@ -31,11 +36,12 @@ target_include_directories(${TEST_TARGET} PRIVATE
31
36
  "${CMAKE_CURRENT_SOURCE_DIR}" ${TEST_INCLUDE_DIRS})
32
37
 
33
38
  if(TENSORACLE_CPP_ROOT)
34
- find_package(CUDAToolkit REQUIRED)
39
+ include("${TENSORACLE_CPP_ROOT}/cmake/TensoracleCuda.cmake")
40
+ _tensoracle_find_cuda()
35
41
  target_sources(${TEST_TARGET} PRIVATE "${TENSORACLE_CPP_ROOT}/src/cubin_plugin.cpp")
36
42
  target_include_directories(${TEST_TARGET} PRIVATE
37
43
  "${TENSORACLE_CPP_ROOT}/include" "${TENSORRT_ROOT}/include")
38
- target_link_libraries(${TEST_TARGET} PRIVATE CUDA::cuda_driver)
44
+ target_link_libraries(${TEST_TARGET} PRIVATE tensoracle_internal_cuda_driver)
39
45
  target_compile_options(${TEST_TARGET} PRIVATE
40
46
  $<$<CXX_COMPILER_ID:GNU,Clang>:-Wno-deprecated-declarations>)
41
47
  endif()
@@ -1,6 +1,8 @@
1
1
  """Build native test fixtures using the host's CMake toolchain and artifact names."""
2
2
 
3
+ import os
3
4
  import subprocess
5
+ from importlib.metadata import PackageNotFoundError, distribution
4
6
  from pathlib import Path
5
7
 
6
8
  NATIVE = Path(__file__).resolve().parent / "native"
@@ -8,6 +10,16 @@ PROJECT = NATIVE.parents[1]
8
10
  ROOT = PROJECT.parent if PROJECT.name == "python" else PROJECT
9
11
 
10
12
 
13
+ def cuda_root():
14
+ """Use an explicit test root or the installed PyPI CUDA header directory."""
15
+ if root := os.environ.get("TENSORACLE_CUDA_ROOT"):
16
+ return Path(root)
17
+ try:
18
+ return Path(distribution("nvidia-cuda-runtime").locate_file("nvidia/cu13"))
19
+ except PackageNotFoundError:
20
+ return None
21
+
22
+
11
23
  def _build(work, definitions):
12
24
  build = work / "build"
13
25
  commands = [
@@ -61,6 +73,7 @@ def build_cubin(work, source, tools, sm):
61
73
  return _build(
62
74
  work,
63
75
  {
76
+ "TENSORACLE_CPP_ROOT": (ROOT / "cpp").as_posix(),
64
77
  "TEST_CUBIN_SOURCE": source.as_posix(),
65
78
  "TEST_CUDA_ARCH": sm,
66
79
  "CUDAToolkit_ROOT": cuda.as_posix(),