Skip to content

Commit a185803

Browse files
committed
fix comments and bugs
1 parent 22721c2 commit a185803

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

py/torch_tensorrt/dynamo/conversion/aten_ops_converters.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3582,7 +3582,6 @@ def aten_ops_nonzero(
35823582

35833583

35843584
@dynamo_tensorrt_converter(torch.ops.aten.linear.default, supports_dynamic_shapes=True)
3585-
@dynamo_tensorrt_converter(torch.ops.aten.linear, supports_dynamic_shapes=True)
35863585
def aten_ops_linear(
35873586
ctx: ConversionContext,
35883587
target: Target,

py/torch_tensorrt/dynamo/conversion/impl/linear.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from torch_tensorrt.dynamo.conversion import impl
88
from torch_tensorrt.dynamo.conversion._ConversionContext import ConversionContext
99
from torch_tensorrt.dynamo.conversion.converter_utils import SourceIR, get_trt_tensor
10-
from torch_tensorrt.fx.types import TRTTensor
10+
from torch_tensorrt.dynamo.types import TRTTensor
1111

1212

1313
def linear(
@@ -40,7 +40,7 @@ def linear(
4040
ctx,
4141
target,
4242
source_ir,
43-
name,
43+
f"{name}_matrix_multiply",
4444
input,
4545
weight,
4646
input_matrix_op=trt.MatrixOperation.NONE,
@@ -49,6 +49,6 @@ def linear(
4949

5050
if bias is not None:
5151
# add bias
52-
out = impl.elementwise.add(ctx, target, source_ir, name, out, bias)
52+
out = impl.elementwise.add(ctx, target, source_ir, f"{name}_add", out, bias)
5353

5454
return out

py/torch_tensorrt/dynamo/runtime/_PythonTorchTensorRTModule.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import logging
44
from contextlib import nullcontext
5-
from tempfile import tempdir
65
from typing import Any, Dict, List, Optional, Sequence, Tuple
76

87
import tensorrt as trt
@@ -539,7 +538,7 @@ def run_standard_execution() -> torch.Tensor | Tuple[torch.Tensor, ...]:
539538

540539
with tempfile.TemporaryDirectory() as tmpdir:
541540
self.cudagraph.debug_dump(
542-
f"{tempdir}/{self.name}_cudagraph.dot"
541+
f"{tmpdir}/{self.name}_cudagraph.dot"
543542
)
544543

545544
self.cudagraph.replay() # type: ignore

tools/perf/perf_run.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,7 @@ def run_tensorrt(
474474
# Get I/O tensor information using TensorRT 10 API
475475
input_names = []
476476
output_names = []
477-
input_dtypes = []
478477
output_dtypes = []
479-
input_shapes = []
480478
output_shapes = []
481479

482480
for i in range(engine.num_io_tensors):
@@ -487,8 +485,6 @@ def run_tensorrt(
487485

488486
if tensor_mode == trt.TensorIOMode.INPUT:
489487
input_names.append(tensor_name)
490-
input_dtypes.append(torch_dtype_from_trt(tensor_dtype))
491-
input_shapes.append(tuple(tensor_shape))
492488
else: # trt.TensorIOMode.OUTPUT
493489
output_names.append(tensor_name)
494490
output_dtypes.append(torch_dtype_from_trt(tensor_dtype))
@@ -514,6 +510,8 @@ def run_tensorrt(
514510
dedicated_stream = torch.cuda.Stream()
515511
current_stream = torch.cuda.current_stream()
516512

513+
setup_time = timeit.default_timer()
514+
517515
# Warm up
518516
for i in range(WARMUP_ITER):
519517
# Wait for current stream to finish
@@ -523,6 +521,7 @@ def run_tensorrt(
523521
current_stream.wait_stream(dedicated_stream)
524522
torch.cuda.synchronize()
525523

524+
infer_start_time = timeit.default_timer()
526525
# Performance measurement
527526
for i in range(iters):
528527
# Wait for current stream to finish
@@ -531,9 +530,12 @@ def run_tensorrt(
531530
# Wait for TensorRT stream to finish
532531
current_stream.wait_stream(dedicated_stream)
533532
torch.cuda.synchronize()
534-
end_time = timeit.default_timer()
535-
infer_time = end_time - start_time
536-
timings.append(infer_time)
533+
534+
end_time = timeit.default_timer()
535+
536+
# to compare against torch-trt dynamo apples to apples
537+
infer_time = (end_time - infer_start_time + setup_time - start_time) / iters
538+
timings.append(infer_time)
537539

538540
recordStats("TensorRT", timings, precision, batch_size, compile_time_s)
539541

0 commit comments

Comments
 (0)