openvinotoolkit / openvino

OpenVINO™ is an open-source toolkit for optimizing and deploying AI inference
https://docs.openvino.ai
Apache License 2.0
6.29k stars 2.08k forks source link

[Bug]: Mish activation function crashes openvino model benchmark on NPU #24461

Open EmbeddedPaul166 opened 1 month ago

EmbeddedPaul166 commented 1 month ago

OpenVINO Version

2024.1.0

Operating System

Windows System

Device used for inference

NPU

Framework

Keras (TensorFlow 2)

Model used

Custom

Issue description

Consider a following workflow:

  1. Custom convolutional model with dynamic shape and mish activation is created in Keras Tensorflow and saved in the saved_model format.
  2. Using model optimizer it's input shape is converted to constant and saved_model.bin and .xml files are generated.
  3. Using benchmark_app model is ran on NPU.

Problem: Adding mish activation function to convolutional layer makes benchmark_app crash on NPU.

Tests were performed on a laptop with Intel Core Ultra 7 155H CPU. Tensorflow version was 2.14.0.

Step-by-step reproduction

Step 1: Model creation in tensorflow

import tensorflow as tf inp = tf.keras.Input((None, None, 1), dtype=tf.float32) y = tf.keras.layers.Conv2D(32, (3, 3), padding='same', activation=tf.keras.activations.mish)(inp) model = tf.keras.Model(inputs=inp, outputs=y) tf.keras.models.save_model(model, 'test_model')

Step 2: Model conversion to openvino format

mo.exe --saved_model_dir .\test_model --input input_1 --input_shape [1,256,256,1]

Step 3: Performing benchmark on NPU

benchmark_app.exe -m saved_model.xml -hint ctput -data_shape "[1, 256, 256, 1]" -inference_only -report_type detailed_counters -d NPU

Relevant log output

[Step 1/11] Parsing and validating input arguments
[ INFO ] Parsing input parameters
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2024.1.0-15008-f4afc983258-releases/2024/1
[ INFO ]
[ INFO ] Device info:
[ INFO ] NPU
[ INFO ] Build ................................. 2024.1.0-15008-f4afc983258-releases/2024/1
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[ WARNING ] Turn on performance counters for NPU device since report type is detailed_counters.
[Step 4/11] Reading model files
[ INFO ] Loading model files
[ INFO ] Read model took 4.51 ms
[ INFO ] Original model I/O parameters:
[ INFO ] Model inputs:
[ INFO ]     input_1 (node: input_1) : f32 / [...] / [1,256,256,1]
[ INFO ] Model outputs:
[ INFO ]     conv2d (node: model/conv2d/mul) : f32 / [...] / [1,256,256,32]
[Step 5/11] Resizing model to match image sizes and given batch
[ WARNING ] Input 'input_1' has static shape. Provided data shapes for this input will be ignored.
[ INFO ] Model batch size: 1
[Step 6/11] Configuring input of the model
[ INFO ] Model inputs:
[ INFO ]     input_1 (node: input_1) : f32 / [N,H,W,C] / [1,256,256,1]
[ INFO ] Model outputs:
[ INFO ]     conv2d (node: model/conv2d/mul) : f32 / [...] / [1,256,256,32]
[Step 7/11] Loading the model to the device
error: FeasibleAllocation failed : Scheduler failure, cannot schedule anything and there is no buffer to spill
[ ERROR ] Exception from src\inference\src\cpp\core.cpp:109:
Exception from src\inference\src\dev\plugin.cpp:54:
Exception from src\plugins\intel_npu\src\plugin\src\plugin.cpp:513:
Check 'result == ZE_RESULT_SUCCESS' failed at src\plugins\intel_npu\src\compiler\src\zero_compiler_in_driver.cpp:753:
Failed to compile network. L0 createGraph result: ZE_RESULT_ERROR_INVALID_ARGUMENT, code 0x78000004. Compilation failed
Failed to create executable

Traceback (most recent call last):
  File "C:\Users\user\micromamba\envs\opvtest\lib\site-packages\openvino\tools\benchmark\main.py", line 408, in main
    compiled_model = benchmark.core.compile_model(model, benchmark.device, device_config)
  File "C:\Users\user\micromamba\envs\opvtest\lib\site-packages\openvino\runtime\ie_api.py", line 521, in compile_model
    super().compile_model(model, device_name, {} if config is None else config),
RuntimeError: Exception from src\inference\src\cpp\core.cpp:109:
Exception from src\inference\src\dev\plugin.cpp:54:
Exception from src\plugins\intel_npu\src\plugin\src\plugin.cpp:513:
Check 'result == ZE_RESULT_SUCCESS' failed at src\plugins\intel_npu\src\compiler\src\zero_compiler_in_driver.cpp:753:
Failed to compile network. L0 createGraph result: ZE_RESULT_ERROR_INVALID_ARGUMENT, code 0x78000004. Compilation failed
Failed to create executable

[ INFO ] Statistics report is stored to benchmark_report.csv

Issue submission checklist

EmbeddedPaul166 commented 2 weeks ago

Any updates on this?