Skip to content

Commit 84024a0

Browse files
committed
fix comments and bugs
1 parent 6bd3c7f commit 84024a0

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ def linear(
4040
ctx,
4141
target,
4242
source_ir,
43-
<<<<<<< HEAD
4443
f"{name}_matrix_multiply",
45-
=======
46-
name,
47-
>>>>>>> 785c25a2f (revert linear converter)
4844
input,
4945
weight,
5046
input_matrix_op=trt.MatrixOperation.NONE,
@@ -53,12 +49,8 @@ def linear(
5349

5450
if bias is not None:
5551
# add bias
56-
<<<<<<< HEAD
5752
out = impl.elementwise.add(
5853
ctx, target, source_ir, f"{name}_add_bias", out, bias
5954
)
60-
=======
61-
out = impl.elementwise.add(ctx, target, source_ir, name, out, bias)
62-
>>>>>>> 785c25a2f (revert linear converter)
6355

6456
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)