写点什么

TensorRT 和 ONNX Runtime 推理优化实战:10 个降低延迟的工程技巧

作者:郝培强
  • 2025-11-29
    广东
  • 本文字数:19754 字

    阅读完需:约 65 分钟

TensorRT 和 ONNX Runtime 推理优化实战:10 个降低延迟的工程技巧

模型速度的瓶颈往往不在算法本身。几毫秒的优化累积起来就能让用户感受到明显的性能提升。下面这些技术都是在生产环境跑出来的经验,不需要重构代码实施起来也相对简单并且效果显著。


固定输入形状,越早告诉运行时越好动态形状用起来方便但对性能不友好。TensorRT 和 ONNX Runtime 在处理固定形状时能做更激进的优化。


TensorRT 这边,构建引擎时最好围绕实际使用的 min/opt/max 设置 optimization profile,生产环境尽量让所有请求都落在 opt 范围。ONNX Runtime 可以直接导出固定维度的模型,比如 1×3×224×224。确实需要动态性的话,也要把范围控制得足够紧。

TensorRT: build with a tight optimization profile

profile = builder.create_optimization_profile()


profile.set_shape("input", (1,3,224,224), (1,3,224,224), (1,3,224,224))


config.add_optimization_profile(profile)这样 kernel 选择、内存规划、算子融合在形状确定的情况下都能做得更彻底。


启动前把该热的都热一遍冷启动的开销藏在各个角落:驱动初始化、page fault、lazy allocation。服务启动和重启后跑几轮 warmup,把这些一次性成本提前消化掉。

ONNX Runtime warmup + pinned buffers

import onnxruntime as ort, numpy as np


so = ort.SessionOptions()


so.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL


sess = ort.InferenceSession("model.onnx", sess_options=so, providers=["CUDAExecutionProvider"])


x = np.random.randn(1,3,224,224).astype(np.float32)


for _ in range(8): # small loop to populate caches/contexts


sess.run(None, {"input": x})warmup 的形状一定要和线上一模一样。如果服务多种 batch size,每个都得过一遍。


I/O binding 配合 pinned memory 减少拷贝 Host 和 device 之间来回搬数据是 tail latency 的大敌。buffer 绑定一次,后面反复用就行了。

ONNX Runtime I/O binding example

io = sess.io_binding()


x = np.random.randn(1,3,224,224).astype(np.float32)

Upload once & bind

io.bind_cpu_input("input", x) # or bind to CUDA device via OrtValue


io.bind_output("logits", device_type="cuda")


sess.run_with_iobinding(io)


out = io.copy_outputs_to_cpu()[0] # pull back only when you mustGPU 流量大的场景,host 端内存用 page-locked(pinned)能让 H2D/D2H 传输快不少。本质上是把多次小开销合并成一次前置成本,allocator 也不用频繁介入。


精度降低不一定掉点现在的 GPU 对 FP16 支持很好,服务器 CPU 和 NPU 上 INT8 的收益也越来越明显。只要精度守得住,延迟的改善非常直接。


TensorRT 开 FP16 就是一个 flag 的设置:


config.set_flag(trt.BuilderFlag.FP16)。但是 INT8 需要校准,要拿代表性数据跑一遍生成 per-channel scale。ONNX Runtime 可以用 TensorRT EP 或者直接加载量化后的模型。

TensorRT FP16 (and INT8 if you have a calibrator)

config.set_flag(trt.BuilderFlag.FP16)

config.set_flag(trt.BuilderFlag.INT8)

config.int8_calibrator = calibrator

这里可以先量化最慢的几个子图,比如 embedding 层或者 attention block,不用一上来就全模型量化。


图优化可以开到最高档,但要验证数值让运行时自己去融合算子、选更优的 kernel,这个收益基本是白来的。

ONNX Runtime optimizations + EPs

so = ort.SessionOptions()


so.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL


providers = [


("TensorrtExecutionProvider", {"trt_fp16_enable": True}),


"CUDAExecutionProvider",


"CPUExecutionProvider"


]


sess = ort.InferenceSession("model.onnx", sess_options=so, providers=providers)但是需要注意的是融合会改变计算顺序,数值可能有细微漂移。开启前后要跑个 tolerance check,确保输出没问题。


micro-batch 在 GPU 上效果明显单条请求跑推理简单,但硬件利用率往往上不去。打包成 4-8 个请求一起跑,能在保持低延迟的同时提升吞吐。


关键是 batching window 要够小,比如 2-5ms,不然 p95 会飙。micro-batch 的大小最好和前面 optimization profile 设置的尺寸对齐。


不过如果 SLA 本身就很紧(p50 要求 5ms 以内),micro-batch 带来的收益可能不如下面要说的 CUDA Graph。


CUDA Graph 消除 kernel launch 开销小模型或者调用频繁的 graph,kernel launch 的开销会很明显。CUDA Graph 能把整个推理过程录制下来,replay 时几乎没有 CPU 开销。


TensorRT 在形状固定的情况下可以直接启用,只需要 warmup 一次,后面就一直跑 captured graph。


这里可以理解成在 GPU driver 层面把推理编译成一个可重放的宏。


ONNX Runtime 线程设置有讲究 ONNX Runtime 暴露了几个线程相关的参数,对 CPU 和混合负载的 tail latency 影响挺大。


so = ort.SessionOptions()


so.intra_op_num_threads = 1 # one thread per operator often stabilizes latency


so.inter_op_num_threads = 1 # avoid oversubscription; raise carefully if parallel graphsExecution Provider 的选择也很重要:


GPU 场景优先级是 TensorRT EP → CUDA EP → CPU EP fallback。纯 CPU 跑的话 OpenMP 或者 DNNL/MKL build 配合合理的线程池设置效果最好。边缘设备上 Intel 的盒子可以试试 OpenVINO EP。


