RiptideRiptide
Download Riptide SDKInstall Riptorch
Menu
Whitepapers · Riptide · Exact integers on GPUs

Exact int8 CNNs on GPU tensor cores

A quantized CNN is integer arithmetic from the input bytes to the logits, so it has one exact answer. Vendor inference engines give a different answer on each GPU. This paper measures an engine that runs the same integer pipeline on the integer tensor cores of three NVIDIA generations, gives bit-identical outputs everywhere, and gets within reach of TensorRT at large batch.

Version
1.1 (updated 1 December 2026: limitations section retitled)
Date
1 December 2026
Author
Samario Torres, Riptide
Software
Riptide's GPU kernels (not published), compiled at run time with NVRTC 12.8 (CuPy 14.2); TensorRT 10.16.1; PyTorch 2.9.1+cu128 (cuDNN, torch.compile); ONNX Runtime 1.22.0 (CUDA 12 build); NVIDIA drivers 595.112.07 (RunPod) and 620.70.06 (AWS)
Download PDFOpen in new tabriptidecompute.com/whitepapers/exact-int8-cnns-tensor-cores

Abstract

The exact int8 engine of the previous paper (Exact integer filters for images, audio and quantized CNNs) runs a post-training-quantized ResNet-18 and MobileNetV2 with integer arithmetic only and gives the same logits on Intel, AMD and Arm CPUs. Its GPU path was plain PyTorch integer operations and reached 1–3% of TensorRT int8's throughput. This paper replaces that path with convolution kernels on the GPUs' integer tensor cores: the warp-level matrix instruction on the RTX 4090 (Ada), the warpgroup instruction wgmma on the H100 (Hopper), and the fifth-generation tensor-core instruction tcgen05 on the B200 (Blackwell). Every operation keeps the CPU engine's integer definition, so the outputs are the same bits.

  • One answer everywhere. On all 3,925 Imagenette validation images, the uint8 logits and the int32 accumulators have the same SHA-256 on the RTX 4090, H100 and B200 as on the Xeon, EPYC and Graviton4 CPUs, for both models. TensorRT int8 gives a different answer on each GPU, and two different engine builds on the same GPU type gave different answers.
  • Speed at large batch. At batch 256 on the RTX 4090 the exact engine runs ResNet-18 at 51,261 images/s, 0.92× TensorRT int8 (55,630) and 1.10× TensorRT fp16; MobileNetV2 at 40,724 images/s, 0.73× TensorRT int8 and 1.17× TensorRT fp16. On the B200: 81,213 and 51,515 images/s, 0.57× and 0.69× TensorRT int8. TensorRT ran ONNX Runtime's own int8 quantization of the float models, which is more accurate on MobileNetV2 (77.3–77.5% top-1 against 73.2%), so it is not the identical quantized model.
  • TensorRT fp16 beats TensorRT int8 on the B200 in 7 of 8 model × batch cases (ResNet-18 at batch 256: 159,776 vs 142,455 images/s), and on the H100 for ResNet-18 at every batch size.
  • Blackwell's tensor-core instruction helps the large layers. On the same B200, allowing the tcgen05 kernels raised ResNet-18 at batch 256 from 71,427 to 81,213 images/s (+14%), with identical outputs.
  • Where it is behind. At batch 1 and 8 TensorRT int8 is 1.2–5.3× faster on every GPU in the reported runs (on a second B200, MobileNetV2 at batch 1 and 8 was closer: 1.10× and 1.14×), and on the H100 the exact engine runs at 0.36–0.64× of TensorRT int8 at every batch size.

What this lets you do

  • Run an integer-only int8 CNN like the two tested here (ResNet-18, MobileNetV2, post-training quantized) on a GPU and get exactly the bits a CPU produces: a model validated on one machine gives the same predictions, scores and thresholds on another, with no tolerance to set.
  • Replace "close enough" checks between edge CPUs and data-centre GPUs with an equality check on a hash.
  • Keep most of TensorRT int8's large-batch throughput on an RTX 4090 while doing so (0.92× on ResNet-18, 0.73× on MobileNetV2 at batch 256), and run faster than TensorRT's float16 engine there.

Method

This section describes the method at the level of the algorithm; the kernels are not published. The integer pipeline is the one defined in the previous paper (after Jacob et al., 2018): uint8 activations, per-channel symmetric int8 weights, exact int32 accumulation, a bias pre-converted to int32 together with the input zero-point correction, requantization with a per-channel Q31 multiplier and a round-half-up right shift, residual additions with 20 extra fraction bits, and exact pooling. The GPU engine computes exactly those integers; what changes is how.

Convolutions as implicit matrix products on integer tensor cores

Each convolution is a matrix product where a row of is the image patch under one output pixel (NHWC layout, channels contiguous) and a column of is one filter. The patch matrix is never written to memory: each thread block gathers the rows it needs from the activation tensor straight into on-chip memory ("implicit GEMM", after Chetlur et al., 2014), loading channel runs of 16 bytes at a time, and the tensor cores multiply uint8 by int8 into int32 exactly. Three instruction families are used, all with the same integer result:

  • the warp-level mma instruction (uint8 × int8 → int32, 16 × 8 × 32 per instruction) on every GPU;
  • on Hopper, the asynchronous warpgroup instruction wgmma, which reads both operands from shared memory (64 × N × 32 per instruction);
  • on Blackwell, tcgen05.mma with the integer kind, issued by one thread, which accumulates into the SM's tensor memory (128 × N × 32 per instruction); a memory barrier signalled by the tensor core tells the block when a pipeline stage may be refilled, and the accumulator is read back from tensor memory row by row.

Depthwise convolutions (MobileNetV2) are not matrix products. They run on the CUDA cores, and the engine picks per layer between two exact kernels: one with the 4-way byte dot product dp4a, where byte permutes gather the activations of four taps of one channel into one 32-bit word (the weights are laid out that way in advance), so one instruction sums four taps; and one with plain byte multiply-adds.

Exactness bounds

Every sum stays in 32-bit integers, and a bound checked per layer when the model is loaded guarantees that it cannot overflow: for output channel , . The largest bound over all layers is for ResNet-18 and for MobileNetV2. A layer that failed the check would fall back to the first-version kernel with its requantization widened to 64 bits (its multiply sums stay 32-bit, so the check above is what guarantees exactness); no layer fails it.

Padding with the zero point, without padding

A quantized convolution pads with the input zero point , not with zero. The kernels load zeros for taps outside the image and add the correction to the output pixels at the border, which is exactly the sum the padded input would give. Interior pixels need no correction.

A first layer that fits the tensor cores

The first layer reads a 3-channel image, which leaves the channel runs only 3 bytes long. The image is padded (with ) and rearranged so that each 2 × 2 block of pixels becomes one pixel with 4 × 4 = 16 channels; a convolution with stride 2 then becomes a convolution with stride 1 on 16 channels, whose extra taps have zero weights. ResNet-18's 7 × 7 layer becomes 4 × 4, MobileNetV2's 3 × 3 becomes 2 × 2. The sums are the same integers. On the H100 this cut ResNet-18's first layer from 10.2 to 1.0 ms at batch 256.

Requantization in 32-bit integer arithmetic

The CPU engine's requantization is with . Because floor divisions by powers of two compose, , the GPU computes the same value with one 32 × 32 → 64-bit multiply-add, keeps the high word and shifts it by ; this is valid for , which is also checked per layer. For the residual addition, with its own shift , the term equals , so it too needs one widening multiply. Requantization, the ReLU6 clamp and the residual addition run in the epilogue of the convolution that produces their input, so those intermediate tensors are never written.

Split-K for small batches

At batch 1 the last layers have very few output pixels and leave most of the GPU idle. Those layers split the sum over across several thread blocks, which add their partial sums into an int32 buffer with atomic additions; a short second pass applies the epilogue. Integer addition is associative, so the result is exact and the same whatever order the additions happen in.

Choosing kernels by timing cannot change the answer

For every layer and batch size the engine runs each applicable kernel variant once to warm up, times 10 runs of it, and keeps the fastest; the whole network is then captured as a CUDA graph. Every variant computes the same integers, so the choice affects speed only. This is checked, not assumed: the test forces each variant onto every layer it can run and compares the outputs with the reference.

Setup

Machines

Table 1. Machines. A machine record and the full package list sit next to every result file.
machineGPUhostused for
RunPod secure cloudGeForce RTX 4090 (Ada, sm_89, 24 GB), driver 595.112.07container, CPU-quota limitedexact engine; TensorRT, PyTorch on a second RTX 4090 pod
RunPod secure cloudH100 SXM 80 GB HBM3 (Hopper, sm_90), driver 595.112.07containerexact engine (all kernel families), TensorRT, PyTorch on the same pod (ONNX Runtime could not use the GPU there)
AWS p6-b200.48xlarge (spot, us-east-1)8 × B200 (Blackwell, sm_100, 180 GB), driver 620.70.06Xeon Platinum 8559C, 192 vCPUexact engine on GPU 0; TensorRT, PyTorch, ONNX Runtime on GPUs 1–6 in parallel
RunPod secure cloudB200, driver 595.112.07containerrepeat of the exact engine (warp-level kernels) and all baselines

Exactness

The engine's outputs are checked three ways on every GPU. A smoke test runs 16 and 64 images through each kernel variant forced onto every layer it can run, and through the tuned, graph-captured engine three times with both host and device inputs, and compares every uint8 logit and int32 accumulator with a reference implementation of the CPU engine's arithmetic (PyTorch integer operations) on the same GPU: 166 checks on the RTX 4090, 254 on the H100, 206 on the B200 (with the tcgen05 variants), all exact. Then all 3,925 images run through the tuned engine and the SHA-256 of all logits is compared with the CPU engine's.

Baselines and timing

  • TensorRT 10.16.1, int8: ONNX Runtime's symmetric int8 static quantization (QDQ) of the same float models, calibrated on the same 512 images; explicit quantization, FP16 also allowed; one engine per batch size (fixed shapes), builder optimization level 5 on the AWS B200 (the B200 tables); level 3, with level 5 also at batch 1 and 256, on the H100 (where level-5 builds took 3–20 minutes) and on the RunPod B200 repeat, the faster being reported; on the RTX 4090 the run notes record level 5, but those rows do not carry the level field; timed plain and replayed from a CUDA graph, the faster is reported.
  • TensorRT fp16 on the float model, same settings. PyTorch fp16 on the float model (channels-last, cudnn.benchmark on), eager, eager in a CUDA graph, and torch.compile (max-autotune, no CUDA graphs) in a CUDA graph. ONNX Runtime CUDA execution provider with I/O binding (its CUDA-graph mode refused these models); it ran on the B200 (version 1.22.0, a CUDA 12 build). On the RTX 4090 and H100 pods version 1.32 was installed, which needs CUDA 13, and it could not use the GPU there, so those tables have no ONNX Runtime column.
  • Timing: CUDA events around one forward pass with the input already on the GPU, up to 200 repetitions, stopping early after 4 s once at least 20 are done, the best is reported and every raw time is kept; images/s = batch / best time.
  • The exact engine's kernels are compiled at run time; compilation (40 s to 26 minutes, depending on the host CPU) and per-layer tuning are not in the timings, as TensorRT's engine build is not.

Data

torchvision ResNet-18 and MobileNetV2 (IMAGENET1K_V1), PyTorch FX post-training quantization with the x86 qconfig mapping (per-channel symmetric int8 weights, uint8 activations), calibrated on 512 Imagenette training images; evaluation on Imagenette validation (3,925 ImageNet validation images of 10 classes, 1,000-way top-1). The same inputs, quantized model and hashes as the previous paper.

Results

One answer on three GPUs and three CPUs

Table 2. SHA-256 (first 8 hex digits) of all 3,925 × 1,000 uint8 logits and of the int32 accumulators of the last layer. CPU hashes from the previous paper.
engineXeon 8488C, EPYC 9R14, Graviton4RTX 4090H100B200
Riptide exact, ResNet-18 (uint8 / int32)dd156679 / 3e9a2b27samesamesame
Riptide exact, MobileNetV2 (uint8 / int32)17b6f433 / 756ec6acsamesamesame
TensorRT int8, ResNet-18(GPU only)56ae53eec436b3e2482335d4
TensorRT int8, MobileNetV2(GPU only)b040dc214fe7870007d383ee

