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://mp-staging.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
TASKS.md
DOCA Compress workflows
Where to start: The verbs run configure → build → modify → run → test → debug. Skip ahead only when the user is already
past a verb. The ## test verb is an iterative loop (cap check →
permission cross-check → round-trip smoke → small-bulk → full-bulk
→ loop back if a task-type or buffer-sizing assumption changed),
not a one-shot pass — see the eval-loop overlay in ## test
below.
Read this file when the loader sent you here from
SKILL.md. For the underlying capability surface, the
compress-vs-decompress task split (including decompression-only
as a standalone shape), per-task capability-query rules, error
taxonomy, observability, and safety / path-selection policy, see
CAPABILITIES.md. For the cross-library DOCA
patterns layered under everything below (the universal lifecycle,
the cross-library DOCA_ERROR_* taxonomy, the
modify-a-shipped-sample workflow), see
doca-programming-guide/SKILL.md.
Each verb below describes the shape of the workflow, not a copy-paste recipe. The agent's job is to walk the user through the steps in order, verifying preconditions before recommending the next call.
configure
Goal: bring up a DOCA Compress context on a host or BlueField and confirm the device's accelerator supports the task type(s) the user actually intends to use, with buffer sizing that respects the per-task max.
Steps the agent should walk the user through:
Confirm the installed DOCA version. Use the procedure in
doca-version TASKS.md ## configure(doca-version/TASKS.md#configure). Quote the version observed (pkg-config --modversion doca-compress, thendoca_caps --version); do not assume "latest". The four-way match rule lives indoca-version CAPABILITIES.md ## Version compatibility(doca-version/CAPABILITIES.md#version-compatibility); if the observed sources disagree, route there before any Compress diagnosis.Discover the device capability surface for Compress. Run
doca_caps --list-devs(perdoca-caps/SKILL.md) to see which devices are visible, then run the per-doca_devinfodoca_compress_cap_*queries against the candidate device. Record the support and maximum-source-size result for every requested mode:doca_compress_cap_task_compress_deflate_is_supported(devinfo),doca_compress_cap_task_decompress_deflate_is_supported(devinfo),doca_compress_cap_task_decompress_lz4_stream_is_supported(devinfo),doca_compress_cap_task_decompress_lz4_block_is_supported(devinfo), and their matchingdoca_compress_cap_task_compress_deflate_get_max_buf_size(devinfo)/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)queries. For either LZ4 decode mode, also record its matching_get_max_buf_list_lenresult. Query only the modes the user intends to enable. The capability surface to compare against lives inCAPABILITIES.md ## Capabilities and modes.Decide whether to offload at all. Per the size-threshold path-selection bullets in
CAPABILITIES.md ## Safety policy, doca-compress is the right answer only when the input is bulk (rule of thumb: ≥ a few KiB), repeated, or already pinned indoca_mmapmemory. For a tiny one-shot input (e.g. a 64-byte buffer), recommend CPUzlib/zstd— do not invent a doca-compress use case the user did not ask for. For outbound encoding in a non-DEFLATE algorithm, doca-compress is not the answer. Inbound decode supports DEFLATE plus the independently gated LZ4 stream and LZ4 block modes.Pick the task type(s) to enable. DEFLATE compress (
doca_compress_task_compress_deflate) for outbound encoding; DEFLATE decompress (doca_compress_task_decompress_deflate), LZ4 stream decompress (doca_compress_task_decompress_lz4_stream), or LZ4 block decompress (doca_compress_task_decompress_lz4_block) for inbound decoding; both DEFLATE directions for a round-trip flow. A decompress-only consumer is a fully valid shape — do not auto-enable the compress task on a user who only described an inbound decoding need. The trade-off table lives inCAPABILITIES.md ## Capabilities and modes.Configure the Compress instance. Mandatory before
doca_ctx_start(): enable at least one task type (the matching task configuration for DEFLATE encode, DEFLATE decode, LZ4 stream decode, and/or LZ4 block decode, each with its success and error completion callbacks plus its max-num-tasks budget); set source mmap permissions (doca_mmap_set_permissionsto includeDOCA_ACCESS_FLAG_LOCAL_READ_ONLY); set destination mmap permissions (DOCA_ACCESS_FLAG_LOCAL_READ_WRITE); size the source buffer to ≤ the matching_get_max_buf_sizeand the destination buffer to the worst-case output size (a compress destination may need to be slightly larger than the source for poorly-compressible inputs; a decompress destination may need to be substantially larger than the compressed source). Per the matrix inCAPABILITIES.md ## Safety policy.Sanity check before any task submission. Confirm with the user: which task type(s), source-buffer size, destination-buffer size, and whether the intended source size is within the per-task
_get_max_buf_size(and, for LZ4, the matching maximum buffer-list length). Run a round-trip smoke for DEFLATE encode plus decode, or for a decode-only consumer use a known matching CPU-produced fixture in the exact requested format (DEFLATE, LZ4 stream, or LZ4 block) together with its retained original. Verify the decoded result matches that original byte-for-byte before any user data flows. If any step fails with aDOCA_ERROR_*, route through the error taxonomy inCAPABILITIES.md ## Error taxonomybefore retrying.
For the canonical DOCA universal lifecycle that underlies steps
4-6, see
doca-programming-guide TASKS.md ## configure (doca-programming-guide/TASKS.md#configure).
This skill adds the Compress overlay; do not re-explain the
lifecycle here.
build
Goal: produce a binary that links DOCA Compress against the user's installed DOCA, using the canonical cross-library build pattern.
The build pattern for any DOCA C/C++ consumer is identical
across libraries — pkg-config for include + link flags, meson
or CMake as the build system — and is fully documented in
doca-programming-guide TASKS.md ## build (doca-programming-guide/TASKS.md#build).
This skill carries only the Compress-specific overlay:
| Slot | Value for Compress | Why it matters |
|---|---|---|
pkg-config module name | doca-compress | The library's .pc file installed by the DOCA host packages. Wrong module name = pkg-config: Package 'doca-compress' was not found |
| Required runtime libs | libdoca-common, libdoca-compress, plus whatever pkg-config --libs doca-compress resolves transitively | Compress depends on Core; the link line should not pull in unrelated DOCA libraries |
| Header check | The public header that pkg-config --cflags for this artifact resolves to actually exists on disk at the path pkg-config reports (do not hardcode the include path) | If pkg-config --cflags doca-compress resolves but the include is missing, the install is partial — route to doca-version TASKS.md ## debug (doca-version/TASKS.md#debug) layer 2 |
| Minimum required DOCA version | Query with pkg-config --modversion doca-compress; never hardcode in build files | Cross-version build/runtime mixing breaks per CAPABILITIES.md ## Version compatibility |
For non-C consumers (Rust, Go, Python), the link surface is the
same *.so files; the FFI wrapper layer is the language-specific
binding and is out of scope for this skill — but the four slots
above are still the load-bearing inputs the wrapper needs.
modify
Goal: take a shipped DOCA Compress sample (or the File Compression reference application) as the verified starting point and apply a minimum-diff modification to express the user's intent.
The universal modify-a-shipped-sample workflow lives in
doca-programming-guide TASKS.md ## modify (doca-programming-guide/TASKS.md#modify).
Use it as-is. The Compress-specific overlay is the
modify-from-sample schema fill — the slots the agent must
elicit from the user before recommending any code-level edit:
| Slot | What the agent asks the user | Compress-specific consideration |
|---|---|---|
| 1. Starting sample | Which sample under /opt/mellanox/doca/samples/doca_compress/? Or the File Compression reference application under /opt/mellanox/doca/applications/? | Pick the closest in direction (compress vs decompress vs both) to the user's intent. Do NOT bridge across both directions — a smaller diff is always safer than a re-architecture; a decompress-only consumer should start from a decompress sample, not from a compress sample with the encoding ripped out |
| 2. Task type(s) added or removed | Which of the four task types? | Each enabled task needs its own doca_compress_task_*_set_conf call before doca_ctx_start(), plus its matching cap-query in ## configure step 2. A decompress-only consumer should remove the compress-task setup the sample wires up, not leave it dangling |
| 3. Buffer-size changes | Source or destination buffer size changing? | Source must be ≤ the matching _get_max_buf_size for the task type; destination must be sized 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). Over-broad permissions are a silent security regression |
| 4. Round-trip vs one-way pipeline | Is the user running a round-trip (compress → decompress in the same process) or a one-way pipeline (compress here, decompress elsewhere; or decompress only)? | Round-trip enables both tasks on the same context and round-trip-validates locally; one-way pipelines enable only the matching task and validate against a CPU reference (zlib for the missing side) |
| 5. Build manifest | Keep the sample's existing meson.build (which already wires pkg-config doca-compress)? | Yes. Do not switch to a hand-rolled Makefile for "simplicity" — it removes the version-check rail |
The agent emits an intent description + the filled slots; the
actual unified diff against the sample source is produced by
the user (this bundle has no diff renderer; see doca-programming-guide TASKS.md ## modify (doca-programming-guide/TASKS.md#modify)). The agent must walk the user through
the diff line-by-line against the sample source they read on
disk, and have the user paste back the result for validation.
run
Goal: actually execute the built binary against the user's installed DOCA on a host or BlueField, with a real input.
Steps the agent should walk the user through:
Confirm the device is reachable. Compress runs on a single side (no peer); the only env-side requirement is that the
doca_devthe binary opens corresponds to a device whose accelerator the user expects. Mismatcheddoca_devselection (opening a NIC without the requested Compress task on its accelerator) returnsDOCA_ERROR_NOT_SUPPORTEDat task submit, not at open. Re-quote the output ofdoca_caps --list-devs(doca-caps/SKILL.md) and confirm the device the binary opens is the same one the cap-query ran against.Run the round-trip (or decompress-known-fixture) smoke first. A binary that compresses one short input and decompresses the output, comparing to the original — or, for a decompress-only consumer, decompresses one small DEFLATE fixture produced by
zliband compares to the original — is the cheapest correctness signal. Do not bulk-encode or bulk-decode before this passes.Capture the structured log. Set
DOCA_LOG_LEVEL=tracefor the first run (seedoca-debug CAPABILITIES.md ## Observability(doca-debug/CAPABILITIES.md#observability)). This is the cheapest way to make the lifecycle and task-submit transitions visible on first failure.Capture the completion events on the PE. A run that produces no completion events but doesn't error is almost always a missed
doca_pe_progress()call. Confirm the progress engine is being driven on the main thread.
test
Goal: prove the configured Compress context can actually produce correct encoded / decoded output at the user's intended throughput, on the user's hardware, and that the task selection, buffer sizing, and permission set were right.
Performance harness routing. For throughput / latency measurement on the configured Compress context (or for cross-library comparison against the other DOCA crypto primitives), route the user to
doca-bench TASKS.md ## test(doca-bench/TASKS.md#test) —doca-benchis the cross-library performance harness with documented warm-up / steady-state / outlier semantics, and it explicitly supports Compress. The iteration loop below stays the correctness harness;doca-benchis the performance harness.
This is a loop, not a one-shot pass. Each iteration narrows either the task type, the buffer sizing, the permission set, or the path-selection assumption. The loop terminates when either (a) the user's intended workload produces correct output end-to-end with acceptable throughput, or (b) the agent has narrowed the failure cause to a layer outside DOCA Compress itself (driver / firmware / device) and escalated to the matching skill.
Iteration identity: compare the tuple of requested task / algorithm mode, support and max-size query results, mmap permission map, submitted/completed counts, and byte-comparison outcome. Two consecutive iterations with the same tuple are unchanged and trigger escalation; unchanged is never a green result.
Iteration shape:
Capability re-check. Re-run the exact support and
_get_max_buf_sizequeries selected in## configurefor DEFLATE encode, DEFLATE decode, LZ4 stream decode, and/or LZ4 block decode against the activedoca_devinfo; include the matching_get_max_buf_list_lenresult for LZ4. If any required task type returns false / unexpected → that's the answer; the user's device or DOCA version does not support the requested config. Update the intent or update the install.Permission cross-check. Compare the configured source + destination mmap permissions against the matrix in
CAPABILITIES.md ## Safety policy. Mismatches surface asDOCA_ERROR_NOT_PERMITTEDon the first task submission, not at configure time.Round-trip smoke (or decode-known-fixture smoke). Compress one short fixed input and decompress the output, comparing to the original byte-for-byte; OR, for a decode-only consumer, decode one known matching CPU-produced DEFLATE, LZ4 stream, or LZ4 block fixture and compare to its retained original byte-for-byte. If the comparison fails, the configuration is wrong — do not proceed to bulk input.
Completion drain. Confirm completion events arrive on the PE for every submitted task. Submitted but no completion is the most expensive class of bug to discover late; confirm it on the round-trip smoke before bulk submissions.
Small-bulk test. Submit a small series of tasks at sizes approaching the per-task
_get_max_buf_sizebut staying under it; verify the outputs decompress back to the inputs (round-trip) or match a CPU reference. Throughput numbers come from this step; correctness comes from step 3.Full-bulk run. Once the small-bulk passes, scale up to the user's intended size and submission rate. Watch for
DOCA_ERROR_AGAIN(drain the PE before retrying) and forDOCA_ERROR_INVALID_VALUE(a per-task source-size or destination-size boundary was crossed — re-narrow to the cap-query axis or to the worst-case-output-sizing axis).Negative test. Once the positive path works, intentionally request a task type the device should NOT support (per step 1), or submit a source buffer larger than
_get_max_buf_sizefor the configured task, and confirm the failure is the expectedDOCA_ERROR_NOT_SUPPORTED/DOCA_ERROR_INVALID_VALUE. This validates the agent's capability-discovery is itself correct.
Eval-loop overlay — why this is a loop, not a one-shot pass:
| Iteration trigger | What it looks like | What changes next iteration |
|---|---|---|
DOCA_ERROR_NOT_SUPPORTED on a task we expected to work | The doc page lists the task but the cap query returns false | The agent quoted the library surface; the device capability per doca_devinfo is the real gate. Re-narrow to the device-level query for the specific task type. |
DOCA_ERROR_INVALID_VALUE on first submit | Source buffer is larger than _get_max_buf_size for the task, OR destination buffer is too small for the worst-case output | Re-size the buffer using the cap-query output (source) or against a worst-case calculation (destination). The error is sizing-vs-cap mismatch, not corruption. |
| Round-trip smoke produces wrong output | Configuration accepted but the decompressed output does not match the original | Wrong task enabled (asked for decompress, configured compress), wrong buffer wired (source / destination swapped), or the smoke fixture is corrupt. Re-check the task type in the _alloc_init call and the source / destination buffer wiring before any other diagnosis. |
| Submitted task produces no completion | doca_task_submit() returned DOCA_SUCCESS; the PE produces nothing | The PE is not being progressed. Add a doca_pe_progress() call in the main loop. |
Bulk submit returns DOCA_ERROR_AGAIN | First N submissions succeed, then AGAIN | The task queue is full. Drain completions between bursts via doca_pe_progress(), or raise the configured queue depth at configure time. |
Smoke passes; small-bulk is slower than CPU zlib end-to-end | The per-call DMA-to-accelerator round-trip dominates per-input time at this size | Re-walk the size-threshold path-selection rule in CAPABILITIES.md ## Capabilities and modes. At small input sizes, CPU compression is the right answer; the cap query reports max input but not the min-input floor. |
Loop termination: stop iterating once two consecutive iterations
have the same task / algorithm mode, cap results, permission map,
submitted/completed counts, and byte-comparison outcome. That
unchanged identity means the cause is below DOCA Compress and is
never success. Escalate to
doca-debug TASKS.md ## debug (doca-debug/TASKS.md#debug)
with the captured cap-query snapshot + round-trip diff as
evidence.
debug
Goal: when a DOCA Compress call returns a DOCA_ERROR_* (or the
program produces no completion event), narrow the cause to a
specific layer and act on it.
The cross-library debug ladder lives in
doca-debug TASKS.md ## debug (doca-debug/TASKS.md#debug).
Walk through it in order — install → version → build → link →
runtime → program → driver — before recommending Compress-specific
fixes. This skill's overlay names the Compress-specific
manifestation at layers 5 (runtime) and 6 (program):
Layer 5 (runtime) — Compress overlay.
Walk the lifecycle: was the context started? Were the task(s) enabled before start (
doca_compress_task_*_set_confbeforedoca_ctx_start())? Submitting before the requested task is enabled returnsDOCA_ERROR_BAD_STATE, not a clear symptom.Confirm the PE is being progressed. No completion events is almost always a missing
doca_pe_progress()in the user's main loop.Confirm both the source mmap and the destination mmap are still alive at submit time. Destroying either before
doca_ctx_destroyis a use-after-free that surfaces asDOCA_ERROR_BAD_STATEfrom subsequent calls.
Layer 6 (program) — Compress overlay.
Buffer-sizing matrix: the most common Compress program-layer bugs are (a) a source buffer larger than the matching
_get_max_buf_sizefor the enabled task — surfaces asDOCA_ERROR_INVALID_VALUEat submit; fragment at the application layer — and (b) a destination buffer too small for the worst-case output. For compress, worst-case output can be slightly larger than the input on incompressible data; for decompress, the decompressed output can be substantially larger than the compressed input.Task-type drift: an
_alloc_initcall that asks for a task type the cap query returns false for returnsDOCA_ERROR_NOT_SUPPORTED. Re-run the matchingdoca_compress_cap_task_*_is_supportedagainst the activedoca_devinfo; do not assume from prior installs.Source / destination swap: a configuration that wires the encoded buffer as the source of a compress task (or the raw buffer as the source of a decompress task) will produce a completion that decodes back to garbage on round-trip. Walk the buffer wiring against the task direction in
CAPABILITIES.md ## Capabilities and modesbefore any other diagnosis.Round-trip mismatch: if the decompressed output is the wrong length, the task type is likely wrong (asked for compress, configured decompress, or vice versa). If the length is right but the bytes don't match the original, the source / destination wiring is wrong or the fixture used for the smoke is itself corrupt.
Once the layer is identified, route to the matching debug verb
on the matching skill: install / build / link / driver to
doca-setup ## debug (doca-setup/TASKS.md#debug); version
to doca-version ## debug (doca-version/TASKS.md#debug);
cross-cutting runtime to
doca-debug ## debug (doca-debug/TASKS.md#debug);
program-layer Core-context patterns to
doca-programming-guide TASKS.md ## debug (doca-programming-guide/TASKS.md#debug).
5-phase universal debug-loop instantiation (Compress). Layer
identification above is phase 1 of the
universal debug-loop contract (doca-debug/CAPABILITIES.md#universal-debug-loop-contract).
The agent MUST walk the remaining four phases on every Compress
debug answer before declaring done:
Layer identification — above (capability / lifecycle / data-path).
Triple capture (READ-ONLY). Capture (a) capability map:
doca_compress_cap_task_compress_deflate_is_supported(devinfo)doca_compress_cap_*max buffer / algorithm support on the actual devinfo, (b) submitted-task vs completed-task counters fromdoca_pe_progresscallback log, (c) DOCA log atDOCA_LOG_LEVEL=DEBUGfor the offending task with the request / response buffer addresses. The triple is the rollback target.
Single-variable mutation SMALLER than the original change. Examples: shrink the input buffer to a single compressible payload (not the production batch); switch
doca_mmapto a fresh pinned region (not the production pool); reduce parallelism to one outstanding task (not the pipeline depth). Larger mutations void the experiment.Re-capture and compare. Re-run the triple; the request/response counter diff IS the evidence.
Exit with named green signal OR escalate. Green = one round-trip (compress → decompress) returns bytes-equal at the source. If two consecutive iterations don't change anything, escalate via the layer route table above with the captured triple.
rollback
Compress contexts are stateful (started context + registered
mmap regions + in-flight tasks on the progress engine) and the
agent's failure mode is to leave in-flight tasks dangling on a
context that is being torn down, returning
DOCA_ERROR_BAD_STATE on the next program run. The
universal verification contract (doca-setup/CAPABILITIES.md#universal-verification-contract)
step 1 (preconditions) requires "the rollback path is
documented" on every change-recommending answer; this is the
Compress instantiation.
Snapshot before mutate. Before any change-recommending
Compress answer, capture (a) the started-context registration
map (mmap region IDs + task-type conf flags from ## configure
step 3), (b) the outstanding-task count from
doca_pe_progress, and (c) the input/output buffer ownership
list. The triple IS the rollback target.
Drain outstanding tasks FIRST. Walk
doca_pe_progressuntil the outstanding-task counter is zero. Do NOT submit new tasks after rollback intent is declared. If the drain stalls (counter not decrementing within the bounded debug-loop window), fire the deploy-loop bridge (doca-setup/CAPABILITIES.md#deploy-loop-bridge--step-5-not-green-is-the-debug-loop-trigger) on the stalled-drain symptom before continuing the rollback.doca_ctx_stopon the Compress context. ReturnsDOCA_ERROR_BAD_STATEif step 1 was skipped — that is diagnostic, not a retry trigger; re-walk step 1 with a higher-resolution drain log.Destroy the stopped Compress context.
doca_compress_destroybefore destroying either mmap. The underlyingdoca_devremains valid and must not be torn down by this step.Unregister mmap regions in reverse-register order.
doca_mmap_destroyon every region created withdoca_mmap_create_*; the underlying host buffers may be freed after this step.Re-verify with the shipped round-trip smoke. Re-run the round-trip from
## teststep 1 against a fresh context to confirm the device + driver path is intact post-rollback. Green is exactly a byte-equal result. If the first fresh-context smoke is not byte-equal, permit one bounded debug-loop single-variable mutation and then one fresh-context recheck. If that recheck is still not byte-equal, surface the unresolved residual gap and do not retry.Document the rollback verb in the verification contract preconditions block. The step 1 line for a Compress add reads: "the rollback path is the five-step reversal in
## rollback; the agent has captured the started-context registration map and outstanding-task count." Without that line, the contract is incomplete and the agent is NOT eligible to declare done.
The rollback is bounded to the initial fresh-context recheck plus one debug mutation and one final fresh-context recheck. Only a byte-equal comparison is green; a second non-green result is the unresolved residual gap.
Deferred task verbs
The following verbs are out of scope for this skill but are commonly asked in the same conversations. Route them as follows so the agent does not invent guidance:
install. Installing DOCA, choosing packages, post-install verification,
pkg-configwiring — defer todoca-setup/SKILL.mdand to the install-tree layout in doca-public-knowledge-map ## Layout of an installed DOCA package (doca-public-knowledge-map/SKILL.md#layout-of-an-installed-doca-package). This skill assumes DOCA is already installed.deploy. Deploying Compress-using applications at scale (compress-before-write storage workers across many hosts, decompress-on-read network receivers, Kubernetes operator workflows) — out of scope for this skill. For single-host first-run testing, the right verb in this skill is
## run; do not invent a "deploy" workflow.rollback. Coordinated rollback of Compress-using applications across many hosts — out of scope. For a single in-session Compress configuration rollback, the right verb in this skill is destroying the context (
doca_ctx_stop→doca_ctx_destroy) and re-running## configurewith corrected parameters.kernel-level driver install / firmware burn. Compress depends on the underlying ConnectX firmware and BlueField BFB; if the debug ladder lands on a driver-layer issue (
DOCA_ERROR_DRIVERfrom a Compress submit, repeated accelerator errors indmesg), the fix is viamlxconfig/mlxfwreset/ re-imaging the BFB, all of which belong todoca-setup ## debug(doca-setup/TASKS.md#debug) layer
Command appendix
Every command below is cross-cutting on DOCA Compress — it answers a recurring class of question that comes up in the verbs above. The agent should treat the class as load-bearing; the worked example is a single instance. Run-as user is the unprivileged user unless noted. Rows that need elevated privileges call that out explicitly.
Infra-aware preamble (every row below). Per the bundle's
detect → prefer → fall back → report contract documented in
doca-structured-tools-contract ## The agent behavior contract (doca-structured-tools-contract/SKILL.md#the-agent-behavior-contract),
the agent should:
Probe for the matching structured helper FIRST (
doca-env --jsonfor version + devices + libraries + drivers + hugepages in one shot;doca-capability-snapshotfor per-device capability flags;version-matrix.jsonfor "available since" lookups).If the probe succeeds, the structured tool's output is the authoritative answer and the agent SHOULD NOT also run the manual command in the row below. Report "using structured
<tool>".If the probe fails, fall back to the manual command in the row. Report "falling back to manual chain".
The schemas the structured tools emit are defined in
doca-structured-tools-contract ## Schemas(doca-structured-tools-contract/SKILL.md#schemas); the version-handling semantics (four-way match, NGC, headers-win) are owned bydoca-version/SKILL.md.
| Command (worked example) | Owning step | Class of question it answers | What healthy output looks like |
|---|---|---|---|
pkg-config --modversion doca-compress | ## configure step 1; ## build slot 4 | What is the build-time DOCA Compress version? | A semver string matching doca_caps --version. Disagreement = partial install (route to doca-version TASKS.md ## debug (doca-version/TASKS.md#debug) layer 2) |
pkg-config --cflags --libs doca-compress | ## build | What include + link flags does the linker need? | Trust whatever pkg-config --cflags --libs produces on this install. Do not hardcode either the -I include path or the -l<name> flag form — both can drift between DOCA install profiles and DOCA majors; the on-disk .so basenames use underscores, while the .pc package names use hyphens, and pkg-config is the only thing that resolves both correctly. Hand-crafted -l lines silently break when DOCA upgrades. |
doca_caps --list-devs | ## configure step 2; ## run step 1 | Which devices on this host can be used as a doca_dev for Compress? | One row per visible device with PCIe address and capability flags; the agent must still run doca_compress_cap_* per-device to confirm per-task support |
doca_caps --version | ## configure step 1; ## test step 1 | What is the runtime DOCA version on this host? | A semver string matching pkg-config --modversion doca-compress |
ls /opt/mellanox/doca/samples/doca_compress/ | ## modify slot 1 | Which Compress samples ship in this install, and which is the closest starting point? | A list of sample directories named after the task direction they demonstrate (compress, decompress, or both) |
ls /opt/mellanox/doca/applications/ (then locate the File Compression reference app) | ## modify slot 1 | Is the File Compression reference application present as a fuller worked example? | A directory whose contents include a DEFLATE-based file-compression flow |
cat /opt/mellanox/doca/applications/VERSION | ## configure step 1; ## debug layer 1 | What does the install tree itself claim its version is? | A semver string matching the other two version sources |
printf 'abcabcabcabcabcabc' | python3 -c 'import sys, zlib; sys.stdout.buffer.write(zlib.compress(sys.stdin.buffer.read()))' | xxd | ## test step 3 | What is the CPU-reference DEFLATE encoding for the round-trip smoke fixture? | A short DEFLATE-encoded byte sequence the agent can compare against the doca-compress compress output, or feed into doca-compress decompress for a decompress-only smoke |
dmesg | tail -n 40 (sudo) | ## debug layer 7 | What did the kernel / driver log around the last Compress call? | Empty or recent benign messages. Repeated mlx5 / accelerator errors → driver-layer bug; route to doca-setup ## debug (doca-setup/TASKS.md#debug) |
DOCA_LOG_LEVEL=trace ./<binary> | ## run step 3 | What did the structured DOCA logger emit for the first failing call? | A trace-level line on every lifecycle transition and every task submission. Silence after submission = PE not progressed |
For commands shared across libraries (pkg-config --modversion,
doca_caps, cat /opt/mellanox/doca/applications/VERSION,
DOCA_LOG_LEVEL) the cross-library overlay is in
doca-debug TASKS.md ## Command appendix (doca-debug/TASKS.md#command-appendix);
this table adds the Compress-specific rows on top.
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.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download doca-compress.zip