Skip to content

Commit

Permalink
linux-dpdk: ml: implement on top of mldev
Browse files Browse the repository at this point in the history
Add ML implementation, which utilizes DPDK's mldev.

Current limitations:

- Only uses a single device.

- Only a single inference at a time per model.

- Inference is always synchronous, regardless of completion mode.

Signed-off-by: Jere Leppänen <[email protected]>
  • Loading branch information
JereLeppanen committed Jun 13, 2024
1 parent ae375ef commit f1d2b55
Show file tree
Hide file tree
Showing 6 changed files with 2,276 additions and 34 deletions.
36 changes: 8 additions & 28 deletions config/odp-linux-dpdk.conf
Original file line number Diff line number Diff line change
Expand Up @@ -337,32 +337,12 @@ dma: {
}

ml: {
# Enable onnxruntime profiling, when enabled, a json file will be
# generated after inference. chrome://tracing/ can be used to check
# the profiling. Use 0 to disable and 1 to enable profiling.
enable_profiling = 0

# Choose onnxruntime execution mode, which can be "SEQUENTIAL" or
# "PARALLEL"
execution_mode = "SEQUENTIAL"

# Set the number of threads used to parallelize the execution of the
# graph across nodes. A value of 0 means onnxruntime will pick a default.
inter_op_num_threads = 0

# Set the number of threads used to parallelize the execution within
# a node. A value of 0 means onnxruntime will pick a default.
intra_op_num_threads = 0

# Set graph optimization level. Valid values are:
# DISABLE_ALL: disables all optimizations
# ENABLE_BASIC: enables basic optimizations
# ENABLE_EXTENDED: enables basic and extended optimizations
# ENABLE_ALL: enables all available optimizations including layout optimization
graph_optimization_level = "ENABLE_ALL"

# Serialize the optimized model to disk. When initializing a session
# with the same model, no need to apply optimization anymore, thus
# reducing model startup time.
optimized_model_filepath = ""
# Device ID
dev_id = 0

# Number of models
num_models = 4

# Number of queue pairs
num_queue_pairs = 16
}
4 changes: 1 addition & 3 deletions platform/linux-dpdk/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ AM_CPPFLAGS += -I$(top_srcdir)/platform/$(with_platform)/arch/@ARCH_DIR@
AM_CPPFLAGS += -I$(top_srcdir)/platform/$(with_platform)/arch/default

AM_CPPFLAGS += $(OPENSSL_CPPFLAGS)
AM_CPPFLAGS += $(ORT_CPPFLAGS)

AM_CFLAGS += $(DPDK_CFLAGS)
AM_CFLAGS += $(LIBCONFIG_CFLAGS)
Expand Down Expand Up @@ -262,7 +261,7 @@ __LIB__libodp_dpdk_la_SOURCES = \

if WITH_ML
__LIB__libodp_dpdk_la_SOURCES += \
../linux-generic/odp_ml.c
odp_ml.c
else
__LIB__libodp_dpdk_la_SOURCES += \
../linux-generic/odp_ml_null.c
Expand Down Expand Up @@ -423,7 +422,6 @@ __LIB__libodp_dpdk_la_LIBADD += $(LIBCONFIG_LIBS)
__LIB__libodp_dpdk_la_LIBADD += $(DPDK_LIBS_LIBODP)
__LIB__libodp_dpdk_la_LIBADD += $(PTHREAD_LIBS)
__LIB__libodp_dpdk_la_LIBADD += $(TIMER_LIBS)
__LIB__libodp_dpdk_la_LIBADD += $(ORT_LIBS)

CHECK_GLOBALS_REGEX = " (odp_|_odp_|_deprecated_odp_|miniz_|mz_|tdefl_|tinfl_|mp_hdlr_init_odp_pool_ops)"

Expand Down
2 changes: 1 addition & 1 deletion platform/linux-dpdk/libodp-dpdk.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Description: The ODP packet processing engine
Version: @PKGCONFIG_VERSION@
Requires.private: libconfig
Libs: -L${libdir} -l@ODP_LIB_NAME@ @DPDK_LIBS_NON_ABI_COMPAT@ @ATOMIC_LIBS_NON_ABI_COMPAT@
Libs.private: @DPDK_LIBS_ABI_COMPAT@ @OPENSSL_STATIC_LIBS@ @PTHREAD_LIBS@ @TIMER_LIBS@ -lpthread @ATOMIC_LIBS_ABI_COMPAT@ @ORT_LIBS@
Libs.private: @DPDK_LIBS_ABI_COMPAT@ @OPENSSL_STATIC_LIBS@ @PTHREAD_LIBS@ @TIMER_LIBS@ -lpthread @ATOMIC_LIBS_ABI_COMPAT@
Cflags: -I${includedir} @DPDK_CFLAGS@
2 changes: 1 addition & 1 deletion platform/linux-dpdk/m4/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ esac
# Required for experimental rte_event_port_unlinks_in_progress() API
DPDK_CFLAGS="${DPDK_CFLAGS} -DALLOW_EXPERIMENTAL_API"

AS_VAR_APPEND([PLAT_DEP_LIBS], ["${ATOMIC_LIBS} ${LIBCONFIG_LIBS} ${OPENSSL_LIBS} ${DPDK_LIBS_LT} ${LIBCLI_LIBS} ${ORT_LIBS}"])
AS_VAR_APPEND([PLAT_DEP_LIBS], ["${ATOMIC_LIBS} ${LIBCONFIG_LIBS} ${OPENSSL_LIBS} ${DPDK_LIBS_LT} ${LIBCLI_LIBS}"])

# Add text to the end of configure with platform specific settings.
# Make sure it's aligned same as other lines in configure.ac.
Expand Down
1 change: 0 additions & 1 deletion platform/linux-dpdk/m4/odp_ml.m4

This file was deleted.

15 changes: 15 additions & 0 deletions platform/linux-dpdk/m4/odp_ml.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
##########################################################################
# DPDK ML API
##########################################################################
ml_support=yes
AC_ARG_ENABLE([dpdk-ml],
[AS_HELP_STRING([--disable-dpdk-ml],
[disable ML support]
[[default=enabled] (linux-dpdk)])],
[if test "x$enableval" = "xno"; then
ml_support=no
fi])

AC_CONFIG_COMMANDS_PRE([dnl
AM_CONDITIONAL([WITH_ML], [test x$ml_support = xyes])
])
Loading

0 comments on commit f1d2b55

Please sign in to comment.