TensorRT int8 repeats itself on one GPU (a second pass over all images gave the same hash on every GPU), but each GPU gives a different answer, and its top-1 accuracy moves with it: ResNet-18 78.7% on the RTX 4090 and 79.0% on the H100 and B200, MobileNetV2 76.5%, 77.5% and 77.3%. Different engine builds on one GPU type also gave different answers: the RTX 4090 hash with the fixed-shape engines here (56ae53ee) differs from the one with a dynamic-shape engine in the previous paper (42237423), and two H100 builds of MobileNetV2 gave dfb2fb13 and 4fe78700. TensorRT chooses kernels by timing, so the builds alone, not a particular setting, are shown to differ; on the B200, levels 3 and 5 gave the same hash. PyTorch's fp16 engine gave two different MobileNetV2 answers on two B200 machines (0b0b20e3 and a5a8d352). The exact engine's top-1 is 79.0% (ResNet-18) and 73.2% (MobileNetV2) everywhere, within 0.4 points of the stock quantized model in PyTorch (fbgemm: 79.2% and 72.8%). TensorRT's MobileNetV2 is more accurate (76.5–77.5%) because it runs ONNX Runtime's QDQ quantization of the float model, not the same quantized model: keep that in mind when reading the speed tables below.

Speed against TensorRT

Two panels of the exact engine's throughput divided by TensorRT int8's, against batch size 1 to 256, for RTX 4090, H100 and B200; every point is below the 1x line, the RTX 4090 line climbs from about 0.2x to 0.92x on ResNet-18 and 0.73x on MobileNetV2
Figure 1. Throughput of the exact engine relative to TensorRT int8 on the same GPU type, per batch size (tables below).
Table 3. Images per second (best time), RTX 4090. TensorRT and PyTorch ran on a second RTX 4090 pod of the same type.
modelbatchexact engineTensorRT int8ratioTensorRT fp16torch.compile fp16
ResNet-1811,9269,0660.21×7,5895,307
ResNet-18813,35540,3100.33×34,56921,779
ResNet-186441,75557,2870.73×46,95726,801
ResNet-1825651,26155,6300.92×46,46025,592
MobileNetV211,4267,5700.19×8,4304,987
MobileNetV289,20340,6900.23×37,38024,890
MobileNetV26430,07779,4190.38×44,32630,804
MobileNetV225640,72456,1420.73×34,78123,846
Table 4. Images per second (best time), H100 SXM, all on one pod.
modelbatchexact engineTensorRT int8ratioTensorRT fp16torch.compile fp16
ResNet-1814,0406,6630.61×7,0295,335
ResNet-18819,41034,0000.57×36,72230,117
ResNet-186449,83681,5390.61×86,33365,058
ResNet-1825663,13299,2990.64×108,71875,655
MobileNetV212,8465,1750.55×5,6724,307
MobileNetV2814,45830,4660.47×27,23021,483
MobileNetV26433,95681,5730.42×60,95543,805
MobileNetV225640,652111,5960.36×70,98848,759

TensorRT int8 on the H100 ran at level 3 at batch 8 and 64, and its best MobileNetV2 figure here (111,596 images/s) is below the 119,209 a dynamic-shape engine reached in the previous paper; against that figure the exact engine's ratio at batch 256 would be 0.34× rather than 0.36×. On the H100, TensorRT fp16 is faster than TensorRT int8 for ResNet-18 at every batch size (108,718 vs 99,299 images/s at batch 256) and for MobileNetV2 at batch 1; ONNX Runtime's GPU build there required CUDA 13 and could not run.

Table 5. Images per second (best time), B200, all on one 8-GPU machine (exact engine on GPU 0 with the tcgen05 kernels allowed; baselines on GPUs 1–6).
modelbatchexact engineTensorRT int8ratioTensorRT fp16torch.compile fp16ONNX Runtime int8
ResNet-1814,3108,2110.52×7,6465,820916
ResNet-18824,43644,7950.55×45,97336,2216,342
ResNet-186459,746112,6190.53×126,63899,39417,179
ResNet-1825681,213142,4550.57×159,776130,54819,437
MobileNetV213,2803,8910.84×6,3134,567490
MobileNetV2814,49622,0010.66×34,78022,7734,416
MobileNetV26443,09357,7200.75×75,98252,37411,631
MobileNetV225651,51574,8940.69×89,75460,67313,182

On the B200, TensorRT's fp16 engine on the float model is faster than its int8 engine on the quantized model in 7 of the 8 model × batch cases (ResNet-18 at batch 256: 159,776 vs 142,455 images/s; MobileNetV2: 89,754 vs 74,894; MobileNetV2 at batch 1: 6,313 vs 3,891); only ResNet-18 at batch 1 is faster in int8 (8,211 vs 7,646). The same held on a second B200 machine (RunPod): 160,494 vs 144,464 images/s for ResNet-18 at batch 256.

What each tensor-core generation added