把预处理后处理从 GIL 里挪出去 Python 的胶水代码经常成为隐藏的性能杀手。能用 NumPy 向量化就别写循环,能用 Numba 或者推到 CUDA/CuPy 上更好。热路径里的 transform 最好提前编译好。如果要并发处理请求,worker pool 的规模要和运行时的线程数配合好。

Example: pre-allocate and reuse buffers to dodge Python overheads

import numpy as np


class Preprocessor:


def init(self, shape=(1,3,224,224)):


self.buf = np.empty(shape, dtype=np.float32)


def __call__(self, img):      # write into self.buf in-place; no fresh allocations      np.copyto(self.buf, img)      self.buf /= 255.0       return self.buf
复制代码


这里的判断标准很简单,每个请求都会跑的代码,问问能不能预分配、向量化或者缓存起来。


Session、Engine、Buffer 都只建一次每个请求新建一个


trt.ICudaEngine 或


onnxruntime.InferenceSession 基本等于自杀。output array 每次重新分配也一样。


正确做法是进程启动时就加载好 singleton session/engine,每个 worker 维护一两个 CUDA stream,buffer pool 按 shape 和 dtype 索引。

Simple singleton-ish loader

class Model:


_sess = None


_io = None


@classmethod


def get(cls):


if cls._sess is None:


so = ort.SessionOptions()


so.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL


cls._sess = ort.InferenceSession("model.onnx", sess_options=so,


providers=["CUDAExecutionProvider"])


cls._io = cls._sess.io_binding()


return cls._sess, cls._io 这样做的好处是稳定,p95 不会因为 allocator 和 initializer 出现在热路径而突然炸掉。


一个完整的 GPU 推理骨架下面的代码是把前面几个关键技术串起来:


import onnxruntime as ort, numpy as np


def make_session(path):


so = ort.SessionOptions()


so.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL


providers = [("TensorrtExecutionProvider", {"trt_fp16_enable": True}),


"CUDAExecutionProvider", "CPUExecutionProvider"]


return ort.InferenceSession(path, sess_options=so, providers=providers)


class Runner:


def init(self, model_path, shape=(1,3,224,224)):


self.sess = make_session(model_path)


self.shape = shape


self.io = self.sess.io_binding()


self._warmup()


def _warmup(self, iters=8):      x = np.random.randn(*self.shape).astype(np.float32)      self.io.bind_cpu_input("input", x)      self.io.bind_output("logits", device_type="cuda")      for _ in range(iters):          self.sess.run_with_iobinding(self.io)      self.io.clear_binding_inputs()  # ready for real runs  
def run(self, x_np: np.ndarray): # assumes x_np matches self.shape; in production, validate or clamp self.io.bind_cpu_input("input", x_np) self.io.bind_output("logits", device_type="cuda") self.sess.run_with_iobinding(self.io) return self.io.copy_outputs_to_cpu()[0]
复制代码

usage

runner = Runner("model.onnx")


batch = np.random.randn(1,3,224,224).astype(np.float32)


probs = runner.run(batch)这个代码已经包含了图优化、I/O binding 和 warmup。后面再加上 CUDA Graph、micro-batch 和固定 shape,能把延迟压到很低,基本上拿来就可以用了

https://vk.com/topic-233841187_55344814

https://vk.com/topic-233841191_55622391

https://vk.com/topic-233841196_54431572

https://vk.com/topic-233841195_53945164

https://vk.com/topic-233841189_54771698

https://vk.com/topic-233841188_54551008

https://vk.com/topic-233841186_54431571

https://vk.com/topic-233841194_54059831

https://vk.com/topic-233841187_55344813

https://vk.com/topic-233841191_55622390

https://vk.com/topic-233841196_54431570

https://vk.com/topic-233841195_53945163

https://vk.com/topic-233841189_54771697

https://vk.com/topic-233841188_54551007

https://vk.com/topic-233841194_54059830

https://vk.com/topic-233841186_54431568

https://vk.com/topic-233841187_55344812

https://vk.com/topic-233841191_55622389

https://vk.com/topic-233841196_54431567

https://vk.com/topic-233841195_53945162

https://vk.com/topic-233841189_54771696

https://vk.com/topic-233841188_54551006

https://vk.com/topic-233841194_54059829

https://vk.com/topic-233841186_54431566

https://vk.com/topic-233841187_55344810

https://vk.com/topic-233841191_55622387

https://vk.com/topic-233841196_54431565

https://vk.com/topic-233841195_53945161

https://vk.com/topic-233841189_54771695

https://vk.com/topic-233841188_54551005

https://vk.com/topic-233841194_54059828

https://vk.com/topic-233841186_54431564

https://vk.com/topic-233841187_55344809

https://vk.com/topic-233841191_55622386

https://vk.com/topic-233841196_54431563

https://vk.com/topic-233841195_53945160

https://vk.com/topic-233841189_54771692

https://vk.com/topic-233841188_54551004

https://vk.com/topic-233841194_54059826

https://vk.com/topic-233841186_54431562

https://vk.com/topic-233841187_55344808

https://vk.com/topic-233841191_55622385

https://vk.com/topic-233841196_54431561

https://vk.com/topic-233841195_53945159

https://vk.com/topic-233841189_54771691

https://vk.com/topic-233841188_54551003

https://vk.com/topic-233841194_54059825

https://vk.com/topic-233841186_54431560

https://vk.com/topic-233841187_55344806

https://vk.com/topic-233841191_55622384

https://vk.com/topic-233841196_54431559

https://vk.com/topic-233841195_53945158

https://vk.com/topic-233841189_54771689

https://vk.com/topic-233841188_54551000

https://vk.com/topic-233841186_54431558

https://vk.com/topic-233841194_54059824

https://vk.com/topic-233841187_55344804

https://vk.com/topic-233841191_55622383

https://vk.com/topic-233841196_54431557

https://vk.com/topic-233841195_53945156

