tensorrt-cu12-bindings 10.7.0.post1__cp39-none-win_amd64.whl → 10.9.0.34__cp39-none-win_amd64.whl
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.
Potentially problematic release.
This version of tensorrt-cu12-bindings might be problematic. Click here for more details.
- tensorrt_bindings/__init__.py +17 -8
- tensorrt_bindings/plugin/__init__.py +1 -1
- tensorrt_bindings/plugin/_export.py +4 -1
- tensorrt_bindings/plugin/_lib.py +199 -31
- tensorrt_bindings/plugin/_plugin_class.py +178 -40
- tensorrt_bindings/plugin/_tensor.py +375 -72
- tensorrt_bindings/plugin/_validate.py +122 -4
- tensorrt_bindings/tensorrt.cp39-win_amd64.pyd +0 -0
- {tensorrt_cu12_bindings-10.7.0.post1.dist-info → tensorrt_cu12_bindings-10.9.0.34.dist-info}/METADATA +1 -1
- tensorrt_cu12_bindings-10.9.0.34.dist-info/RECORD +17 -0
- tensorrt_cu12_bindings-10.7.0.post1.dist-info/RECORD +0 -17
- {tensorrt_cu12_bindings-10.7.0.post1.dist-info → tensorrt_cu12_bindings-10.9.0.34.dist-info}/LICENSE.txt +0 -0
- {tensorrt_cu12_bindings-10.7.0.post1.dist-info → tensorrt_cu12_bindings-10.9.0.34.dist-info}/WHEEL +0 -0
- {tensorrt_cu12_bindings-10.7.0.post1.dist-info → tensorrt_cu12_bindings-10.9.0.34.dist-info}/top_level.txt +0 -0
- {tensorrt_cu12_bindings-10.7.0.post1.dist-info → tensorrt_cu12_bindings-10.9.0.34.dist-info}/zip-safe +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -18,9 +18,13 @@
|
|
|
18
18
|
import inspect
|
|
19
19
|
import numpy as np
|
|
20
20
|
import typing
|
|
21
|
+
import types
|
|
21
22
|
|
|
22
23
|
from ._utils import _is_numpy_array, _join_with, _infer_numpy_type, _is_npt_ndarray
|
|
23
|
-
from ._tensor import TensorDesc, Tensor
|
|
24
|
+
from ._tensor import TensorDesc, Tensor, SymExprs
|
|
25
|
+
from ._export import IS_AOT_ENABLED
|
|
26
|
+
if IS_AOT_ENABLED:
|
|
27
|
+
from ._tensor import KernelLaunchParams
|
|
24
28
|
from ._autotune import AutoTuneCombination
|
|
25
29
|
|
|
26
30
|
SERIALIZABLE_BUILTIN_TYPES = (int, float, bytes, bool, str)
|
|
@@ -93,7 +97,7 @@ def _parse_register_inputs(register_func, lazy_register):
|
|
|
93
97
|
raise ValueError(
|
|
94
98
|
f"Argument {name} is not a positional-or-keyword or keyword-only arg"
|
|
95
99
|
)
|
|
96
|
-
|
|
100
|
+
|
|
97
101
|
# Type annotations are manadatory for `tensorrt.plugin.register` args
|
|
98
102
|
if param.annotation == inspect.Parameter.empty:
|
|
99
103
|
raise ValueError(
|
|
@@ -105,7 +109,7 @@ def _parse_register_inputs(register_func, lazy_register):
|
|
|
105
109
|
raise ValueError(
|
|
106
110
|
f"Argument {name} has a default value. Default values are not supported yet."
|
|
107
111
|
)
|
|
108
|
-
|
|
112
|
+
|
|
109
113
|
|
|
110
114
|
if issubclass(param.annotation, TensorDesc):
|
|
111
115
|
if saw_first_attr:
|
|
@@ -275,6 +279,120 @@ def _validate_impl(impl_func, plugin_def):
|
|
|
275
279
|
|
|
276
280
|
return impl_attr_names, found_tactic
|
|
277
281
|
|
|
282
|
+
def _validate_aot_impl(aot_impl_func, plugin_def):
|
|
283
|
+
aot_impl_attr_names = []
|
|
284
|
+
|
|
285
|
+
sig = inspect.signature(aot_impl_func)
|
|
286
|
+
registered_attr_names = plugin_def.input_attrs.keys()
|
|
287
|
+
|
|
288
|
+
# input arg annotations are optional, but we will validate if provided
|
|
289
|
+
for name, param in sig.parameters.items():
|
|
290
|
+
if param.annotation != inspect.Parameter.empty:
|
|
291
|
+
if name == "outputs":
|
|
292
|
+
if typing.get_origin(param.annotation) is not tuple:
|
|
293
|
+
raise ValueError(
|
|
294
|
+
f"'outputs' should be of type Tuple[TensorDesc]. Received {param.annotation}."
|
|
295
|
+
)
|
|
296
|
+
args = typing.get_args(param.annotation)
|
|
297
|
+
for arg in args:
|
|
298
|
+
if not issubclass(arg, TensorDesc):
|
|
299
|
+
raise ValueError(
|
|
300
|
+
f"Argument for receiving output TensorDesc, '{name}' contains a {param.annotation}. '{name}' should be a Tuple[TensorDesc]."
|
|
301
|
+
)
|
|
302
|
+
elif name == "tactic":
|
|
303
|
+
if not issubclass(param.annotation, int):
|
|
304
|
+
raise ValueError("'tactic' input argument should be an int")
|
|
305
|
+
elif issubclass(param.annotation, TensorDesc):
|
|
306
|
+
if name not in plugin_def.input_tensor_names:
|
|
307
|
+
raise ValueError(
|
|
308
|
+
f"Unexpected tensor '{name}' specified in autotune function. Expected one of {plugin_def.input_tensor_names}."
|
|
309
|
+
)
|
|
310
|
+
else:
|
|
311
|
+
if name not in plugin_def.input_attrs:
|
|
312
|
+
raise ValueError(
|
|
313
|
+
f"Unexpected attribute '{name}' specified in aot_impl function. Expected one of {list(registered_attr_names)}."
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
if param.annotation != plugin_def.input_attrs[name]:
|
|
317
|
+
raise ValueError(
|
|
318
|
+
f"Attribute '{name}' has a type annotation different from the one specified at registration. Expected '{plugin_def.input_attrs[name]}'."
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
aot_impl_attr_names.append(name)
|
|
322
|
+
else:
|
|
323
|
+
if name in plugin_def.input_attrs:
|
|
324
|
+
aot_impl_attr_names.append(name)
|
|
325
|
+
|
|
326
|
+
# Expected attribute schema should be constructed in the order they appeared in the register function
|
|
327
|
+
expected_attr_schema_chunks = [
|
|
328
|
+
n for n in registered_attr_names if n in aot_impl_attr_names
|
|
329
|
+
]
|
|
330
|
+
|
|
331
|
+
expected_schema = (
|
|
332
|
+
"("
|
|
333
|
+
+ _join_with(plugin_def.input_tensor_names)
|
|
334
|
+
+ _join_with(expected_attr_schema_chunks, True)
|
|
335
|
+
+ ", outputs, tactic)"
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
if f"({', '.join(sig.parameters.keys())})" != expected_schema:
|
|
339
|
+
raise ValueError(
|
|
340
|
+
f"Signature of the aot_impl function '{sig}' does not match the expected input arg schema: {expected_schema}"
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
ret_annotation = sig.return_annotation
|
|
344
|
+
|
|
345
|
+
if ret_annotation == inspect.Parameter.empty:
|
|
346
|
+
raise ValueError(
|
|
347
|
+
f"No return annotation found for aot_impl function. Received signature {sig}."
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
expected_return_schema = "tuple[str | bytes, str | bytes, tensorrt.plugin.KernelLaunchParams, tensorrt.plugin.SymIntExprs]"
|
|
351
|
+
|
|
352
|
+
# Return annotation is optional, but we will validate if one is specified
|
|
353
|
+
if ret_annotation != inspect.Parameter.empty:
|
|
354
|
+
if typing.get_origin(ret_annotation) is not tuple:
|
|
355
|
+
raise ValueError(
|
|
356
|
+
f"Return annotation is {ret_annotation}. Expected {expected_return_schema}."
|
|
357
|
+
)
|
|
358
|
+
else:
|
|
359
|
+
args = typing.get_args(ret_annotation)
|
|
360
|
+
|
|
361
|
+
if len(args) != 4:
|
|
362
|
+
raise ValueError(
|
|
363
|
+
f"Return annotation is {ret_annotation}. Expected {expected_return_schema}."
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
def validate_union_str_or_bytes(index):
|
|
367
|
+
def validate_str_or_bytes(arg_):
|
|
368
|
+
if (arg_ is not str) and (arg_ is not bytes):
|
|
369
|
+
raise ValueError(
|
|
370
|
+
f"Return annotation for argument at {index} is '{arg_}'. Expected 'str' or 'bytes'."
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
orig = typing.get_origin(args[index])
|
|
374
|
+
# orig is `typing.Union` when annotation uses typing module (e.g, Union[str, bytes])
|
|
375
|
+
# orig is `types.UnionType` when annotation is of the new (3.10+) native syntax (e.g, str | bytes)
|
|
376
|
+
if orig is typing.Union or orig is types.UnionType:
|
|
377
|
+
for a in typing.get_args(args[index]):
|
|
378
|
+
validate_str_or_bytes(a)
|
|
379
|
+
else:
|
|
380
|
+
# when annoted with `str` or `bytes`
|
|
381
|
+
validate_str_or_bytes(args[index])
|
|
382
|
+
|
|
383
|
+
# kernel name should be str or bytes encoding
|
|
384
|
+
validate_union_str_or_bytes(0)
|
|
385
|
+
# kernel PTX should be str or bytes encoding
|
|
386
|
+
validate_union_str_or_bytes(1)
|
|
387
|
+
|
|
388
|
+
if not issubclass(args[2], KernelLaunchParams):
|
|
389
|
+
raise ValueError(f"Argument at index 2 of return annotation is '{args[2]}'. Expected 'tensorrt.plugin.KernelLaunchParams'.")
|
|
390
|
+
|
|
391
|
+
if not issubclass(args[3], SymExprs):
|
|
392
|
+
raise ValueError(f"Argument at index 3 of return annotation is '{args[3]}'. Expected a descendent of tensorrt.plugin.SymExprs.")
|
|
393
|
+
|
|
394
|
+
return aot_impl_attr_names
|
|
395
|
+
|
|
278
396
|
|
|
279
397
|
def _validate_autotune(autotune_func, plugin_def):
|
|
280
398
|
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
tensorrt_bindings/__init__.py,sha256=tJOZ12p3C5j9I_6yNR6oADn-ZHT3_AE4l8siETRsBzo,6366
|
|
2
|
+
tensorrt_bindings/tensorrt.cp39-win_amd64.pyd,sha256=VuIWSpoIqn3OnVs5g1mSUQKkdcE6Mwc3wKU1TI2gvWo,1964032
|
|
3
|
+
tensorrt_bindings/plugin/__init__.py,sha256=C_9idhCxsIHfoBxidwwr6FHlkZVy5kjh-VnzTsGszcQ,1557
|
|
4
|
+
tensorrt_bindings/plugin/_autotune.py,sha256=xlNut0qB9rlgyhfV4QyVJEsT50r3PuFz1xk0pnDiVA8,12493
|
|
5
|
+
tensorrt_bindings/plugin/_export.py,sha256=CnjosYyQu5Ay3dYmddN6QxYLq-YUPgPDpcMXmcycfZM,1281
|
|
6
|
+
tensorrt_bindings/plugin/_lib.py,sha256=EiOrumU6o0gBcAhGELz-eVcKa3r-yEI12XsSxky1NDA,29344
|
|
7
|
+
tensorrt_bindings/plugin/_plugin_class.py,sha256=935UKagUcj9as-U2g434gAnaQt5IkA-L969vYRbc_A4,17907
|
|
8
|
+
tensorrt_bindings/plugin/_tensor.py,sha256=fhZqxhFQMw-r9Ae8w9yrVa_qNO7HtIj_ZUEHimounp4,38637
|
|
9
|
+
tensorrt_bindings/plugin/_top_level.py,sha256=mxZk0M-v8aP1uMVziX6FDBxFQPq3Cp6gd0Iq09xRUro,4708
|
|
10
|
+
tensorrt_bindings/plugin/_utils.py,sha256=Hl2PslERH5X0UMArk_k8GKag7ME0pW0RjQcTX3zYsoc,2741
|
|
11
|
+
tensorrt_bindings/plugin/_validate.py,sha256=6BzbAu9cF8TDibfQQ_GbPEG0qs24_6TnSLLnkJ-OuIA,20017
|
|
12
|
+
tensorrt_cu12_bindings-10.9.0.34.dist-info/LICENSE.txt,sha256=yGkV_ZW7773aMTWqzj5q1rRhKEbcvbxdL1o4sTndiLQ,47141
|
|
13
|
+
tensorrt_cu12_bindings-10.9.0.34.dist-info/METADATA,sha256=RMmEom25XeK_awJzeCt5FMulqvHlHh_Ewo3faPL8_ug,606
|
|
14
|
+
tensorrt_cu12_bindings-10.9.0.34.dist-info/WHEEL,sha256=T8VPDjot1YI5-NaRzS6kIMlJNVl0SSGa_dm-8Fprszg,99
|
|
15
|
+
tensorrt_cu12_bindings-10.9.0.34.dist-info/top_level.txt,sha256=QuFeuaCbu20Zk7dFQs6JlSlk-ZLCkirage8XegBmyP0,18
|
|
16
|
+
tensorrt_cu12_bindings-10.9.0.34.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
17
|
+
tensorrt_cu12_bindings-10.9.0.34.dist-info/RECORD,,
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
tensorrt_bindings/__init__.py,sha256=Y24vpa4rxvmISEkDFeu8BJgHAAnmwV-SGHKF86wYR5o,5892
|
|
2
|
-
tensorrt_bindings/tensorrt.cp39-win_amd64.pyd,sha256=t7tVv7FRi1d2N6gduseD2D27Fx_yVNMyZ7Y32AZJujg,2174464
|
|
3
|
-
tensorrt_bindings/plugin/__init__.py,sha256=28b1lyihZnjVIJzh1h2Za_XSb5nJXOBS9w8LyD0WyLw,1558
|
|
4
|
-
tensorrt_bindings/plugin/_autotune.py,sha256=xlNut0qB9rlgyhfV4QyVJEsT50r3PuFz1xk0pnDiVA8,12493
|
|
5
|
-
tensorrt_bindings/plugin/_export.py,sha256=xJE2C9TTX-ons81GUBYbf4djv44bpyi0RzhzJlxJo4I,1189
|
|
6
|
-
tensorrt_bindings/plugin/_lib.py,sha256=PfnV11UPHhadsTosIqgQBOpbx0pCfzHjXB6rS_xZ-gc,21378
|
|
7
|
-
tensorrt_bindings/plugin/_plugin_class.py,sha256=6AZKcpES3D8l8VSq0691Fmb1yeTvfiJazK861Lm1_qw,12145
|
|
8
|
-
tensorrt_bindings/plugin/_tensor.py,sha256=BefibyFqrY1Vi4K1Yqk6CRda8Nn1cs6lDMRV4dugIX0,28136
|
|
9
|
-
tensorrt_bindings/plugin/_top_level.py,sha256=mxZk0M-v8aP1uMVziX6FDBxFQPq3Cp6gd0Iq09xRUro,4708
|
|
10
|
-
tensorrt_bindings/plugin/_utils.py,sha256=Hl2PslERH5X0UMArk_k8GKag7ME0pW0RjQcTX3zYsoc,2741
|
|
11
|
-
tensorrt_bindings/plugin/_validate.py,sha256=nHDLvekos2hI5fDoU6KhDeNQh_NdmN3NRM2xWhyanuY,14477
|
|
12
|
-
tensorrt_cu12_bindings-10.7.0.post1.dist-info/LICENSE.txt,sha256=yGkV_ZW7773aMTWqzj5q1rRhKEbcvbxdL1o4sTndiLQ,47141
|
|
13
|
-
tensorrt_cu12_bindings-10.7.0.post1.dist-info/METADATA,sha256=SjIOccD0yPfvX7vido9xh_ppWOiFVf-AaT5OyV8txJg,609
|
|
14
|
-
tensorrt_cu12_bindings-10.7.0.post1.dist-info/WHEEL,sha256=T8VPDjot1YI5-NaRzS6kIMlJNVl0SSGa_dm-8Fprszg,99
|
|
15
|
-
tensorrt_cu12_bindings-10.7.0.post1.dist-info/top_level.txt,sha256=QuFeuaCbu20Zk7dFQs6JlSlk-ZLCkirage8XegBmyP0,18
|
|
16
|
-
tensorrt_cu12_bindings-10.7.0.post1.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
17
|
-
tensorrt_cu12_bindings-10.7.0.post1.dist-info/RECORD,,
|
|
File without changes
|
{tensorrt_cu12_bindings-10.7.0.post1.dist-info → tensorrt_cu12_bindings-10.9.0.34.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|