What can I help you with?
DOCA Documentation v2.10.0

Compiling DPL Applications

This section describes how to use the NVIDIA DPL compiler to compile DPL applications.

DOCA Programming Language (DPL) applications are an educational resource provided as a guide on how to program on the NVIDIA® BlueField® networking platform (DPU or SuperNIC) using DPL.

The NVIDIA DPL compiler (dplp4c.sh) is provided as an executable in a self contained docker image. The docker image is available to partners by logging into the NVIDIA NGC system and downloading the most recent DPL docker containers.

Please refer to the DPL Runtime Service for the system requirements and DPL Installation Guide on how to install the compiler. For information on the development environment, refer to the DOCA Pipeline Language Model and the DPL System Overview.

  • BlueField-3 is required

  • Ubuntu 22.04 hosts (x86) or greater

  • A P4Runtime controller based on API version 1.3.0 or greater

The DPL compiler is provided with all its dependencies in the dpl-dev container. For details on how to obtain and install the docker images see DPL Installation Guide .

A shell script, dplp4c.sh, is provided for a convenient way to execute the DPL compiler from the dpl-dev container:

Copy
Copied!
            

./dplp4c.sh [--mount dir]* dplp4c_args*

  • --mount – (optional) directory to be mounted into the container

  • dplp4c_args – arguments to be passed to the compiler (e.g., sample.p4)

For example, compiling the "hello_packet" DPL example is as simple as:

local-user@vm-1:~/p4-samples/dpu/hello_packet$ dplp4c.sh hello_packet.p4

Generating compiler output in "_out"

updating: MANIFEST.json (deflated 40%)

updating: hello_packet.program.json (deflated 87%)

updating: hello_packet.debug.json (deflated 96%)

The following files in this example are produced in the _out directory:

compiler.log

Log of any compiler warnings or errors to the specified program

hello_packet.dplconfig

Binary blob, containing all the data needed for the DPL Runtime daemon to load the program

hello_packet.p4info.txt

P4Runtime protobuf file, in text format

Additional NVIDIA® BlueField®-specific arguments include:

Copy
Copied!
            

--help Print this help message --version Print compiler version -I path Specify include path (passed to preprocessor) -D arg=value Define macro (passed to preprocessor) -U arg Undefine macro (passed to preprocessor) -E Preprocess only, do not compile (prints program on stdout) -M Output `make` dependency rule only (passed to preprocessor) -MD Output `make` dependency rule to file as side effect (passed to preprocessor) -MF file With -M, specify output file for dependencies (passed to preprocessor) -MG with -M, suppress errors for missing headers (passed to preprocessor) -MP with -M, add phony target for each dependency (passed to preprocessor) -MT target With -M, override target of the output rule (passed to preprocessor) -MQ target Like -Mt, override target but quote special characters (passed to preprocessor) -g Enable debugging via DPL Nspect --nocpp Skip preprocess, assume input file is already preprocessed. --Wdisable[=diagnostic] Disable a compiler diagnostic, or disable all warnings if no diagnostic is specified. --Winfo[=diagnostic] Report an info message for a compiler diagnostic. --Wwarn[=diagnostic] Report a warning for a compiler diagnostic, or treat all info messages as warnings if no diagnostic is specified. --Werror[=diagnostic] Report an error for a compiler diagnostic, or treat all warnings as errors if no diagnostic is specified. --maxErrorCount errorCount Set the maximum number of errors to display before failing. --target target Compile for the specified target device. --odir out_directory Write output to out directory --enable feature[,feature]*|--help Enable a feature, or comma-separated list of features --disable feature[,feature]*|--help Disable a feature, or comma-separated list of features

See section Compiling DPL Applications for examples of how to use the dplp4c.sh to compile.

Info

The binary <sample_name>. is created under _out/<sample_name>.dplconfig.

Info

The P4Runtime file is created under _out/<sample_name>.p4info.txt.

To enable packet debugging, you must ensure the following:

  • Compile your DPL program with the -g flag. This enables parsing for a debug flow.

  • Ensure you have at least one nv_send_debug_pkt() call in your DPL program. A debug packet will be emitted where nv_send_debug_pkt() is placed, and represent the program state at that point.

Please note packet debugging is only available on the RX direction. Debug packets will not be produced on TX. You may optionally include a "cookie", within your debug extern call, i.e.: nv_send_debug_pkt(8w0x42). This cookie may help differentiate between different debug extern calls, and will appear in your debugging output.

© Copyright 2025, NVIDIA. Last updated on Apr 24, 2025.