https://vk.com/topic-233841189_54771688

https://vk.com/topic-233841188_54550998

https://vk.com/topic-233841186_54431555

https://vk.com/topic-233841194_54059823

https://vk.com/topic-233841187_55344803

https://vk.com/topic-233841191_55622381

https://vk.com/topic-233841196_54431554

https://vk.com/topic-233841195_53945155

https://vk.com/topic-233841189_54771686

https://vk.com/topic-233841188_54550997

https://vk.com/topic-233841186_54431553

https://vk.com/topic-233841194_54059822

https://vk.com/topic-233841187_55344801

https://vk.com/topic-233841191_55622380

https://vk.com/topic-233841196_54431552

https://vk.com/topic-233841195_53945154

https://vk.com/topic-233841189_54771684

https://vk.com/topic-233841188_54550996

https://vk.com/topic-233841186_54431551

https://vk.com/topic-233841194_54059821

https://vk.com/topic-233841187_55344800

https://vk.com/topic-233841191_55622378

https://vk.com/topic-233841196_54431550

https://vk.com/topic-233841195_53945153

https://vk.com/topic-233841189_54771683

https://vk.com/topic-233841188_54550995

https://vk.com/topic-233841186_54431549

https://vk.com/topic-233841194_54059819

https://vk.com/topic-233841187_55344797

https://vk.com/topic-233841191_55622377

https://vk.com/topic-233841196_54431548

https://vk.com/topic-233841195_53945152

https://vk.com/topic-233841189_54771680

https://vk.com/topic-233841188_54550993

https://vk.com/topic-233841186_54431546

https://vk.com/topic-233841194_54059818

https://vk.com/topic-233841187_55344795

https://vk.com/topic-233841191_55622375

https://vk.com/topic-233841196_54431545

https://vk.com/topic-233841195_53945150

https://vk.com/topic-233841189_54771679

https://vk.com/topic-233841188_54550992

https://vk.com/topic-233841186_54431544

https://vk.com/topic-233841194_54059817

https://vk.com/topic-233841187_55344794

https://vk.com/topic-233841191_55622373

https://vk.com/topic-233841196_54431543

https://vk.com/topic-233841195_53945149

https://vk.com/topic-233841189_54771677

https://vk.com/topic-233841188_54550989

https://vk.com/topic-233841186_54431541

https://vk.com/topic-233841194_54059815

https://vk.com/topic-233841187_55344792

https://vk.com/topic-233841191_55622369

https://vk.com/topic-233841196_54431540

https://vk.com/topic-233841195_53945148

https://vk.com/topic-233841189_54771676

https://vk.com/topic-233841188_54550988

https://vk.com/topic-233841186_54431539

https://vk.com/topic-233841194_54059814

https://vk.com/topic-233841187_55344791

https://vk.com/topic-233841191_55622368

https://vk.com/topic-233841196_54431538

https://vk.com/topic-233841195_53945147

https://vk.com/topic-233841189_54771674

https://vk.com/topic-233841188_54550987

https://vk.com/topic-233841186_54431537

https://vk.com/topic-233841194_54059813

https://vk.com/topic-233841187_55344790

https://vk.com/topic-233841191_55622367

https://vk.com/topic-233841196_54431536

https://vk.com/topic-233841195_53945146

https://vk.com/topic-233841189_54771671

https://vk.com/topic-233841188_54550986

https://vk.com/topic-233841186_54431535

https://vk.com/topic-233841194_54059812

https://vk.com/topic-233841191_55622365

https://vk.com/topic-233841187_55344788

https://vk.com/topic-233841196_54431534

https://vk.com/topic-233841195_53945145

https://vk.com/topic-233841189_54771670

https://vk.com/topic-233841188_54550985

https://vk.com/topic-233841186_54431533

https://vk.com/topic-233841194_54059810

https://vk.com/topic-233841191_55622362

https://vk.com/topic-233841187_55344787

https://vk.com/topic-233841196_54431532

https://vk.com/topic-233841195_53945144

https://vk.com/topic-233841189_54771669

https://vk.com/topic-233841188_54550984

https://vk.com/topic-233841186_54431531

https://vk.com/topic-233841194_54059808

https://vk.com/topic-233841191_55622361

https://vk.com/topic-233841187_55344786

https://vk.com/topic-233841196_54431530

https://vk.com/topic-233841195_53945143

https://vk.com/topic-233841189_54771667

https://vk.com/topic-233841188_54550982

https://vk.com/topic-233841186_54431528

https://vk.com/topic-233841194_54059807

https://vk.com/topic-233841191_55622358

https://vk.com/topic-233841187_55344785

https://vk.com/topic-233841196_54431527

https://vk.com/topic-233841195_53945142

https://vk.com/topic-233841189_54771665

https://vk.com/topic-233841188_54550981

https://vk.com/topic-233841186_54431526

https://vk.com/topic-233841194_54059806

https://vk.com/topic-233841191_55622356

https://vk.com/topic-233841187_55344784

https://vk.com/topic-233841196_54431525

https://vk.com/topic-233841195_53945141

https://vk.com/topic-233841189_54771664

https://vk.com/topic-233841186_54431524

https://vk.com/topic-233841194_54059805

https://vk.com/topic-233841188_54550980

https://vk.com/topic-233841191_55622355

https://vk.com/topic-233841187_55344783

https://vk.com/topic-233841196_54431523

https://vk.com/topic-233841195_53945140

https://vk.com/topic-233841189_54771663

https://vk.com/topic-233841186_54431522

https://vk.com/topic-233841188_54550979

https://vk.com/topic-233841194_54059804

https://vk.com/topic-233841191_55622353

https://vk.com/topic-233841187_55344782

https://vk.com/topic-233841196_54431521

https://vk.com/topic-233841195_53945139

https://vk.com/topic-233841189_54771661

https://vk.com/topic-233841186_54431520

