tensoracle 2.1.0__tar.gz → 2.1.1__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 (149) hide show
  1. {tensoracle-2.1.0 → tensoracle-2.1.1}/PKG-INFO +1 -1
  2. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/include/tensoracle/tensoracle.h +1 -1
  3. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/builder.cpp +12 -0
  4. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/builder.cpp +51 -0
  5. {tensoracle-2.1.0 → tensoracle-2.1.1}/src/tensoracle/_version.py +2 -2
  6. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/native_build.py +10 -0
  7. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_distribution.py +3 -3
  8. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_native.py +3 -1
  9. {tensoracle-2.1.0 → tensoracle-2.1.1}/.gitignore +0 -0
  10. {tensoracle-2.1.0 → tensoracle-2.1.1}/CMakeLists.txt +0 -0
  11. {tensoracle-2.1.0 → tensoracle-2.1.1}/LICENSE +0 -0
  12. {tensoracle-2.1.0 → tensoracle-2.1.1}/README.md +0 -0
  13. {tensoracle-2.1.0 → tensoracle-2.1.1}/bindings.cpp +0 -0
  14. {tensoracle-2.1.0 → tensoracle-2.1.1}/build_backend.py +0 -0
  15. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/CMakeLists.txt +0 -0
  16. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/cmake/TensoracleCubinPlugin.cmake +0 -0
  17. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/cmake/TensoracleCuda.cmake +0 -0
  18. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/cmake/TensoracleDependencies.cmake +0 -0
  19. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/cmake/TensoracleJson.cmake +0 -0
  20. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/cmake/tensoracleConfig.cmake.in +0 -0
  21. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/include/tensoracle/builder.h +0 -0
  22. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/include/tensoracle/builder.hpp +0 -0
  23. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/include/tensoracle/cache.h +0 -0
  24. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/include/tensoracle/cache.hpp +0 -0
  25. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/include/tensoracle/cubin.h +0 -0
  26. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/include/tensoracle/cubin.hpp +0 -0
  27. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/include/tensoracle/cubin_plugin.hpp +0 -0
  28. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/include/tensoracle/engine.h +0 -0
  29. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/include/tensoracle/engine.hpp +0 -0
  30. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/include/tensoracle/plugins.h +0 -0
  31. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/include/tensoracle/plugins.hpp +0 -0
  32. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/include/tensoracle/tensoracle.hpp +0 -0
  33. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/abi.cpp +0 -0
  34. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/builder_internal.hpp +0 -0
  35. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/bundle.cpp +0 -0
  36. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/bundle_internal.hpp +0 -0
  37. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/cache.cpp +0 -0
  38. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/cache.hpp +0 -0
  39. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/cache_management.cpp +0 -0
  40. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/cache_management_internal.cpp +0 -0
  41. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/cache_management_internal.hpp +0 -0
  42. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/cache_open.cpp +0 -0
  43. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/comparison.cpp +0 -0
  44. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/cubin_plugin.cpp +0 -0
  45. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/engine.cpp +0 -0
  46. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/engine_internal.hpp +0 -0
  47. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/error.cpp +0 -0
  48. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/error.hpp +0 -0
  49. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/native_exports.hpp +0 -0
  50. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/plugins.cpp +0 -0
  51. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/producer.cpp +0 -0
  52. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/safetensors.cpp +0 -0
  53. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/safetensors.hpp +0 -0
  54. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/sha256.hpp +0 -0
  55. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/structure.hpp +0 -0
  56. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/src/tensoracle.map +0 -0
  57. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/CMakeLists.txt +0 -0
  58. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/abi.cpp +0 -0
  59. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/builder_fixture.hpp +0 -0
  60. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/builder_probe.cpp +0 -0
  61. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/c_consumer.c +0 -0
  62. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/cache.cpp +0 -0
  63. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/cache_management.cpp +0 -0
  64. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/cache_probe.cpp +0 -0
  65. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/comparison.cpp +0 -0
  66. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/consumer/CMakeLists.txt +0 -0
  67. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/consumer/main.cpp +0 -0
  68. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/core.cpp +0 -0
  69. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/cubin.cpp +0 -0
  70. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/driver_failures.cpp +0 -0
  71. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/execution.cpp +0 -0
  72. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/installed.cmake +0 -0
  73. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/native_exports.cpp +0 -0
  74. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/native_exports_fixture.cpp +0 -0
  75. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/plugin_fixture.cpp +0 -0
  76. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/plugins.cpp +0 -0
  77. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/precision.cpp +0 -0
  78. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/utilities.cpp +0 -0
  79. {tensoracle-2.1.0 → tensoracle-2.1.1}/cpp/tests/weights.cpp +0 -0
  80. {tensoracle-2.1.0 → tensoracle-2.1.1}/cubin_bindings.cpp +0 -0
  81. {tensoracle-2.1.0 → tensoracle-2.1.1}/docs/api/bundle.md +0 -0
  82. {tensoracle-2.1.0 → tensoracle-2.1.1}/docs/api/index.md +0 -0
  83. {tensoracle-2.1.0 → tensoracle-2.1.1}/docs/api/producer.md +0 -0
  84. {tensoracle-2.1.0 → tensoracle-2.1.1}/docs/cpp-python-repositories.md +0 -0
  85. {tensoracle-2.1.0 → tensoracle-2.1.1}/docs/index.md +0 -0
  86. {tensoracle-2.1.0 → tensoracle-2.1.1}/docs/migration.md +0 -0
  87. {tensoracle-2.1.0 → tensoracle-2.1.1}/docs/optimization.md +0 -0
  88. {tensoracle-2.1.0 → tensoracle-2.1.1}/docs/precision.md +0 -0
  89. {tensoracle-2.1.0 → tensoracle-2.1.1}/docs/tensorrt-sdk.md +0 -0
  90. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/CMakeLists.txt +0 -0
  91. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/README.md +0 -0
  92. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bindings.cpp +0 -0
  93. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/bundle.cpp +0 -0
  94. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/bundle.json +0 -0
  95. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm120/bias.cubin +0 -0
  96. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm120/dot.specialized.cubin +0 -0
  97. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm120/dot.tf32-control.cubin +0 -0
  98. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm120/dot.unspecialized.cubin +0 -0
  99. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm120/scale.cubin +0 -0
  100. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm86/bias.cubin +0 -0
  101. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm86/dot.specialized.cubin +0 -0
  102. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm86/dot.tf32-control.cubin +0 -0
  103. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm86/dot.unspecialized.cubin +0 -0
  104. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm86/scale.cubin +0 -0
  105. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm89/bias.cubin +0 -0
  106. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm89/dot.specialized.cubin +0 -0
  107. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm89/dot.tf32-control.cubin +0 -0
  108. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm89/dot.unspecialized.cubin +0 -0
  109. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/bundle/cubins/sm89/scale.cubin +0 -0
  110. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/example_cubin_plugin/__init__.py +0 -0
  111. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/example_cubin_plugin/weights.safetensors +0 -0
  112. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/kernels.cu +0 -0
  113. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/kernels.py +0 -0
  114. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/plugin.cpp +0 -0
  115. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/cubin_plugin/pyproject.toml +0 -0
  116. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/wheel_consumer/CMakeLists.txt +0 -0
  117. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/wheel_consumer/README.md +0 -0
  118. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/wheel_consumer/bindings.cpp +0 -0
  119. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/wheel_consumer/pyproject.toml +0 -0
  120. {tensoracle-2.1.0 → tensoracle-2.1.1}/examples/wheel_consumer/src/tensoracle_consumer/__init__.py +0 -0
  121. {tensoracle-2.1.0 → tensoracle-2.1.1}/mkdocs.yml +0 -0
  122. {tensoracle-2.1.0 → tensoracle-2.1.1}/pyproject.toml +0 -0
  123. {tensoracle-2.1.0 → tensoracle-2.1.1}/src/tensoracle/__init__.py +0 -0
  124. {tensoracle-2.1.0 → tensoracle-2.1.1}/src/tensoracle/_cli.py +0 -0
  125. {tensoracle-2.1.0 → tensoracle-2.1.1}/src/tensoracle/_comparison.py +0 -0
  126. {tensoracle-2.1.0 → tensoracle-2.1.1}/src/tensoracle/bundle.py +0 -0
  127. {tensoracle-2.1.0 → tensoracle-2.1.1}/src/tensoracle/convert.py +0 -0
  128. {tensoracle-2.1.0 → tensoracle-2.1.1}/src/tensoracle/producer.py +0 -0
  129. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/cubin_io/check.cpp +0 -0
  130. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/cubins/ptxas-12.9.86/sm120.cubin +0 -0
  131. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/cubins/ptxas-12.9.86/sm86.cubin +0 -0
  132. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/cubins/ptxas-12.9.86/sm89.cubin +0 -0
  133. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/native/CMakeLists.txt +0 -0
  134. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/native/cache/CMakeLists.txt +0 -0
  135. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/native/cache/writer.cpp +0 -0
  136. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/native/export.h +0 -0
  137. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_bundle.py +0 -0
  138. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_cache_cli.py +0 -0
  139. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_cmake_cuda.py +0 -0
  140. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_cmake_plugin.py +0 -0
  141. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_comparison.py +0 -0
  142. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_comparison_binding.py +0 -0
  143. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_convert.py +0 -0
  144. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_cpp_core.py +0 -0
  145. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_example_plugin.py +0 -0
  146. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_plugin_io.py +0 -0
  147. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_producer.py +0 -0
  148. {tensoracle-2.1.0 → tensoracle-2.1.1}/tests/test_public_api.py +0 -0
  149. {tensoracle-2.1.0 → tensoracle-2.1.1}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tensoracle
