1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
|
.. SPDX-License-Identifier: BSD-3-Clause
Copyright (c) 2022 Marvell.
dpdk-test-mldev Application
===========================
The ``dpdk-test-mldev`` tool is a Data Plane Development Kit (DPDK) application
that allows testing various mldev use cases.
This application has a generic framework to add new mldev based test cases
to verify functionality
and measure the performance of inference execution on DPDK ML devices.
Application and Options
-----------------------
The application has a number of command line options:
.. code-block:: console
dpdk-test-mldev [EAL Options] -- [application options]
EAL Options
~~~~~~~~~~~
The following are the EAL command-line options that can be used
with the ``dpdk-test-mldev`` application.
See the DPDK Getting Started Guides for more information on these options.
``-c <COREMASK>`` or ``-l <CORELIST>``
Set the hexadecimal bitmask of the cores to run on.
The corelist is a list of cores to use.
``-a <PCI_ID>``
Attach a PCI based ML device.
Specific to drivers using a PCI based ML device.
``--vdev <driver>``
Add a virtual mldev device.
Specific to drivers using a ML virtual device.
Application Options
~~~~~~~~~~~~~~~~~~~
The following are the command-line options supported by the test application.
``--test <name>``
Name of the test to execute.
ML tests are divided into three groups: Device, Model and Inference tests.
Test name should be one of the following supported tests.
**ML Device Tests** ::
device_ops
**ML Model Tests** ::
model_ops
**ML Inference Tests** ::
inference_ordered
inference_interleave
``--dev_id <n>``
Set the device ID of the ML device to be used for the test.
Default value is ``0``.
``--socket_id <n>``
Set the socket ID of the application resources.
Default value is ``SOCKET_ID_ANY``.
``--models <model_list>``
Set the list of model files to be used for the tests.
Application expects the ``model_list`` in comma separated form
(i.e. ``--models model_A.bin,model_B.bin``).
Maximum number of models supported by the test is ``8``.
``--filelist <file_list>``
Set the list of model, input, output and reference files to be used for the tests.
Application expects the ``file_list`` to be in comma separated form
(i.e. ``--filelist <model,input,output>[,reference]``).
Multiple filelist entries can be specified when running the tests with multiple models.
Both quantized and dequantized outputs are written to the disk.
Dequantized output file would have the name specified by the user through ``--filelist`` option.
A suffix ``.q`` is appended to quantized output filename.
Maximum number of filelist entries supported by the test is ``8``.
``--quantized_io``
Disable IO quantization and dequantization.
``--repetitions <n>``
Set the number of inference repetitions to be executed in the test per each model.
Default value is ``1``.
``--burst_size <n>``
Set the burst size to be used when enqueuing / dequeuing inferences.
Default value is ``1``.
``--queue_pairs <n>``
Set the number of queue-pairs to be used for inference enqueue and dequeue operations.
Default value is ``1``.
``--queue_size <n>``
Set the size of queue-pair to be created for inference enqueue / dequeue operations.
Queue size would translate into ``rte_ml_dev_qp_conf::nb_desc`` field during queue-pair creation.
Default value is ``1``.
``--tolerance <n>``
Set the tolerance value in percentage to be used for output validation.
Default value is ``0``.
``--stats``
Enable reporting device extended stats.
``--debug``
Enable the tests to run in debug mode.
``--help``
Print help message.
ML Device Tests
---------------
ML device tests are functional tests to validate ML device API.
Device tests validate the ML device handling configure, close, start and stop APIs.
Application Options
~~~~~~~~~~~~~~~~~~~
Supported command line options for the ``device_ops`` test are following::
--debug
--test
--dev_id
--socket_id
--queue_pairs
--queue_size
DEVICE_OPS Test
~~~~~~~~~~~~~~~
Device ops test validates the device configuration and reconfiguration support.
The test configures ML device based on the options
``--queue_pairs`` and ``--queue_size`` specified by the user,
and later reconfigures the ML device with the number of queue pairs and queue size
based on the maximum specified through the device info.
Example
^^^^^^^
Command to run ``device_ops`` test:
.. code-block:: console
sudo <build_dir>/app/dpdk-test-mldev -c 0xf -a <PCI_ID> -- \
--test=device_ops
Command to run ``device_ops`` test with user options:
.. code-block:: console
sudo <build_dir>/app/dpdk-test-mldev -c 0xf -a <PCI_ID> -- \
--test=device_ops --queue_pairs <M> --queue_size <N>
ML Model Tests
--------------
Model tests are functional tests to validate ML model API.
Model tests validate the functioning of load, start, stop and unload ML models.
Application Options
~~~~~~~~~~~~~~~~~~~
Supported command line options for the ``model_ops`` test are following::
--debug
--test
--dev_id
--socket_id
--models
List of model files to be used for the ``model_ops`` test can be specified
through the option ``--models <model_list>`` as a comma separated list.
Maximum number of models supported in the test is ``8``.
.. note::
* The ``--models <model_list>`` is a mandatory option for running this test.
* Options not supported by the test are ignored if specified.
MODEL_OPS Test
~~~~~~~~~~~~~~
The test is a collection of multiple sub-tests,
each with a different order of slow-path operations
when handling with `N` number of models.
**Sub-test A:**
executes the sequence of load / start / stop / unload for a model in order,
followed by next model.
.. _figure_mldev_model_ops_subtest_a:
.. figure:: img/mldev_model_ops_subtest_a.*
Execution sequence of model_ops subtest A.
**Sub-test B:**
executes load for all models, followed by a start for all models.
Upon successful start of all models, stop is invoked for all models followed by unload.
.. _figure_mldev_model_ops_subtest_b:
.. figure:: img/mldev_model_ops_subtest_b.*
Execution sequence of model_ops subtest B.
**Sub-test C:**
loads all models, followed by a start and stop of all models in order.
Upon completion of stop, unload is invoked for all models.
.. _figure_mldev_model_ops_subtest_c:
.. figure:: img/mldev_model_ops_subtest_c.*
Execution sequence of model_ops subtest C.
**Sub-test D:**
executes load and start for all models available.
Upon successful start of all models, stop is executed for the models.
.. _figure_mldev_model_ops_subtest_d:
.. figure:: img/mldev_model_ops_subtest_d.*
Execution sequence of model_ops subtest D.
Example
^^^^^^^
Command to run ``model_ops`` test:
.. code-block:: console
sudo <build_dir>/app/dpdk-test-mldev -c 0xf -a <PCI_ID> -- \
--test=model_ops --models model_1.bin,model_2.bin,model_3.bin, model_4.bin
ML Inference Tests
------------------
Inference tests are a set of tests to validate end-to-end inference execution on ML device.
These tests executes the full sequence of operations required to run inferences
with one or multiple models.
Application Options
~~~~~~~~~~~~~~~~~~~
Supported command line options for inference tests are following::
--debug
--test
--dev_id
--socket_id
--filelist
--repetitions
--burst_size
--queue_pairs
--queue_size
--tolerance
--stats
List of files to be used for the inference tests can be specified
through the option ``--filelist <file_list>`` as a comma separated list.
A filelist entry would be of the format
``--filelist <model_file,input_file,output_file>[,reference_file]``
and is used to specify the list of files required to test with a single model.
Multiple filelist entries are supported by the test, one entry per model.
Maximum number of file entries supported by the test is ``8``.
When ``--burst_size <num>`` option is specified for the test,
enqueue and dequeue burst would try to enqueue or dequeue
``num`` number of inferences per each call respectively.
In the inference test, a pair of lcores are mapped to each queue pair.
Minimum number of lcores required for the tests is equal to ``(queue_pairs * 2 + 1)``.
Output validation of inference would be enabled only
when a reference file is specified through the ``--filelist`` option.
Application would additionally consider the tolerance value
provided through ``--tolerance`` option during validation.
When the tolerance values is 0, CRC32 hash of inference output
and reference output are compared.
When the tolerance is non-zero, element wise comparison of output is performed.
Validation is considered as successful only
when all the elements of the output tensor are with in the tolerance range specified.
Enabling ``--stats`` would print the extended stats supported by the driver.
.. note::
* The ``--filelist <file_list>`` is a mandatory option for running inference tests.
* Options not supported by the tests are ignored if specified.
* Element wise comparison is not supported when
the output dtype is either fp8, fp16 or bfloat16.
This is applicable only when the tolerance is greater than zero
and for pre-quantized models only.
INFERENCE_ORDERED Test
~~~~~~~~~~~~~~~~~~~~~~
This is a functional test for validating the end-to-end inference execution on ML device.
This test configures ML device and queue pairs
as per the queue-pair related options (queue_pairs and queue_size) specified by the user.
Upon successful configuration of the device and queue pairs,
the first model specified through the filelist is loaded to the device
and inferences are enqueued by a pool of worker threads to the ML device.
Total number of inferences enqueued for the model are equal to the repetitions specified.
A dedicated pool of worker threads would dequeue the inferences from the device.
The model is unloaded upon completion of all inferences for the model.
The test would continue loading and executing inference requests for all models
specified through ``filelist`` option in an ordered manner.
.. _figure_mldev_inference_ordered:
.. figure:: img/mldev_inference_ordered.*
Execution of inference_ordered on single model.
Example
^^^^^^^
Example command to run ``inference_ordered`` test:
.. code-block:: console
sudo <build_dir>/app/dpdk-test-mldev -c 0xf -a <PCI_ID> -- \
--test=inference_ordered --filelist model.bin,input.bin,output.bin
Example command to run ``inference_ordered`` test with a specific burst size:
.. code-block:: console
sudo <build_dir>/app/dpdk-test-mldev -c 0xf -a <PCI_ID> -- \
--test=inference_ordered --filelist model.bin,input.bin,output.bin \
--burst_size 12
Example command to run ``inference_ordered`` test with multiple queue-pairs and queue size:
.. code-block:: console
sudo <build_dir>/app/dpdk-test-mldev -c 0xf -a <PCI_ID> -- \
--test=inference_ordered --filelist model.bin,input.bin,output.bin \
--queue_pairs 4 --queue_size 16
Example command to run ``inference_ordered`` with output validation using tolerance of ``1%``:
.. code-block:: console
sudo <build_dir>/app/dpdk-test-mldev -c 0xf -a <PCI_ID> -- \
--test=inference_ordered --filelist model.bin,input.bin,output.bin,reference.bin \
--tolerance 1.0
INFERENCE_INTERLEAVE Test
~~~~~~~~~~~~~~~~~~~~~~~~~
This is a stress test for validating the end-to-end inference execution on ML device.
The test configures the ML device and queue pairs
as per the queue-pair related options (queue_pairs and queue_size) specified by the user.
Upon successful configuration of the device and queue pairs,
all models specified through the filelist are loaded to the device.
Inferences for multiple models are enqueued by a pool of worker threads in parallel.
Inference execution by the device is interleaved between multiple models.
Total number of inferences enqueued for a model are equal to the repetitions specified.
An additional pool of threads would dequeue the inferences from the device.
Models would be unloaded upon completion of inferences for all models loaded.
.. _figure_mldev_inference_interleave:
.. figure:: img/mldev_inference_interleave.*
Execution of inference_interleave on single model.
Example
^^^^^^^
Example command to run ``inference_interleave`` test:
.. code-block:: console
sudo <build_dir>/app/dpdk-test-mldev -c 0xf -a <PCI_ID> -- \
--test=inference_interleave --filelist model.bin,input.bin,output.bin
Example command to run ``inference_interleave`` test with multiple models:
.. code-block:: console
sudo <build_dir>/app/dpdk-test-mldev -c 0xf -a <PCI_ID> -- \
--test=inference_interleave --filelist model_A.bin,input_A.bin,output_A.bin \
--filelist model_B.bin,input_B.bin,output_B.bin
Example command to run ``inference_interleave`` test
with a specific burst size, multiple queue-pairs and queue size:
.. code-block:: console
sudo <build_dir>/app/dpdk-test-mldev -c 0xf -a <PCI_ID> -- \
--test=inference_interleave --filelist model.bin,input.bin,output.bin \
--queue_pairs 8 --queue_size 12 --burst_size 16
Example command to run ``inference_interleave`` test
with multiple models and output validation using tolerance of ``2.0%``:
.. code-block:: console
sudo <build_dir>/app/dpdk-test-mldev -c 0xf -a <PCI_ID> -- \
--test=inference_interleave \
--filelist model_A.bin,input_A.bin,output_A.bin,reference_A.bin \
--filelist model_B.bin,input_B.bin,output_B.bin,reference_B.bin \
--tolerance 2.0
Debug mode
----------
ML tests can be executed in debug mode by enabling the option ``--debug``.
Execution of tests in debug mode would enable additional prints.
When a validation failure is observed, output from that buffer is written to the disk,
with the filenames having similar convention when the test has passed.
Additionally index of the buffer would be appended to the filenames.
|