https://vk.com/topic-233841188_54550978

https://vk.com/topic-233841194_54059803

https://vk.com/topic-233841191_55622352

https://vk.com/topic-233841187_55344781

https://vk.com/topic-233841196_54431519

https://vk.com/topic-233841195_53945138

https://vk.com/topic-233841189_54771660

https://vk.com/topic-233841186_54431518

https://vk.com/topic-233841194_54059801

https://vk.com/topic-233841188_54550977

https://vk.com/topic-233841191_55622351

https://vk.com/topic-233841187_55344780

https://vk.com/topic-233841196_54431517

https://vk.com/topic-233841195_53945136

https://vk.com/topic-233841189_54771659

https://vk.com/topic-233841186_54431515

https://vk.com/topic-233841194_54059800

https://vk.com/topic-233841188_54550975

https://vk.com/topic-233841191_55622350

https://vk.com/topic-233841187_55344778

https://vk.com/topic-233841196_54431514

https://vk.com/topic-233841195_53945135

https://vk.com/topic-233841189_54771657

https://vk.com/topic-233841186_54431513

https://vk.com/topic-233841194_54059799

https://vk.com/topic-233841188_54550974

https://vk.com/topic-233841191_55622349

https://vk.com/topic-233841187_55344777

https://vk.com/topic-233841196_54431512

https://vk.com/topic-233841195_53945134

https://vk.com/topic-233841189_54771656

https://vk.com/topic-233841186_54431511

https://vk.com/topic-233841194_54059798

https://vk.com/topic-233841188_54550973

https://vk.com/topic-233841191_55622347

https://vk.com/topic-233841187_55344775

https://vk.com/topic-233841196_54431510

https://vk.com/topic-233841195_53945133

https://vk.com/topic-233841189_54771655

https://vk.com/topic-233841186_54431509

https://vk.com/topic-233841194_54059797

https://vk.com/topic-233841188_54550971

https://vk.com/topic-233841191_55622346

https://vk.com/topic-233841187_55344773

https://vk.com/topic-233841196_54431508

https://vk.com/topic-233841195_53945132

https://vk.com/topic-233841189_54771654

https://vk.com/topic-233841186_54431507

https://vk.com/topic-233841194_54059794

https://vk.com/topic-233841188_54550970

https://vk.com/topic-233841191_55622345

https://vk.com/topic-233841187_55344772

https://vk.com/topic-233841196_54431506

https://vk.com/topic-233841195_53945131

https://vk.com/topic-233841189_54771652

https://vk.com/topic-233841186_54431505

https://vk.com/topic-233841194_54059793

https://vk.com/topic-233841188_54550967

https://vk.com/topic-233841191_55622343

https://vk.com/topic-233841187_55344769

https://vk.com/topic-233841196_54431503

https://vk.com/topic-233841195_53945128

https://vk.com/topic-233841189_54771650

https://vk.com/topic-233841186_54431502

https://vk.com/topic-233841194_54059792

https://vk.com/topic-233841188_54550966

https://vk.com/topic-233841191_55622342

https://vk.com/topic-233841187_55344767

https://vk.com/topic-233841196_54431501

https://vk.com/topic-233841195_53945127

https://vk.com/topic-233841189_54771649

https://vk.com/topic-233841186_54431500

https://vk.com/topic-233841194_54059790

https://vk.com/topic-233841188_54550965

https://vk.com/topic-233841191_55622341

https://vk.com/topic-233841187_55344765

https://vk.com/topic-233841196_54431499

https://vk.com/topic-233841195_53945126

https://vk.com/topic-233841189_54771647

https://vk.com/topic-233841186_54431498

https://vk.com/topic-233841194_54059788

https://vk.com/topic-233841188_54550964

https://vk.com/topic-233841191_55622340

https://vk.com/topic-233841187_55344763

https://vk.com/topic-233841196_54431497

https://vk.com/topic-233841195_53945125

https://vk.com/topic-233841189_54771645

https://vk.com/topic-233841186_54431496

https://vk.com/topic-233841194_54059787

https://vk.com/topic-233841188_54550963

https://vk.com/topic-233841191_55622337

https://vk.com/topic-233841187_55344762

https://vk.com/topic-233841196_54431495

https://vk.com/topic-233841195_53945124

https://vk.com/topic-233841189_54771644

https://vk.com/topic-233841186_54431494

https://vk.com/topic-233841194_54059786

https://vk.com/topic-233841188_54550961

https://vk.com/topic-233841191_55622336

https://vk.com/topic-233841187_55344761

https://vk.com/topic-233841196_54431493

https://vk.com/topic-233841195_53945123

https://vk.com/topic-233841189_54771642

https://vk.com/topic-233841186_54431492

https://vk.com/topic-233841194_54059785

https://vk.com/topic-233841188_54550960

https://vk.com/topic-233841191_55622335

https://vk.com/topic-233841187_55344760

https://vk.com/topic-233841196_54431491

https://vk.com/topic-233841195_53945121

https://vk.com/topic-233841189_54771641

https://vk.com/topic-233841186_54431488

https://vk.com/topic-233841194_54059784

https://vk.com/topic-233841188_54550959

https://vk.com/topic-233841191_55622334

https://vk.com/topic-233841187_55344759

https://vk.com/topic-233841196_54431487

https://vk.com/topic-233841195_53945120

https://vk.com/topic-233841189_54771639

https://vk.com/topic-233841186_54431486

https://vk.com/topic-233841194_54059783

https://vk.com/topic-233841188_54550958

https://vk.com/topic-233841191_55622333

https://vk.com/topic-233841187_55344758

https://vk.com/topic-233841196_54431484

https://vk.com/topic-233841195_53945119

https://vk.com/topic-233841189_54771638

https://vk.com/topic-233841186_54431483

https://vk.com/topic-233841194_54059782

https://vk.com/topic-233841188_54550957

https://vk.com/topic-233841191_55622331

https://vk.com/topic-233841187_55344756

https://vk.com/topic-233841196_54431482

https://vk.com/topic-233841195_53945118

https://vk.com/topic-233841189_54771636

https://vk.com/topic-233841186_54431481

https://vk.com/topic-233841194_54059775

https://vk.com/topic-233841188_54550955

https://vk.com/topic-233841191_55622327

https://vk.com/topic-233841187_55344754

https://vk.com/topic-233841196_54431479

https://vk.com/topic-233841195_53945115

https://vk.com/topic-233841189_54771635

https://vk.com/topic-233841186_54431477

https://vk.com/topic-233841194_54059774

https://vk.com/topic-233841188_54550954

https://vk.com/topic-233841191_55622326

https://vk.com/topic-233841187_55344753

https://vk.com/topic-233841196_54431476

https://vk.com/topic-233841195_53945114

https://vk.com/topic-233841189_54771633

https://vk.com/topic-233841186_54431474

https://vk.com/topic-233841194_54059773

https://vk.com/topic-233841188_54550953

https://vk.com/topic-233841191_55622325

https://vk.com/topic-233841187_55344752

https://vk.com/topic-233841196_54431473

https://vk.com/topic-233841195_53945113

https://vk.com/topic-233841189_54771632

https://vk.com/topic-233841186_54431472

https://vk.com/topic-233841194_54059772

https://vk.com/topic-233841188_54550952

https://vk.com/topic-233841191_55622323

https://vk.com/topic-233841187_55344750

https://vk.com/topic-233841196_54431471

https://vk.com/topic-233841195_53945112

https://vk.com/topic-233841189_54771631

https://vk.com/topic-233841186_54431470

https://vk.com/topic-233841188_54550951

https://vk.com/topic-233841194_54059771

https://vk.com/topic-233841191_55622322

https://vk.com/topic-233841187_55344748

https://vk.com/topic-233841196_54431469

https://vk.com/topic-233841195_53945111

https://vk.com/topic-233841189_54771630

https://vk.com/topic-233841188_54550950

https://vk.com/topic-233841186_54431468

https://vk.com/topic-233841194_54059770

https://vk.com/topic-233841191_55622320

https://vk.com/topic-233841187_55344747

https://vk.com/topic-233841196_54431467

https://vk.com/topic-233841195_53945110

https://vk.com/topic-233841189_54771629

https://vk.com/topic-233841188_54550949

https://vk.com/topic-233841186_54431466

https://vk.com/topic-233841194_54059769

https://vk.com/topic-233841191_55622319

https://vk.com/topic-233841187_55344745

https://vk.com/topic-233841196_54431465

https://vk.com/topic-233841195_53945109

https://vk.com/topic-233841189_54771628

https://vk.com/topic-233841188_54550948

https://vk.com/topic-233841186_54431464

https://vk.com/topic-233841194_54059768

https://vk.com/topic-233841191_55622318

https://vk.com/topic-233841187_55344743

https://vk.com/topic-233841196_54431463

https://vk.com/topic-233841195_53945108

https://vk.com/topic-233841189_54771627

https://vk.com/topic-233841188_54550947

https://vk.com/topic-233841186_54431462

https://vk.com/topic-233841194_54059767

https://vk.com/topic-233841191_55622315

https://vk.com/topic-233841187_55344742

https://vk.com/topic-233841196_54431461

https://vk.com/topic-233841195_53945107

https://vk.com/topic-233841189_54771626

https://vk.com/topic-233841186_54431459

https://vk.com/topic-233841188_54550946

https://vk.com/topic-233841194_54059766

https://vk.com/topic-233841105_53945106

https://vk.com/topic-233841100_55144629

https://vk.com/topic-233841106_54431458

https://vk.com/topic-233841102_54731800

https://vk.com/topic-233841104_54059765

https://vk.com/topic-233841103_54358033

https://vk.com/topic-233841108_54550945

https://vk.com/topic-233841101_55622314

https://vk.com/topic-233841107_55344740

https://vk.com/topic-233841099_54771623

https://vk.com/topic-233841105_53945105

https://vk.com/topic-233841100_55144628

https://vk.com/topic-233841106_54431457

https://vk.com/topic-233841102_54731799

https://vk.com/topic-233841104_54059764

https://vk.com/topic-233841103_54358032

https://vk.com/topic-233841108_54550944

https://vk.com/topic-233841101_55622312

https://vk.com/topic-233841107_55344739

https://vk.com/topic-233841099_54771621

https://vk.com/topic-233841105_53945104

https://vk.com/topic-233841100_55144627

https://vk.com/topic-233841106_54431456

https://vk.com/topic-233841102_54731798

https://vk.com/topic-233841104_54059763

https://vk.com/topic-233841103_54358031

https://vk.com/topic-233841108_54550943

https://vk.com/topic-233841101_55622310

https://vk.com/topic-233841107_55344738

https://vk.com/topic-233841099_54771619

https://vk.com/topic-233841105_53945103

https://vk.com/topic-233841100_55144626

https://vk.com/topic-233841106_54431455

https://vk.com/topic-233841102_54731797

https://vk.com/topic-233841104_54059762

https://vk.com/topic-233841103_54358030

https://vk.com/topic-233841108_54550942

https://vk.com/topic-233841101_55622309

https://vk.com/topic-233841107_55344737

https://vk.com/topic-233841099_54771618

https://vk.com/topic-233841105_53945102

https://vk.com/topic-233841100_55144625

https://vk.com/topic-233841106_54431454

https://vk.com/topic-233841102_54731796

https://vk.com/topic-233841104_54059761

https://vk.com/topic-233841103_54358029

https://vk.com/topic-233841108_54550941

https://vk.com/topic-233841101_55622306

https://vk.com/topic-233841107_55344735