3
- Version: 2.1.0
3
+ Version: 2.1.1
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
@@ -6,7 +6,7 @@
6
6
 
7
7
  #define TENSORACLE_VERSION_MAJOR 2
8
8
  #define TENSORACLE_VERSION_MINOR 1
9
- #define TENSORACLE_VERSION_PATCH 0
9
+ #define TENSORACLE_VERSION_PATCH 1
10
10
 
11
11
  #if defined(_WIN32)
12
12
  # if defined(TENSORACLE_BUILDING_LIBRARY)
@@ -75,6 +75,8 @@ cache_request request_from(const tensoracle_builder_options* options) {
75
75
  built_plan build_plan(const cache_request& request, const tensoracle_network_builder& callback) {
76
76
  auto weights = load_safetensors(request.weights);
77
77
  auto& logger = process_engine_logger();
78
+ // TensorRT requires the timing cache to outlive the builder using it.
79
+ std::unique_ptr<nvinfer1::ITimingCache> timing;
78
80
  std::unique_ptr<nvinfer1::IBuilder> builder(nvinfer1::createInferBuilder(logger));
79
81
  if (!builder) throw std::runtime_error("TensorRT failed to create a builder");
80
82
  std::unique_ptr<nvinfer1::INetworkDefinition> network(builder->createNetworkV2(0));
@@ -113,6 +115,16 @@ built_plan build_plan(const cache_request& request, const tensoracle_network_bui
113
115
  }
114
116
  }
115
117
  if (profile) require(profile->isValid() && config->addOptimizationProfile(profile) >= 0, "TensorRT rejected the optimization profile");
118
+ timing.reset(config->createTimingCache(nullptr, 0));
119
+ if (!timing) throw std::runtime_error("TensorRT failed to create a timing cache");
120
+ if (!config->setTimingCache(*timing, false)) throw std::runtime_error("TensorRT rejected the timing cache");
121
+ // A cold TensorRT build can serialize large zero-filled buffers. Rebuild
122
+ // with the populated in-memory cache before persisting the plan, releasing
123
+ // the first plan to avoid retaining both serialized engines at once.
124
+ {
125
+ std::unique_ptr<nvinfer1::IHostMemory> warmup(builder->buildSerializedNetwork(*network, *config));
126
+ if (!warmup) throw std::runtime_error("TensorRT failed to build the serialized engine");
127
+ }
116
128
  std::unique_ptr<nvinfer1::IHostMemory> plan(builder->buildSerializedNetwork(*network, *config));
117
129
  if (!plan) throw std::runtime_error("TensorRT failed to build the serialized engine");
118
130
  auto* first = static_cast<const uint8_t*>(plan->data());
@@ -2,6 +2,7 @@
2
2
  #include "builder_internal.hpp"
3
3
  #include <tensoracle/cache.hpp>
4
4
  #include <catch2/catch_test_macros.hpp>
5
+ #include <chrono>
5
6
  #include <cstdio>
6
7
  #include <sys/wait.h>
7
8
  #include <unistd.h>
@@ -10,6 +11,56 @@
10
11
  #endif
11
12
 
12
13
  using namespace builder_fixture;
14
+ TEST_CASE("Saved LeakyReLU engines stay small and reuse correct half precision outputs", "[SP-TENSORACLE-009][gpu]") {
15
+ context gpu; temporary_directory files; auto path = files.path / "weights"; write_weights(path);
16
+ auto request = options(path); request.name = "leaky-relu";
17
+ request.workspace_limit = 4ULL * 1024 * 1024 * 1024; request.optimization_level = 3;
18
+ const std::vector<int64_t> dimensions{1, 64, 135, 240};
19
+ request.inputs = {{"features", dimensions, dimensions, dimensions}};
20
+ request.io = {{"features", TENSORACLE_FLOAT16, dimensions, true}, {"result", TENSORACLE_FLOAT16, dimensions, false}};
21
+ int calls = 0;
22
+ auto define = [&](nvinfer1::INetworkDefinition& network, const tensoracle::weights_view&) {
23
+ ++calls;
24
+ auto* input = network.addInput("features", nvinfer1::DataType::kHALF, nvinfer1::Dims4(1, 64, 135, 240));
25
+ REQUIRE(input);
26
+ auto* activation = network.addActivation(*input, nvinfer1::ActivationType::kLEAKY_RELU);
27
+ REQUIRE(activation); activation->setAlpha(0.1f);
28
+ auto* result = activation->getOutput(0); REQUIRE(result);
29
+ result->setName("result"); network.markOutput(*result);
30
+ };
31
+ auto started = std::chrono::steady_clock::now();
32
+ auto engine = tensoracle::open_engine(request, define);
33
+ auto elapsed = std::chrono::duration<double>(std::chrono::steady_clock::now() - started).count();
34
+ auto bytes = fs::file_size(engine.path());
35
+ std::printf("LeakyReLU saved bytes=%llu build seconds=%.6f\n", (unsigned long long)bytes, elapsed);
36
+ // Without a warm timing cache, TensorRT 11.4 serializes about 29 MB for this one layer.
37
+ CHECK(bytes < 1024 * 1024);
38
+ REQUIRE(calls == 1);
39
+
40
+ // IEEE binary16 values: [-10, -5, -2.5, -1.25, 0, 1, 2, 4].
41
+ const uint16_t input_pattern[]{0xc900, 0xc500, 0xc100, 0xbd00, 0, 0x3c00, 0x4000, 0x4400};
42
+ // LeakyReLU(x, 0.1): [-1, -0.5, -0.25, -0.125, 0, 1, 2, 4].
43
+ const uint16_t output_pattern[]{0xbc00, 0xb800, 0xb400, 0xb000, 0, 0x3c00, 0x4000, 0x4400};
44
+ const size_t count = 64 * 135 * 240;
45
+ std::vector<uint16_t> values(count), expected(count), actual(count);
46
+ for (size_t i = 0; i < count; ++i) {
47
+ values[i] = input_pattern[i % 8]; expected[i] = output_pattern[i % 8];
48
+ }
49
+ device_buffer source(count * sizeof(uint16_t)), target(count * sizeof(uint16_t)); stream queue;
50
+ cuda_check(cuMemcpyHtoD(source.value, values.data(), count * sizeof(uint16_t)));
51
+ auto run_activation = [&](const tensoracle::engine_handle& saved) {
52
+ auto execution = saved.create_execution();
53
+ execution.enqueue({{"features", reinterpret_cast<void*>(source.value)}, {"result", reinterpret_cast<void*>(target.value)}}, queue.value);
54
+ cuda_check(cuStreamSynchronize(queue.value));
55
+ cuda_check(cuMemcpyDtoH(actual.data(), target.value, count * sizeof(uint16_t)));
56
+ REQUIRE(std::equal(actual.begin(), actual.end(), expected.begin()));
57
+ };
58
+ run_activation(engine);
59
+ auto reopened = tensoracle::open_engine(request, define);
60
+ REQUIRE(calls == 1); REQUIRE(reopened.path() == engine.path());
61
+ run_activation(reopened);
62
+ }
63
+
13
64
  TEST_CASE("Public builder retains weights through serialization and reuses ranged named engines", "[SP-TENSORACLE-007][SP-TENSORACLE-008][SP-TENSORACLE-009][SP-TENSORACLE-052][SP-TENSORACLE-059][gpu]") {
14
65
  context gpu; temporary_directory files; auto path = files.path / "linear.safetensors"; write_weights(path);
15
66
  auto request = options(path, "fp32", true); int calls = 0;
@@ -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 = '2.1.0'
22
- __version_tuple__ = version_tuple = (2, 1, 0)
21
+ __version__ = version = '2.1.1'
22
+ __version_tuple__ = version_tuple = (2, 1, 1)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -1,6 +1,7 @@
1
1
  """Build native test fixtures using the host's CMake toolchain and artifact names."""
2
2
 
3
3
  import os
4
+ import re
4
5
  import subprocess
5
6
  from importlib.metadata import PackageNotFoundError, distribution
6
7
  from pathlib import Path
@@ -10,6 +11,15 @@ PROJECT = NATIVE.parents[1]
10
11
  ROOT = PROJECT.parent if PROJECT.name == "python" else PROJECT
11
12
 
12
13
 
14
+ def sdk_version():
15
+ """Read the expected library version from the public SDK header."""
16
+ header = (ROOT / "cpp/include/tensoracle/tensoracle.h").read_text(encoding="utf-8")
17
+ return tuple(
18
+ int(re.search(rf"^#define TENSORACLE_VERSION_{part} (\d+)$", header, re.MULTILINE)[1])
19
+ for part in ("MAJOR", "MINOR", "PATCH")
20
+ )
21
+
22
+
13
23
  def cuda_root():
14
24
  """Use an explicit test root or the installed PyPI CUDA header directory."""
15
25
  if root := os.environ.get("TENSORACLE_CUDA_ROOT"):
@@ -23,7 +23,7 @@ import yaml
23
23
  from packaging.requirements import Requirement
24
24
  from safetensors.numpy import save_file
25
25
 
26
- from native_build import cuda_root
26
+ from native_build import cuda_root, sdk_version
27
27
 
28
28
  PROJECT = Path(__file__).resolve().parents[1]
29
29
  ROOT = PROJECT.parent if PROJECT.name == "python" else PROJECT
@@ -306,7 +306,7 @@ def test_installed_wheel_serves_python_and_cpp_without_the_source_tree(distribut
306
306
  "-c",
307
307
  (
308
308
  "from tensoracle import _native; import sysconfig; "
309
- "assert _native.version() == (2, 0, 0); "
309
+ f"assert _native.version() == {sdk_version()!r}; "
310
310
  "assert _native.tensorrt_version()[0] == 11; "
311
311
  "print(sysconfig.get_path('platlib'))"
312
312
  ),
@@ -468,7 +468,7 @@ print(json.dumps({'version': _native.version(), 'module': _native.__file__,
468
468
  'site': str(site), 'libraries': sorted(libraries), 'path': sys.path}))
469
469
  """,
470
470
  )
471
- assert installed["version"] == [2, 0, 0]
471
+ assert installed["version"] == list(sdk_version())
472
472
  site = Path(installed["site"])
473
473
  assert Path(installed["module"]).parent == site / "tensoracle_consumer"
474
474
  assert len(installed["libraries"]) == 1
@@ -5,6 +5,8 @@ from importlib.metadata import distribution
5
5
 
6
6
  import pytest
7
7
 
8
+ from native_build import sdk_version
9
+
8
10
 
9
11
  @pytest.mark.req("SP-TENSORACLE-053")
10
12
  @pytest.mark.req("SP-TENSORACLE-056")
@@ -12,7 +14,7 @@ def test_native_versions_are_available_without_initializing_cuda():
12
14
  """The binding reports tensoracle and TensorRT versions as three integers."""
13
15
  from tensoracle import _native
14
16
 
15
- assert _native.version() == (2, 0, 0)
17
+ assert _native.version() == sdk_version()
16
18
  tensorrt = _native.tensorrt_version()
17
19
  assert len(tensorrt) == 3
18
20
  assert all(isinstance(value, int) for value in tensorrt)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes