Doca Compress
NVIDIAOfficialCreated by NVIDIA
- Skill
- Tool integration
- Software development
- Apache-2.0
- Medium risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides guidance for developers integrating the NVIDIA DOCA Compress library into applications to offload bulk DEFLATE compression/decompression and LZ4 decompression tasks. It covers the lifecycle of a doca_compress context, capability discovery for specific hardware, buffer management, and error handling. It is designed for developers working on Linux systems with a compatible NVIDIA DPU or NIC, focusing on when to use hardware offload versus CPU-based compression.
What it does
- Configures and manages doca_compress contexts for DEFLATE and LZ4 tasks.
- Provides capability discovery to check supported tasks and buffer size limits on specific hardware.
- Guides developers on setting correct mmap permissions for source and destination buffers.
- Assists in debugging DOCA_ERROR_* codes related to compression tasks.
- Implements path-selection logic to decide between hardware offload and CPU-based compression.
- Facilitates round-trip smoke testing to validate compression and decompression workflows.
When to use it
- When implementing bulk DEFLATE compression or decompression on BlueField DPUs or ConnectX NICs.
- When you need to decompress LZ4 streams or blocks using hardware acceleration.
- When troubleshooting performance or configuration issues with DOCA Compress tasks.
- When determining if a specific data workload is large enough to benefit from hardware offload.
- When integrating DOCA Compress into C/C++ applications or building language-specific bindings.
Advantages
- Reduces CPU overhead by offloading intensive compression tasks to dedicated hardware.
- Provides clear guidance on hardware-specific capability and buffer size constraints.
- Standardizes error handling and debugging procedures for DOCA Compress.
- Ensures efficient memory management through proper mmap and buffer sizing practices.
Usage examples
- “Should I offload a 4 MiB log buffer compression to DOCA Compress or use zlib on the CPU?”
- The agent will evaluate the size-threshold rule to determine if the data volume justifies the DMA-to-accelerator overhead compared to CPU-based processing.
- “My doca_compress_task_compress_deflate returns DOCA_ERROR_NOT_PERMITTED.”
- The agent will guide you through the mmap permission checklist to ensure source and destination buffers are correctly configured for the hardware.
- “How do I check if my BlueField DPU supports decompressing LZ4 streams?”
- The agent will direct you to use the per-task capability-query functions to verify support on your specific device.
- “I need to decompress incoming network data; do I need to enable the compress task?”
- The agent will confirm that decompression-only workflows are valid and explain how to configure the context for that specific requirement.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/nvidia/doca-compress/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip doca-compress.zip -d .agents/skills
Documentation by NVIDIA
DOCA Compress
Examples
"Offload this gzip on the BlueField." — this is in scope if the codec is DEFLATE (or LZ4 decompress). Do not invent LZ4 encode or zstd offload.
"Compress task returns INVALID_VALUE on alloc_init." — size the
doca_bufagainst the per-task cap query before changing the algorithm.
Instructions
Follow Loading order below. Open the tasks companion for configure / test / debug. Open the capabilities companion for codec support and buffer-size policy. Do not open every companion file.
Where to start: This skill assumes DOCA is already installed and
the user is doing hands-on Compress work (bulk DEFLATE
compression or decompression) on a BlueField / ConnectX / host
with DOCA. Open the tasks companion if the user wants to do
something (configure / build / modify / run / test / debug); open
the capabilities companion when the question is what can
DOCA Compress express on this version. If the user has not
installed DOCA yet, route to
doca-setup/SKILL.md first. If the user is
asking "should I even offload this compression to the
accelerator?", the size-threshold path-selection rule in
Capabilities and modes
is the first stop — bulk compress is the canonical fit, tiny one-shot is not.
Example questions this skill answers well
The CLASSES of DOCA Compress questions this skill is built to answer, each with one worked example. The agent should treat the class as the load-bearing piece — the worked example is a single instance.
"Should I offload this compression to DOCA Compress, or just zlib/zstd on the CPU?" — worked example: "I am compressing a 4 MiB log buffer before writing it to storage; is doca-compress worth the setup vs zlib on the CPU?". Answered by the size-threshold path-selection rule in
Capabilities and modes
the "when NOT to use doca-compress" bullets in
Safety policy.
"Does my device support the compress (or decompress) task I want, and how big a buffer can it move per submission?" — worked example: "is
doca_compress_task_compress_deflateon this BlueField, and what is the max source size per task?". Answered by the per-task capability-query rule (doca_compress_cap_task_compress_deflate_is_supported,_decompress_deflate_is_supported, the matching_get_max_buf_sizequeries) inCapabilities and modes
the discovery step in
configure.
"I just need to decompress incoming network data — is that a valid standalone use of doca-compress?" — worked example: "my client receives DEFLATE-compressed payloads and never produces any compressed output of its own". Answered by the "decompression-only" note in
Capabilities and modes
task-type table + the per-task configuration matrix in
configure step 5.
"What permissions does the source / destination mmap need?" — worked example: "my
doca_compress_task_compress_deflatereturnsDOCA_ERROR_NOT_PERMITTED". Answered by the permission matrix inSafety policy
the mmap-set-permissions checklist in
test.
"Is this DOCA Compress API available on my installed DOCA version?" — worked example: "is
doca_compress_task_decompress_deflatein the DOCA I have installed?". Answered by the version-compatibility overlay inVersion compatibility,
which cross-links the canonical detection chain in
doca-version/SKILL.mdand adds the Compress-specific "discover per-task support, do not assume" bullets."What does this
DOCA_ERROR_*from a Compress call mean and which layer caused it?" — worked example: "DOCA_ERROR_INVALID_VALUEondoca_compress_task_compress_deflate_alloc_init". Answered by the Compress overlay on the cross-library taxonomy inError taxonomy
the layered ladder in
debug that escalates to
doca-debug/SKILL.md.
Audience
This skill serves external developers building applications that
consume the DOCA Compress library — i.e., users whose code calls
doca_compress_* (directly in C/C++, or through FFI/bindings from
another language) to offload bulk DEFLATE compression or
decompression onto a BlueField DPU or ConnectX accelerator. It is
not for NVIDIA developers contributing to DOCA Compress itself.
Language scope. DOCA Compress ships as a C library with
pkg-config module name doca-compress. The shipped samples are
written in C. C and C++ consumers are the canonical case and the
worked examples in the tasks companion assume that path. Other-language
consumers (Rust, Go, Python, …) consume the same *.so through
FFI or language-specific bindings; the skill's contribution in
that case is to keep the lifecycle, capability-discovery,
permission, error-taxonomy, and compress-vs-decompress guidance
language-neutral, and to route the agent to the public C ABI as
the authoritative surface that any wrapper will eventually call.
When to load this skill
Load this skill when the user is doing hands-on DOCA Compress work, in any language. Concretely:
Initializing a
doca_compresscontext on adoca_devand configuring at least one task type (doca_compress_task_compress_deflateand/ordoca_compress_task_decompress_deflate) beforedoca_ctx_start().Choosing between the compress task and the decompress task for the user's data flow. The two task types are independent: a consumer that only decompresses inbound DEFLATE payloads is a valid shape and does not need to enable the compress task.
Setting permissions on
doca_mmapcorrectly for the source buffer (DOCA_ACCESS_FLAG_LOCAL_READ_ONLYat minimum) and the destination buffer (DOCA_ACCESS_FLAG_LOCAL_READ_WRITE).Sizing the source buffer against the per-task
doca_compress_cap_task_*_get_max_buf_size(devinfo)ceiling and the destination buffer against the worst-case output size the algorithm can produce on this input.Checking which task types this device's accelerator advertises via
doca_compress_cap_task_compress_deflate_is_supportedanddoca_compress_cap_task_decompress_deflate_is_supportedagainst the activedoca_devinfo.Validating against a round-trip (compress → decompress, or decompress → compare against a known DEFLATE-encoded fixture) before pushing bulk input through the accelerator.
Deciding whether to offload at all — the size-threshold rule in ## Capabilities and modes says doca-compress is the right answer only for bulk inputs (rule of thumb: ≥ a few KiB); below that, CPU compression beats the DMA-to-accelerator round-trip.
Debugging a
DOCA_ERROR_*returned from a Compress call (lifecycle vs. buffer-sizing vs. permission vs. unsupported-task) and the task-completion event on the progress engine.Designing or extending non-C bindings (Rust, Go, Python, …) that wrap the Compress C ABI — for the lifecycle, permission, capability, and compress-vs-decompress rules the wrapper must honor.
Do not load this skill for general DOCA orientation, install
of DOCA itself, non-DEFLATE compression libraries on CPU (use
zlib / zstd / similar), or other DOCA libraries. For those, use
doca-public-knowledge-map/SKILL.md.
What this skill provides
This is a thin loader. The body keeps only the orientation needed to pick the right next file. The substantive Compress-specific material lives in two companion files:
the capabilities companion — what DOCA Compress can express on this version: the four task types (compress-deflate, decompress-deflate, decompress-lz4-stream, and decompress-lz4-block, each independently capability-gated), the per-task capability-query surface (
doca_compress_cap_*for task support and per-submission max buffer size), the Compress error taxonomy (mapped onto the cross-libraryDOCA_ERROR_*set), the observability surface (per-task completion events on the progress engine), the safety policy that gates source / destination mmap permission decisions, and the size-threshold path-selection rule (when to use doca-compress versus CPU compression ordoca-dmafor the no-compression copy case).the tasks companion — step-by-step workflows for the six in-scope Compress verbs:
configure,build,modify,run,test,debug. Plus a## rollbackoverlay (Compress-specific five-step teardown that drains in-flight tasks beforedoca_ctx_stop, unregisters mmap regions in reverse-register order, and re-verifies the device path with the round-trip smoke) and the 5-phase universal debug-loop instantiation appended to## debug. Plus aDeferred task verbsblock that points out-of-scope questions at the right next skill.
The skill assumes a host or BlueField where DOCA is already
installed at the standard location and the user has the
privileges their public install profile expects. It does not
cover installing DOCA — that path goes through
doca-setup/SKILL.md.
What this skill deliberately does not ship
This skill is agent guidance, not a samples or templates bundle. To keep the boundary clean, it deliberately does not contain — and pull requests should not add:
Pre-written DOCA Compress application source code, in any language. The verified Compress source code is the shipped C samples at
/opt/mellanox/doca/samples/doca_compress/, plus the File Compression reference application linked from the public DOCA Compress guide. The agent's job is to route the user to those files and prescribe a minimum-diff modification on them via the universal modify-a-sample workflow indoca-programming-guide/SKILL.md, layered with the Compress-specific overrides inmodify.
Pre-encoded DEFLATE fixtures for arbitrary inputs. The skill tells the agent to use a round-trip validation (compress → decompress and compare to the original, or decompress a known DEFLATE blob produced by a published CPU encoder like
zlib) as the known-good smoke; it does not ship a fixture bank of its own.Standalone build manifests (
meson.build,CMakeLists.txt,Cargo.toml, …) parked inside the skill. The agent constructs the build manifest in the user's project directory against the user's installed DOCA, wherepkg-config --modversion doca-compressis the source of truth.A
samples/,bindings/, orreference/subtree of any kind. A mock or incomplete artifact in this skill's tree, even one labeled "reference", is misleading: users will read it as buildable.
Loading order
Read this skill first to confirm the user's question is in scope.
For the Compress capability matrix, the compress / decompress task split (including decompression-only as a standalone shape), per-task capability-query rules, permission matrix, error taxonomy, observability, and safety / path-selection policy, see the capabilities companion.
For step-by-step workflows — configure, build, modify, run, test, debug — see the tasks companion.
Both companion files cross-link to each other,
doca-version/SKILL.md for the canonical
version-handling rules, and
doca-public-knowledge-map/SKILL.md
whenever the right answer is "look it up in the public docs or
the installed package layout" rather than "Compress-specific
guidance".
Related skills
doca-public-knowledge-map/SKILL.md— the routing table for every public DOCA documentation source and the on-disk layout of an installed DOCA package. The DOCA Compress page lives atdocs.nvidia.com/doca/sdk/DOCA-Compress/; the File Compression reference application is the canonical worked example.doca-setup/SKILL.md— env preparation, install verification, and the I have no install yet path with the public NGC DOCA container. This skill assumes its preconditions are satisfied.doca-version/SKILL.md— canonical DOCA version-handling rules. This skill's## Version compatibilitycross-links the four-way match rule and adds only the Compress-specific "discover per-task support + per-task max buffer size via cap query" overlay.doca-structured-tools-contract/SKILL.md— the bundle's structured-tools precedence rule (detect / prefer / fall back / report). The Command appendix in the tasks companion honors this contract.doca-programming-guide/SKILL.md— general DOCA programming patterns shared by every library: the canonicalpkg-config+ meson build pattern, the universal modify-a-shipped-sample first-app workflow, the universal lifecycle, the cross-libraryDOCA_ERROR_*taxonomy, and the program-side debug order. This skill layers Compress specifics on top.doca-dma/SKILL.md— the right library when the data flow is a pure mmap-to-mmap copy with no compression required. This skill's path-selection rule routes to DMA when Compress is not the answer (e.g. the user only wants to move bytes, not encode them).doca-debug/SKILL.md— the cross-cutting debug ladder (install / version / build / link / runtime / program / driver). Compress-specific debug (task-not-supported, source-buffer-too-large, destination-buffer-too-small) overlays on top of that ladder.
Files
- ATTRIBUTION.mdAdded by AutoGineer897 B
- BENCHMARK.md9.9 KiB
- CAPABILITIES.md24.2 KiB
- LICENSELicence file added by AutoGineer11.2 KiB
- SKILL.md14.5 KiB
- SKILLCARD.yaml2.6 KiB
- TASKS.md33.0 KiB
- evals/evals.json2.5 KiB
- skill-card.md4.5 KiB
- skill.oms.sig5.1 KiB
CAPABILITIES.md
DOCA Compress capabilities, version overlay, errors, observability, safety
Where to start: Pick the H2 anchor that matches your question (capabilities / version / errors / observability / safety) and read that section end-to-end. The tables in each section are the load-bearing content; the prose around them is interpretation.
Read this file when the loader sent you here from
SKILL.md. For the how of executing each pattern
(the verbs configure / build / modify / run / test / debug),
jump to TASKS.md. For the canonical DOCA
version-handling rules that this skill layers a Compress overlay
on top of, see doca-version/SKILL.md.
Pattern overview
Every DOCA Compress question this skill teaches resolves into one of FIVE patterns. The patterns are CLASSES — they apply across every Compress release and every BlueField / ConnectX device the accelerator runs on.
| Pattern | When it applies (class shape) | Where the substance lives |
|---|---|---|
| 1. Decide whether to offload | Compare the per-call setup cost of doca-compress against a CPU compressor (zlib / zstd) on the same input; choose offload only when the input is bulk (rule of thumb: ≥ a few KiB), repeated, or already pinned in doca_mmap memory | ## Capabilities and modes path-selection table + ## Safety policy "when NOT to use doca-compress" bullets |
| 2. Pick the task type(s) to enable | Compress task (doca_compress_task_compress_deflate) for outbound encoding; decompress task (doca_compress_task_decompress_deflate) for inbound decoding. Either is a valid standalone shape — a decompress-only consumer does NOT need to enable the compress task | ## Capabilities and modes compress-vs-decompress table + TASKS.md ## modify |
| 3. Discover capabilities | Query doca_compress_cap_task_*_is_supported and _get_max_buf_size per task type, against the active doca_devinfo BEFORE assuming the task is available or sizing buffers | ## Capabilities and modes capability-query rule + TASKS.md ## configure step 2 |
| 4. Honor source / destination permissions | Source mmap = DOCA_ACCESS_FLAG_LOCAL_READ_ONLY at minimum; destination mmap = DOCA_ACCESS_FLAG_LOCAL_READ_WRITE; both must be set BEFORE the first task submission | ## Safety policy permission matrix + TASKS.md ## test |
| 5. Diagnose a Compress error | Map symptom (DOCA_ERROR_BAD_STATE, _INVALID_VALUE, _NOT_SUPPORTED, _NOT_PERMITTED, _AGAIN, _DRIVER) to root cause — lifecycle, buffer sizing, task support, permission, queue pressure, or driver layer — without leaving the Compress layer prematurely | ## Error taxonomy + TASKS.md ## debug |
Two cross-cutting rules that apply to every pattern above:
Discover the version-installed surface, do not assume. Every pattern above gates on
pkg-config --modversion doca-compressand on thedoca_compress_cap_*capability queries against the activedoca_devinfo. Quoting a per-task max buffer size, or asserting either task type is universally available, without checking, is the most common hallucination failure mode.Validate against a round-trip BEFORE bulk. The cheapest way to confirm the configured Compress context produces a correct encoding is to compress a small fixed input and decompress the output on the accelerator (or against a published CPU encoder like
zlib), compare to the original byte-for-byte, before submitting any bulk user data. For decompression-only consumers, the equivalent smoke is to decompress a small fixture produced by a published CPU encoder.
Capabilities and modes
DOCA Compress is a DOCA Core Context. Every doca_compress
instance follows the universal cfg-create → cfg-set-* → init → start → use → stop → destroy lifecycle (see
doca-programming-guide CAPABILITIES.md ## Capabilities and modes (doca-programming-guide/CAPABILITIES.md#capabilities-and-modes)).
On top of that lifecycle, DOCA Compress layers its own task model:
DEFLATE encode and DEFLATE / LZ4 decode modes, each independently
capability-gated.
The task types. The agent must call the matching support, maximum-buffer-size, and (for LZ4) maximum-buffer-list-length queries before assuming a mode is available or sizing its input.
| Task type | Class shape | Notes |
|---|---|---|
doca_compress_task_compress_deflate | Take one source doca_buf (raw input) → produce one destination doca_buf (DEFLATE-encoded output) | DEFLATE is the most common compression algorithm (the same algorithm used by zlib and gzip). Asynchronous; completion arrives via doca_pe_progress. Source must be ≤ doca_compress_cap_task_compress_deflate_get_max_buf_size(devinfo); destination must be sized for the worst-case compressed output (a poorly-compressible input can produce slightly more bytes than the input). |
doca_compress_task_decompress_deflate | Take one source doca_buf (DEFLATE-encoded input) → produce one destination doca_buf (decoded output) | Decompresses DEFLATE-encoded payloads. Valid as a standalone shape — a consumer that only decompresses inbound network data does NOT have to enable the compress task. Asynchronous; completion arrives via doca_pe_progress. Source must be ≤ doca_compress_cap_task_decompress_deflate_get_max_buf_size(devinfo); destination must be sized for the worst-case decompressed output the input could expand to. |
doca_compress_task_decompress_lz4_stream | Take LZ4 stream-format input and produce decoded output | Decode-only; independently gated by its matching support, maximum-buffer-size, and maximum-buffer-list-length queries. |
doca_compress_task_decompress_lz4_block | Take LZ4 block-format input and produce decoded output | Decode-only; independently gated from LZ4 stream and DEFLATE by its matching support, maximum-buffer-size, and maximum-buffer-list-length queries. |
Path selection — compress vs decompress, or both. Both task
types can coexist on the same context; enable at least one before
doca_ctx_start(). Enabling both is appropriate when the user is
running a round-trip (compress on the producer side, decompress on
the consumer side, same process or same machine); enabling only
one is the right shape for a one-direction pipeline.
| Path | What it is | Right shape for | Wrong shape for |
|---|---|---|---|
| Compress-only | Enable doca_compress_task_compress_deflate, leave decompress disabled | A producer / writer that emits DEFLATE-encoded output (e.g. compress-before-write storage daemon, compress-before-network sender, deduplication preprocessing) | A consumer that ONLY decodes inbound DEFLATE — enable the decompress task instead |
| Decompress-only | Enable doca_compress_task_decompress_deflate, leave compress disabled | A consumer / reader that decodes inbound DEFLATE-encoded data (e.g. decompress-on-read storage daemon, decompress-on-network receiver) — fully valid standalone shape | A producer that ONLY encodes outbound payloads — enable the compress task instead |
| Both | Enable both tasks on the same context | A round-trip flow (compress on one side, decompress on the other, same process) or a content-addressing pipeline that both encodes new blobs and decodes existing ones | Single-direction pipelines — keep the unused task disabled to keep the configuration surface small |
Path-selection — when to use DOCA Compress at all. The agent's rule:
Use doca-compress when the input is bulk (rule of thumb: ≥ a few KiB, with the canonical fit being inputs of file-size scale — typically ≥ 4 KiB and upwards), the throughput requirement is high enough that freeing the CPU for other work is valuable, or the input is already pinned in
doca_mmapmemory because another DOCA library produced it. File compression, deduplication preprocessing, and content-addressed storage prep are the canonical fits.Do NOT use doca-compress when the input is tiny one-shot (e.g. 64-byte buffers — the per-call DMA-to-accelerator setup cost dominates; CPU compression with zlib / zstd is faster); when the user needs outbound compression in an algorithm other than DEFLATE (use a CPU compression library — DOCA Compress exposes ONLY DEFLATE on the compress / encode side). However, DOCA Compress does support LZ4 decompress on the inbound / decode side, via two distinct task families (
doca_compress_task_decompress_lz4_streamanddoca_compress_task_decompress_lz4_block), each with its own_cap_task_decompress_lz4_{stream,block}_is_supported(devinfo)_get_max_buf_size+_get_max_buf_list_lenqueries (and corresponding shipped samples under/opt/mellanox/doca/samples/doca_compress/). Do NOT blanket- refuse LZ4 — only outbound LZ4 encode is out of scope. The rule of thumb is: DEFLATE both directions; LZ4 decompress only; everything else (zstd / Snappy / brotli / …) → CPU. When the user only wants to move bytes without encoding them, usedoca-dma/SKILL.md— pure mmap-to-mmap copy is DMA's job, not Compress's.
The size-threshold the cap query does NOT report. The
capability queries below report the per-task maximum input
size; they do NOT report the per-task minimum below which CPU
compression beats accelerator submission. That floor is
device-dependent and workload-dependent, and the agent must own
it as a path-selection rule rather than read it from the device.
A small smoke benchmark on representative inputs (CPU zlib
elapsed vs doca-compress elapsed end-to-end including
submit + progress + completion drain) is the only authoritative
answer for "is offload worth it for inputs of size N" on a
given host.
Capability discovery — the only rule. Before enabling either
task or sizing any buffer, call the matching doca_compress_cap_*
query against the active doca_devinfo:
| Capability | Query | Why the agent must ask |
|---|---|---|
| Compress-deflate task supported | doca_compress_cap_task_compress_deflate_is_supported(devinfo) | The compress task is not on every device; some accelerators ship decompress-only. If false, the device cannot encode in hardware; the user must fall back to CPU compression or pick a different device. |
| Decompress-deflate task supported | doca_compress_cap_task_decompress_deflate_is_supported(devinfo) | Symmetric to the above. Independent of the compress query; agent must not assume support for one implies the other. |
| Decompress-lz4-stream task supported | doca_compress_cap_task_decompress_lz4_stream_is_supported(devinfo) | The hardware does decompress LZ4 stream-format payloads. Independent of the DEFLATE queries. |
| Decompress-lz4-block task supported | doca_compress_cap_task_decompress_lz4_block_is_supported(devinfo) | The hardware also decompresses LZ4 block-format payloads. Independent of the LZ4-stream query and the DEFLATE queries. |
| Maximum source size, compress | doca_compress_cap_task_compress_deflate_get_max_buf_size(devinfo) | Device-bound ceiling on raw input size per compress submission. Inputs larger than this must be fragmented at the application layer; the library does not auto-chunk. |
| Maximum source size, decompress | doca_compress_cap_task_decompress_deflate_get_max_buf_size(devinfo), doca_compress_cap_task_decompress_lz4_stream_get_max_buf_size(devinfo), doca_compress_cap_task_decompress_lz4_block_get_max_buf_size(devinfo) (per algorithm) | Device-bound ceiling on compressed input size per decompress submission. The decompressed output can be substantially larger than this; the destination buffer sizing is the application's responsibility. |
Configuration shape. Mandatory configurations before
doca_ctx_start(): enable at least one source-verified task
configuration matching the selected DEFLATE encode, DEFLATE decode,
LZ4 stream decode, or LZ4 block decode mode, and set the matching
mmap permissions on both source and destination buffers per the
matrix in ## Safety policy. Optional
configurations (queue sizing, per-task set_conf callback
budget) use the standard DOCA Core set_* family with defaults
coming from the library; query the active capability values via
doca_compress_cap_*.
Version compatibility
For the canonical DOCA version-detection chain, the four-way match
rule, NGC container semantics, and the headers-win-over-docs rule,
see doca-version/SKILL.md. The body lives
there; this skill does not duplicate it.
The Compress-specific overlay is:
Per-task support is device-bound, not version-bound. The agent must not infer "DOCA version X includes the compress task and the decompress task" from release notes alone; the runtime authority is
doca_compress_cap_task_compress_deflate_is_supported(devinfo)and_decompress_deflate_is_supported(devinfo)against the active device. Per the cross-cutting cap-query rule indoca-version CAPABILITIES.md ## Observability(doca-version/CAPABILITIES.md#observability), the cap query is the runtime authority — never quote either task as available from agent memory.doca-compress.pcplusdoca-common.pcmust both matchdoca_caps --versionat the four-way-match check (perdoca-version CAPABILITIES.md ## Version compatibility(doca-version/CAPABILITIES.md#version-compatibility)). A common partial-install pattern on hosts where the Compress package was installed separately from the rest of DOCA is thatdoca-compress.pcreports release X whiledoca-common.pcreports release Y; route todoca-version TASKS.md ## debug(doca-version/TASKS.md#debug) layer 2 before any Compress-layer diagnosis.Per-task max buffer size is device-bound, not version-bound. The
_get_max_buf_sizequeries are the runtime authority; the matchingversion-matrix.jsonrow records the promise. If the two disagree, the cap-query value wins, per the headers-win-over-docs rule indoca-version/SKILL.md.
Error taxonomy
Compress-specific overlays on the cross-library DOCA_ERROR_*
taxonomy. The cross-library taxonomy itself lives in
doca-programming-guide CAPABILITIES.md ## Error taxonomy (doca-programming-guide/CAPABILITIES.md#error-taxonomy);
the rows below are the Compress surface meaning that the agent
must disambiguate before falling back to the cross-library
response.
| Error | Compress context where it shows up | Compress-specific cause |
|---|---|---|
DOCA_ERROR_BAD_STATE | Any call after doca_ctx_stop() or before doca_ctx_start(); destroying the source or destination doca_mmap before doca_ctx_destroy() | Lifecycle violation. Walk the call sequence against the lifecycle in doca-programming-guide CAPABILITIES.md ## Capabilities and modes (doca-programming-guide/CAPABILITIES.md#capabilities-and-modes); the most common case is releasing a source / destination mmap underneath a still-running context. |
DOCA_ERROR_INVALID_VALUE | doca_compress_task_compress_deflate_alloc_init; doca_compress_task_decompress_deflate_alloc_init; submit time | The source buffer is larger than the matching _get_max_buf_size for the task type, OR the destination buffer is too small for the worst-case output (compress: input that does not compress well can produce slightly more bytes than the input; decompress: output can be substantially larger than the compressed input). Re-run the matching cap query, then resize. |
DOCA_ERROR_NOT_SUPPORTED | doca_compress_task_*_set_conf; first submit | The requested task type is not available on this device's accelerator. Re-run the matching doca_compress_cap_task_*_is_supported(devinfo) query; if false, that is the answer — the user's device cannot offload this task type. Fall back to CPU compression or pick a different device. |
DOCA_ERROR_NOT_PERMITTED | First task submission | The source mmap does not have DOCA_ACCESS_FLAG_LOCAL_READ_ONLY (or a stronger flag that supersedes it), OR the destination mmap is missing DOCA_ACCESS_FLAG_LOCAL_READ_WRITE. Re-check the matrix in ## Safety policy. |
DOCA_ERROR_AGAIN | doca_task_submit on either Compress task type | The task queue is full. This is not a hardware error; the program must drain completions via doca_pe_progress() before re-submitting. Same as the cross-library "would-block, retry after progress" pattern. |
DOCA_ERROR_DRIVER | Any submit / completion call | The layer below DOCA reported failure (driver / firmware / accelerator). Capture state and route to env-class debug (doca-setup ## debug (doca-setup/TASKS.md#debug)) — the layer below DOCA is the suspect, not the Compress program. |
The agent's rule: never recommend a retry loop on DOCA_ERROR_*
without first identifying which of the rows above is the cause.
_AGAIN is the only one that wants a retry (after
doca_pe_progress()); the others want investigation, not retry.
Observability
DOCA Compress observability is event-driven, not poll-driven. Every submitted task produces a completion event on the DOCA Core progress engine; there are no Compress-specific counters the way Flow has per-pipe counters.
Three primary signals the agent should reach for:
Task completion events on the PE. Every submitted Compress task (compress or decompress) produces a completion event when it finishes (or errors). The completion carries the
doca_error_tif it failed AND the actual output size produced; the agent must inspect the per-task completion, not thedoca_task_submit()return value alone. Submitted but no completion is almost always a misseddoca_pe_progress()call in the user's main loop.Capability snapshot at configure time. The output of every
doca_compress_cap_*query is a snapshot of what the device's accelerator said was possible before any task was submitted. Save it as the baseline; if a task later returnsDOCA_ERROR_NOT_SUPPORTEDorDOCA_ERROR_INVALID_VALUEthe diff against this snapshot is the bug.Round-trip validation on a known input. The cheapest correctness signal is to compress a small fixed input and decompress the output (either on the accelerator if both tasks are enabled, or against a published CPU decoder like
zlib) and compare to the original byte-for-byte. If the round-trip does not match, the configuration is wrong; do not move on to bulk input. For decompression-only consumers, the equivalent smoke is decompressing a small DEFLATE blob produced by a published CPU encoder and comparing to the original input.
For cross-cutting observability primitives (--sdk-log-level,
the doca-<lib>-trace build flavor, the DOCA_LOG_LEVEL env
var) see
doca-debug CAPABILITIES.md ## Observability (doca-debug/CAPABILITIES.md#observability).
For the install-tree observability (logger names, package
layout) defer to
doca-public-knowledge-map/SKILL.md.
Safety policy
Overlay on the bundle-wide hardware-safety meta-policy. The rules below are this skill's per-artifact overlay on the cross-cutting rules in
doca-hardware-safetyCAPABILITIES.md ## Safety policy (doca-hardware-safety/CAPABILITIES.md#safety-policy) (specifically ### Per-artifact overlay pattern (doca-hardware-safety/CAPABILITIES.md#per-artifact-overlay-pattern)). When the two layers disagree, the stricter wins; when either layer says STOP, the agent stops.
DOCA Compress's safety surface is buffer-permission discipline plus path-selection discipline. The library reads from a source buffer and writes encoded (or decoded) output into a destination buffer; an incorrect permission flag on either side surfaces as a submit-time error rather than silent corruption — but only when the matrix is correct. The agent's job is to verify both permission and the should I use the accelerator at all question before any submission.
The permission matrix the agent must walk for any new Compress setup:
| Buffer | Minimum mmap permission | Class shape | Common over-broad mistake |
|---|---|---|---|
| Source (input) | DOCA_ACCESS_FLAG_LOCAL_READ_ONLY | The accelerator only needs to read the input; granting write is unnecessary and a small attack-surface widening | Granting DOCA_ACCESS_FLAG_LOCAL_READ_WRITE "to keep things simple" — works, but the read-only flag is the safe minimum |
| Destination (output) | DOCA_ACCESS_FLAG_LOCAL_READ_WRITE | The accelerator writes the encoded / decoded output; the application reads it back | Reusing the source doca_mmap as the destination — fails at submit if the mmap is read-only; if both buffers share an mmap, the mmap must be read-write |
Path-selection — when NOT to use doca-compress. Equally important:
Tiny one-shot inputs. A single 64-byte compress on the CPU is faster than the DMA-to-accelerator setup. The agent should recommend doca-compress only when the input is bulk (rule of thumb: ≥ a few KiB, typically ≥ 4 KiB and upwards) or repeated, or the input is already pinned in
doca_mmapmemory because another DOCA library produced it.Non-DEFLATE / non-LZ4 algorithm. The public task names commit doca-compress to DEFLATE (the same algorithm underlying zlib and gzip) on the encode side (
doca_compress_task_compress_deflate) and to DEFLATE + LZ4 stream / LZ4 block on the decode side (doca_compress_task_decompress_deflate,doca_compress_task_decompress_lz4_stream,doca_compress_task_decompress_lz4_block). If the user needs a different algorithm (zstd, Snappy, brotli, …, or LZ4 on the encode side), the answer is to use a CPU library that implements it, not to invent a DOCA workaround.Pure copy, no compression. If the user only wants to move bytes between two
doca_mmapregions without encoding them,doca-dma/SKILL.mdis the right library — its memcpy task is purpose-built for that pattern. Layering doca-compress on top wastes accelerator cycles on encoding output the user does not want.
The mmap must stay valid until the Compress context is
destroyed. Destroying either the source or destination mmap
before doca_ctx_destroy() is a use-after-free on the library's
bookkeeping; symptoms include DOCA_ERROR_BAD_STATE from
subsequent calls and undefined behavior on outstanding tasks.
Validate against a round-trip BEFORE bulk submission. A single round-trip smoke (compress one short input and decompress the output, or decompress a single small published DEFLATE fixture) catches algorithm mis-selection, endian assumptions, and buffer-sizing bugs before they corrupt a multi-GiB result.
Deferred topic boundaries
This skill scopes itself to the DOCA Compress library. Adjacent topics the agent will get asked but should route elsewhere:
General compression algorithm background (entropy coding, why DEFLATE produces sub-optimal ratios on already-compressed inputs, when zstd is preferred to gzip, compression-level trade-offs in CPU libraries) — outside this skill. Route to upstream zlib / DEFLATE specification documentation; this skill assumes the user already knows they want DEFLATE and is asking how to express it through the DOCA Compress API.
DOCA Core context and progress engine internals — owned by
doca-programming-guide/SKILL.md. This skill uses the Core context lifecycle; it does not redefine it.Cross-cutting
DOCA_ERROR_*taxonomy — owned bydoca-programming-guide CAPABILITIES.md ## Error taxonomy(doca-programming-guide/CAPABILITIES.md#error-taxonomy). This skill adds the Compress overlay, not the taxonomy itself.Pure mmap-to-mmap copies — owned by
doca-dma/SKILL.md. When the user wants bytes moved without encoding, DMA is the answer; Compress is not.Other DOCA accelerator libraries (DOCA SHA, DOCA AES-GCM, DOCA Erasure Coding, …) — separate libraries with their own skills. Path-selection guidance in
## Capabilities and modesnames them; the deep per-library substance lives in the matching skill.Cross-library
doca_capsinvocation patterns — owned by the cross-librarydoca-caps/SKILL.mdtool skill. This skill references the Compress capability query family (doca_compress_cap_*), which is per-library; the cross-library capability snapshot tool (doca_caps --list-devs) is a separate surface.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
The author says: Requires DOCA SDK installed at /opt/mellanox/doca on Linux (Ubuntu 22.04/24.04 or RHEL/SLES) with a BlueField DPU or ConnectX NIC attached. Reads the user's local install via `pkg-config doca-compress` and inspects /opt/mellanox/doca/{lib,include,samples,applications}. The validation steps require a live DOCA install.
Security
What our scanner noticed· Medium risk
- Large base64-encoded blobs
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- NVIDIA
- Publisher
- NVIDIA (Official)
- Source
- NVIDIA/skills · skills/doca-compress · commit fce3cca
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE-APACHE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by NVIDIA or NVIDIA.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download doca-compress.zip