https://vk.com/topic-233841099_54771616

https://vk.com/topic-233841105_53945101

https://vk.com/topic-233841100_55144622

https://vk.com/topic-233841106_54431452

https://vk.com/topic-233841102_54731795

https://vk.com/topic-233841104_54059760

https://vk.com/topic-233841103_54358028

https://vk.com/topic-233841108_54550940

https://vk.com/topic-233841101_55622305

https://vk.com/topic-233841107_55344733

https://vk.com/topic-233841099_54771615

https://vk.com/topic-233841105_53945100

https://vk.com/topic-233841100_55144620

https://vk.com/topic-233841106_54431451

https://vk.com/topic-233841102_54731794

https://vk.com/topic-233841104_54059759

https://vk.com/topic-233841103_54358027

https://vk.com/topic-233841108_54550939

https://vk.com/topic-233841101_55622304

https://vk.com/topic-233841107_55344732

https://vk.com/topic-233841099_54771614

https://vk.com/topic-233841105_53945099

https://vk.com/topic-233841100_55144619

https://vk.com/topic-233841106_54431450

https://vk.com/topic-233841102_54731793

https://vk.com/topic-233841104_54059758

https://vk.com/topic-233841103_54358026

https://vk.com/topic-233841108_54550938

https://vk.com/topic-233841101_55622303

https://vk.com/topic-233841107_55344731

https://vk.com/topic-233841099_54771612

https://vk.com/topic-233841105_53945097

https://vk.com/topic-233841100_55144618

https://vk.com/topic-233841106_54431449

https://vk.com/topic-233841102_54731792

https://vk.com/topic-233841104_54059757

https://vk.com/topic-233841103_54358024

https://vk.com/topic-233841108_54550937

https://vk.com/topic-233841101_55622301

https://vk.com/topic-233841107_55344729

https://vk.com/topic-233841099_54771610

https://vk.com/topic-233841105_53945096

https://vk.com/topic-233841100_55144616

https://vk.com/topic-233841106_54431447

https://vk.com/topic-233841102_54731791

https://vk.com/topic-233841104_54059755

https://vk.com/topic-233841103_54358023

https://vk.com/topic-233841108_54550936

https://vk.com/topic-233841101_55622300

https://vk.com/topic-233841107_55344728

https://vk.com/topic-233841099_54771609

https://vk.com/topic-233841105_53945095

https://vk.com/topic-233841100_55144615

https://vk.com/topic-233841106_54431445

https://vk.com/topic-233841102_54731790

https://vk.com/topic-233841104_54059754

https://vk.com/topic-233841103_54358022

https://vk.com/topic-233841108_54550934

https://vk.com/topic-233841101_55622299

https://vk.com/topic-233841107_55344726

https://vk.com/topic-233841099_54771608

https://vk.com/topic-233841105_53945094

https://vk.com/topic-233841100_55144614

https://vk.com/topic-233841106_54431443

https://vk.com/topic-233841102_54731789

https://vk.com/topic-233841104_54059753

https://vk.com/topic-233841103_54358021

https://vk.com/topic-233841108_54550932

https://vk.com/topic-233841101_55622297

https://vk.com/topic-233841107_55344725

https://vk.com/topic-233841099_54771607

https://vk.com/topic-233841105_53945093

https://vk.com/topic-233841100_55144613

https://vk.com/topic-233841106_54431442

https://vk.com/topic-233841102_54731788

https://vk.com/topic-233841104_54059752

https://vk.com/topic-233841103_54358020

https://vk.com/topic-233841108_54550931

https://vk.com/topic-233841101_55622295

https://vk.com/topic-233841107_55344724

https://vk.com/topic-233841099_54771606

https://vk.com/topic-233841105_53945092

https://vk.com/topic-233841100_55144612

https://vk.com/topic-233841106_54431441

https://vk.com/topic-233841102_54731787

https://vk.com/topic-233841104_54059751

https://vk.com/topic-233841103_54358019

https://vk.com/topic-233841108_54550930

https://vk.com/topic-233841101_55622294

https://vk.com/topic-233841107_55344722

https://vk.com/topic-233841099_54771605

https://vk.com/topic-233841105_53945091

https://vk.com/topic-233841100_55144611

https://vk.com/topic-233841106_54431439

https://vk.com/topic-233841102_54731786

https://vk.com/topic-233841104_54059750

https://vk.com/topic-233841103_54358017

https://vk.com/topic-233841108_54550929

https://vk.com/topic-233841101_55622293

https://vk.com/topic-233841107_55344721

https://vk.com/topic-233841099_54771604

https://vk.com/topic-233841105_53945090

https://vk.com/topic-233841100_55144610

https://vk.com/topic-233841106_54431438

https://vk.com/topic-233841102_54731785

https://vk.com/topic-233841104_54059748

https://vk.com/topic-233841103_54358016

https://vk.com/topic-233841108_54550928

https://vk.com/topic-233841101_55622292

https://vk.com/topic-233841107_55344718

https://vk.com/topic-233841099_54771603

https://vk.com/topic-233841105_53945089

https://vk.com/topic-233841100_55144609

https://vk.com/topic-233841106_54431437

https://vk.com/topic-233841102_54731784

https://vk.com/topic-233841104_54059747

https://vk.com/topic-233841103_54358015

https://vk.com/topic-233841108_54550927

https://vk.com/topic-233841101_55622291

https://vk.com/topic-233841107_55344717

https://vk.com/topic-233841099_54771602

https://vk.com/topic-233841105_53945088

https://vk.com/topic-233841100_55144608

https://vk.com/topic-233841106_54431436

https://vk.com/topic-233841102_54731783

https://vk.com/topic-233841104_54059746

https://vk.com/topic-233841103_54358013

https://vk.com/topic-233841108_54550926

https://vk.com/topic-233841101_55622290

https://vk.com/topic-233841107_55344716