Table 6. Exact engine, images per second at batch 256, by the kernel families the engine may choose from. Same outputs in every row.
GPUkernels allowedResNet-18MobileNetV2
RTX 4090first version (warp-level, fixed tiles)19,44817,275
RTX 4090warp-level, all variants, split-K51,26140,724
H100first version14,67515,738
H100warp-level, wgmma, split-K63,13240,652
B200warp-level, split-K71,42751,585
B200+ tcgen0581,21351,515

On the B200 the tuner put 13 of ResNet-18's 21 convolution layers on tcgen05 at batch 256 and 9 at batch 64, and none at batch 1 and 8, where split-K warp-level kernels are faster. MobileNetV2 used tcgen05 on 7 layers at batch 8 and on 1 at batch 256; most of its 1 × 1 and depthwise layers stayed on the warp-level and CUDA-core kernels, because their time goes to the epilogue and memory traffic, not to the multiplications, and its throughput did not change. On the H100 most large layers chose wgmma.

Limitations and next steps

The limits of these results, each with its cause and, where one is planned, the next step.

  • Batch 1 and 8: TensorRT int8 is 1.2–5.3× faster on every GPU in the reported runs (RTX 4090 0.19–0.33×, H100 0.47–0.61×, B200 0.52–0.84×). Cause: under investigation. At batch 1 the engine runs one kernel per layer (24 for ResNet-18, 55 for MobileNetV2, plus the split-K passes), and no single layer dominates its time: on the H100 the slowest ResNet-18 layer takes 0.032 ms of a 0.248 ms forward pass.
  • MobileNetV2 at batch 64 on the RTX 4090: 0.38× TensorRT int8. Cause: under investigation. The engine's time there is spent in the 1 × 1 expansion layers with 16–24 input channels and in the depthwise layers, both limited by writing and reading full activation tensors between layers; TensorRT's per-layer breakdown was not measured.
  • The H100 at 0.36–0.64× and the B200 at 0.53–0.57× (ResNet-18) at large batch. Cause: under investigation. The Hopper and Blackwell kernels load operands with per-thread asynchronous copies and wait for each tensor-core step before refilling its buffer; they do not yet use the tensor memory accelerator (TMA), warp-specialized producer and consumer roles or the two-SM tcgen05 mode, the techniques NVIDIA documents for keeping these tensor cores fed. The time also concentrates in the layers with the largest activations: on the B200 at batch 256 the first layer alone takes 0.61 ms of the 3.55 ms that ResNet-18's layers take when timed one by one.
  • The first layer and max pooling are separate passes. Cause: max pooling reads windows that cross the convolution's output tiles, so fusing it needs overlapping tiles; not done yet.

Reproduction notes

  • Software. The GPU kernels and engine are a Riptide prototype and are not published. Evaluation builds are available through Request an evaluation.
  • Records. Every benchmark row with all raw times, every exactness check, the hashes of all logits, a machine record and package list per machine, and the logs of every run, including the runs that found bugs (a stream race in the first CUDA-graph version, which the smoke test now covers). Evaluation partners can have the raw files on request.
  • Cost. About $27 of rented GPU time: about $14.5 on RunPod (RTX 4090, H100, B200) and $12.28 for 10.3 minutes of an 8 × B200 spot machine on AWS.

References

  • Jacob et al., Quantization and training of neural networks for efficient integer-arithmetic-only inference, CVPR 2018.
  • He, Zhang, Ren and Sun, Deep residual learning for image recognition (ResNet), CVPR 2016.
  • Sandler et al., MobileNetV2: inverted residuals and linear bottlenecks, CVPR 2018.
  • Chetlur et al., cuDNN: efficient primitives for deep learning, arXiv:1410.0759, 2014 (implicit-GEMM convolution).
  • NVIDIA, PTX ISA (warp-level mma, wgmma, tcgen05 instructions), version 8.7 and later; TensorRT 10 developer guide.
  • Howard, Imagenette, fast.ai, 2019.
  • Riptide, Exact integer filters for images, audio and quantized CNNs, December 2026 (the CPU engine and the integer pipeline).

Date and version

Version 1.1, 1 December 2026. Measurements from 1 December 2026. Updated 1 December 2026: limitations section retitled.

Working with Riptide

Riptide works with a small number of teams. Each engagement starts with 4 weeks inside your systems, learning how your models, data and infrastructure work. Only then does Riptide apply its software to them. Contact samario@riptidecompute.com or riptidecompute.com/evaluate.