﻿# ONNX CUDA native GGUF weights: avoiding repack does not mean executing from host shards

Native GGUF layouts in CUDA plugin v0.4.0 still require GPU copies and storage; host zero-copy loading and device execution are different stages.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-engine-ort-native-gguf-not-host-zero-copy/
Language: en

CUDA Plugin EP v0.4.0 adds operators consuming native block-packed weights. PR #33953 explicitly separates reduced host copies from CUDA execution: CPU-backed weights still move into device memory and require device storage. “Native layout” therefore describes representation, not an automatic zero-copy GPU path from a memory-mapped GGUF shard.

## Zero-copy needs a named boundary

A host loader can borrow an external initializer buffer without copying it into another host allocation. That says nothing by itself about the subsequent CPU-to-GPU transfer. The PR states this distinction directly. A proposed memory trace should identify source mapping, borrowed host tensor and device allocation separately. Otherwise eliminating one host copy can be misreported as eliminating every copy in the model-loading pipeline.

## Native packing can still reduce preparation work

Consuming the stored block layout avoids a separate offline repacking step for the supported operators. This can simplify artifact preparation while leaving device capacity requirements intact. Measure loading time and host peak memory independently from steady-state GPU memory. A smaller preparation footprint is useful evidence, but should not be converted into a claim that a model exceeding VRAM now executes directly from arbitrary host-backed pages.

## External-buffer lifetime remains necessary

If a loader borrows host storage, that storage must satisfy its ownership and alignment contract for as long as it is needed. Releasing or mutating a mapped source too early can invalidate preparation even though the final execution uses device memory. A qualification should include the actual initializer API and lifecycle, not only a synthetic in-memory tensor. Preserve source-file identity and loading options with the result.

## Report representation and residency separately

A useful benchmark record states the packed format, host loading route and final device placement. Those three fields prevent a native-layout feature from becoming an unsupported memory claim. This article reports the release capability and the explicit transfer limitation without new measurements. Models using a separate hybrid expert-offload feature need that feature’s own admission and memory evidence, rather than borrowing a zero-copy interpretation from this operator addition.

## Sources

- [ONNX Runtime plugin-ep-cuda/v0.4.0 release](https://github.com/microsoft/onnxruntime/releases/tag/plugin-ep-cuda/v0.4.0)
- [ONNX Runtime pull request #33953](https://github.com/microsoft/onnxruntime/pull/33953)

## Related reading

- [ONNX external data: release the graph and relative tensor files together](/journal/fg2-onnx-external-data-relative-artifact-release/)
- [CUDA Out of Memory While Loading a Model: A Check Order](/journal/cuda-oom-model-loading/)