https://vk.com/topic-233841099_54771601

https://vk.com/topic-233841105_53945087

https://vk.com/topic-233841100_55144607

https://vk.com/topic-233841106_54431435

https://vk.com/topic-233841102_54731782

https://vk.com/topic-233841104_54059745

https://vk.com/topic-233841103_54358012

https://vk.com/topic-233841108_54550925

https://vk.com/topic-233841101_55622289

https://vk.com/topic-233841107_55344714

https://vk.com/topic-233841099_54771600

https://vk.com/topic-233841105_53945086

https://vk.com/topic-233841100_55144606

https://vk.com/topic-233841106_54431434

https://vk.com/topic-233841102_54731781

https://vk.com/topic-233841104_54059744

https://vk.com/topic-233841103_54358011

https://vk.com/topic-233841108_54550924

https://vk.com/topic-233841101_55622288

https://vk.com/topic-233841107_55344713

https://vk.com/topic-233841099_54771599

https://vk.com/topic-233841105_53945085

https://vk.com/topic-233841100_55144605

https://vk.com/topic-233841106_54431432

https://vk.com/topic-233841102_54731780

https://vk.com/topic-233841104_54059743

https://vk.com/topic-233841103_54358010

https://vk.com/topic-233841108_54550922

https://vk.com/topic-233841101_55622287

https://vk.com/topic-233841107_55344712

https://vk.com/topic-233841099_54771598

https://vk.com/topic-233841105_53945084

https://vk.com/topic-233841100_55144604

https://vk.com/topic-233841106_54431430

https://vk.com/topic-233841102_54731779

https://vk.com/topic-233841104_54059742

https://vk.com/topic-233841103_54358009

https://vk.com/topic-233841108_54550921

https://vk.com/topic-233841101_55622286

https://vk.com/topic-233841107_55344711

https://vk.com/topic-233841099_54771596

https://vk.com/topic-233841105_53945083

https://vk.com/topic-233841100_55144603

https://vk.com/topic-233841106_54431429

https://vk.com/topic-233841102_54731778

https://vk.com/topic-233841104_54059741

https://vk.com/topic-233841103_54358008

https://vk.com/topic-233841108_54550920

https://vk.com/topic-233841101_55622285

https://vk.com/topic-233841107_55344710

https://vk.com/topic-233841099_54771595

https://vk.com/topic-233841105_53945082

https://vk.com/topic-233841100_55144602

https://vk.com/topic-233841106_54431428

https://vk.com/topic-233841102_54731777

https://vk.com/topic-233841104_54059738

https://vk.com/topic-233841103_54358007

https://vk.com/topic-233841108_54550919

https://vk.com/topic-233841101_55622282

https://vk.com/topic-233841107_55344709

https://vk.com/topic-233841099_54771593

https://vk.com/topic-233841105_53945081

https://vk.com/topic-233841100_55144601

https://vk.com/topic-233841106_54431427

https://vk.com/topic-233841102_54731776

https://vk.com/topic-233841104_54059737

https://vk.com/topic-233841103_54358006

https://vk.com/topic-233841108_54550918

https://vk.com/topic-233841101_55622280

https://vk.com/topic-233841107_55344708

https://vk.com/topic-233841099_54771592

https://vk.com/topic-233841105_53945080

https://vk.com/topic-233841100_55144600

https://vk.com/topic-233841106_54431426

https://vk.com/topic-233841102_54731775

https://vk.com/topic-233841104_54059736

https://vk.com/topic-233841103_54358005

https://vk.com/topic-233841108_54550917

https://vk.com/topic-233841101_55622278

https://vk.com/topic-233841107_55344707

https://vk.com/topic-233841099_54771591

https://vk.com/topic-233841105_53945079

https://vk.com/topic-233841100_55144599

https://vk.com/topic-233841106_54431424

https://vk.com/topic-233841102_54731774

https://vk.com/topic-233841104_54059735

https://vk.com/topic-233841108_54550916

https://vk.com/topic-233841103_54358004

https://vk.com/topic-233841101_55622277

https://vk.com/topic-233841107_55344706

https://vk.com/topic-233841099_54771588

https://vk.com/topic-233841105_53945078

https://vk.com/topic-233841100_55144598

https://vk.com/topic-233841106_54431422

https://vk.com/topic-233841102_54731773

https://vk.com/topic-233841104_54059734

https://vk.com/topic-233841108_54550915

https://vk.com/topic-233841103_54358003

https://vk.com/topic-233841101_55622276

https://vk.com/topic-233841107_55344705

https://vk.com/topic-233841099_54771586

https://vk.com/topic-233841105_53945077

https://vk.com/topic-233841100_55144596

https://vk.com/topic-233841106_54431421

https://vk.com/topic-233841102_54731772

https://vk.com/topic-233841104_54059732

https://vk.com/topic-233841108_54550914

https://vk.com/topic-233841103_54358002

https://vk.com/topic-233841101_55622275

https://vk.com/topic-233841107_55344702

https://vk.com/topic-233841099_54771585

https://vk.com/topic-233841105_53945076

https://vk.com/topic-233841100_55144595

https://vk.com/topic-233841106_54431420

https://vk.com/topic-233841102_54731771

https://vk.com/topic-233841104_54059731

https://vk.com/topic-233841108_54550913

https://vk.com/topic-233841103_54358001

https://vk.com/topic-233841101_55622272

https://vk.com/topic-233841107_55344701

https://vk.com/topic-233841099_54771584

https://vk.com/topic-233841105_53945075

https://vk.com/topic-233841100_55144593

https://vk.com/topic-233841106_54431419

https://vk.com/topic-233841102_54731770

https://vk.com/topic-233841104_54059730

https://vk.com/topic-233841108_54550912

https://vk.com/topic-233841103_54358000

https://vk.com/topic-233841101_55622271

https://vk.com/topic-233841107_55344699

https://vk.com/topic-233841099_54771583

https://vk.com/topic-233841105_53945074

https://vk.com/topic-233841100_55144592

https://vk.com/topic-233841106_54431418

https://vk.com/topic-233841102_54731769

https://vk.com/topic-233841104_54059729

https://vk.com/topic-233841108_54550911

https://vk.com/topic-233841103_54357999

https://vk.com/topic-233841101_55622269

https://vk.com/topic-233841107_55344698

https://vk.com/topic-233841099_54771581

https://vk.com/topic-233841105_53945073

https://vk.com/topic-233841100_55144591

https://vk.com/topic-233841106_54431417

https://vk.com/topic-233841102_54731768

https://vk.com/topic-233841104_54059728

https://vk.com/topic-233841108_54550910

https://vk.com/topic-233841103_54357998

https://vk.com/topic-233841101_55622268

https://vk.com/topic-233841107_55344696

https://vk.com/topic-233841099_54771580

https://vk.com/topic-233841105_53945072

https://vk.com/topic-233841100_55144590

https://vk.com/topic-233841106_54431416

https://vk.com/topic-233841102_54731767

https://vk.com/topic-233841104_54059727

https://vk.com/topic-233841108_54550909

https://vk.com/topic-233841103_54357997

https://vk.com/topic-233841101_55622267

https://vk.com/topic-233841107_55344695

https://vk.com/topic-233841099_54771579

https://vk.com/topic-233841105_53945071

https://vk.com/topic-233841100_55144589

https://vk.com/topic-233841106_54431414

https://vk.com/topic-233841102_54731766

https://vk.com/topic-233841104_54059726

https://vk.com/topic-233841108_54550908

https://vk.com/topic-233841103_54357996

https://vk.com/topic-233841101_55622266

https://vk.com/topic-233841107_55344693

https://vk.com/topic-233841099_54771577

https://vk.com/topic-233841105_53945070

https://vk.com/topic-233841100_55144588

https://vk.com/topic-233841106_54431412

https://vk.com/topic-233841102_54731765

https://vk.com/topic-233841104_54059725

https://vk.com/topic-233841108_54550907

https://vk.com/topic-233841103_54357995

https://vk.com/topic-233841101_55622264

https://vk.com/topic-233841107_55344690

https://vk.com/topic-233841099_54771576

https://vk.com/topic-233841105_53945069

https://vk.com/topic-233841100_55144587

https://vk.com/topic-233841106_54431411

https://vk.com/topic-233841102_54731764

https://vk.com/topic-233841104_54059724

https://vk.com/topic-233841108_54550906

https://vk.com/topic-233841103_54357994

https://vk.com/topic-233841101_55622263

https://vk.com/topic-233841107_55344687

https://vk.com/topic-233841099_54771575

https://vk.com/topic-233841105_53945068

https://vk.com/topic-233841100_55144586

https://vk.com/topic-233841106_54431410

https://vk.com/topic-233841102_54731763

https://vk.com/topic-233841104_54059723

https://vk.com/topic-233841108_54550905

https://vk.com/topic-233841103_54357993

https://vk.com/topic-233841101_55622262

https://vk.com/topic-233841107_55344684

https://vk.com/topic-233841099_54771572

https://vk.com/topic-233841105_53945067

https://vk.com/topic-233841100_55144584

https://vk.com/topic-233841106_54431409

https://vk.com/topic-233841102_54731762

https://vk.com/topic-233841104_54059722

https://vk.com/topic-233841108_54550904

https://vk.com/topic-233841103_54357992

https://vk.com/topic-233841101_55622261

https://vk.com/topic-233841107_55344683

https://vk.com/topic-233841099_54771571

https://vk.com/topic-233841105_53945066

https://vk.com/topic-233841100_55144583

https://vk.com/topic-233841106_54431408

https://vk.com/topic-233841102_54731761

https://vk.com/topic-233841104_54059721

https://vk.com/topic-233841108_54550903

https://vk.com/topic-233841103_54357991

https://vk.com/topic-233841101_55622260

https://vk.com/topic-233841107_55344682

https://vk.com/topic-233841099_54771569

https://vk.com/topic-233841105_53945065

https://vk.com/topic-233841100_55144582

https://vk.com/topic-233841106_54431407

https://vk.com/topic-233841102_54731760

https://vk.com/topic-233841104_54059719

https://vk.com/topic-233841108_54550902

https://vk.com/topic-233841101_55622259

https://vk.com/topic-233841103_54357990

https://vk.com/topic-233841107_55344680

https://vk.com/topic-233841099_54771568

https://vk.com/topic-233841105_53945064

https://vk.com/topic-233841100_55144581

https://vk.com/topic-233841106_54431406

https://vk.com/topic-233841102_54731759

https://vk.com/topic-233841104_54059718

https://vk.com/topic-233841108_54550901

https://vk.com/topic-233841101_55622258

https://vk.com/topic-233841103_54357989

https://vk.com/topic-233841107_55344679

https://vk.com/topic-233841099_54771567


几个容易踩的坑延迟指标一定要看 p50/p90/p95,别只盯平均值。真正的问题都藏在 tail 里。API 层面最好把 shape 和 dtype 固定下来,或者至少让调用方知道优化过的范围。这样生产请求才能稳定落在最优路径上。


开了融合或量化之后,精度的自动化回归测试必不可少。


总结低延迟不靠黑科技就是一堆小优化叠起来:形状固定、减少拷贝、更好的 kernel、graph capture、运行时零意外。每个单拎出来可能只省几毫秒,但加起来用户就能感受到"快"。

用户头像

郝培强

关注

还未添加个人签名 2025-11-19 加入

还未添加个人简介

评论

发布
暂无评论
TensorRT 和 ONNX Runtime 推理优化实战:10 个降低延迟的工程技巧_郝培强_InfoQ写作社区