I’m trying to compile DepthAnything V2 (ViT-S encoder), but I got an error in Reshape of Patch Embeddings at compiling.
extracted compile log
$ hailo compiler depth-anything-v2-vits_optimized.har
:
[info] Successfully built optimization options - 50s 782ms
[error] Mapping Failed (allocation time: 50s)
No successful assignments: format_conversion1_defuse_reshape_hxf_to_w_transposed errors:
Agent infeasible
format_conversion1_defuse_width_feature_reshape errors:
Agent infeasible
format_conversion1_defuse_width_feature_reshape_concat1_transpose errors:
Agent infeasible
concat1 errors:
Agent infeasible
concat1_auto_spatial_reshape_from_concat1_to_ew_add1_defuse_width_feature_reshape_transpose errors:
Agent infeasible
auto_spatial_reshape_from_concat1_to_ew_add1_defuse_width_feature_reshape errors:
Agent infeasible
auto_spatial_reshape_from_concat1_to_ew_add1_defuse_reshape_f_to_hxw_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change51_to_slice4_defuse_reshape_hxf_to_w_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change51_to_slice4_defuse_width_feature_reshape errors:
Agent infeasible
slice4 errors:
Agent infeasible
slice4 failed on kernel validation: 16x4 is not supported in slice4
slice4 failed on kernel validation: More than 1 scs is not supported in current hw_arch for slice4
format_conversion5_defuse_width_feature_reshape errors:
Agent infeasible
format_conversion5_defuse_reshape_f_to_hxw_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change45_to_slice3_defuse_reshape_hxf_to_w_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change45_to_slice3_defuse_width_feature_reshape errors:
Agent infeasible
slice3 errors:
Agent infeasible
slice3 failed on kernel validation: 16x4 is not supported in slice3
slice3 failed on kernel validation: More than 1 scs is not supported in current hw_arch for slice3
format_conversion4_defuse_width_feature_reshape errors:
Agent infeasible
format_conversion4_defuse_reshape_f_to_hxw_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change38_to_slice2_defuse_reshape_hxf_to_w_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change38_to_slice2_defuse_width_feature_reshape errors:
Agent infeasible
slice2 errors:
Agent infeasible
slice2 failed on kernel validation: 16x4 is not supported in slice2
slice2 failed on kernel validation: More than 1 scs is not supported in current hw_arch for slice2
format_conversion3_defuse_width_feature_reshape errors:
Agent infeasible
format_conversion3_defuse_reshape_f_to_hxw_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change31_to_slice1_defuse_reshape_hxf_to_w_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change31_to_slice1_defuse_width_feature_reshape errors:
Agent infeasible
slice1 errors:
Agent infeasible
slice1 failed on kernel validation: 16x4 is not supported in slice1
slice1 failed on kernel validation: More than 1 scs is not supported in current hw_arch for slice1
format_conversion2_defuse_width_feature_reshape errors:
Agent infeasible
format_conversion2_defuse_reshape_f_to_hxw_transposed errors:
Agent infeasible
[error] Failed to produce compiled graph
[error] BackendAllocatorException: Compilation failed: No successful assignments: format_conversion1_defuse_reshape_hxf_to_w_transposed errors:
Agent infeasible
format_conversion1_defuse_width_feature_reshape errors:
Agent infeasible
format_conversion1_defuse_width_feature_reshape_concat1_transpose errors:
Agent infeasible
concat1 errors:
Agent infeasible
concat1_auto_spatial_reshape_from_concat1_to_ew_add1_defuse_width_feature_reshape_transpose errors:
Agent infeasible
auto_spatial_reshape_from_concat1_to_ew_add1_defuse_width_feature_reshape errors:
Agent infeasible
auto_spatial_reshape_from_concat1_to_ew_add1_defuse_reshape_f_to_hxw_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change51_to_slice4_defuse_reshape_hxf_to_w_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change51_to_slice4_defuse_width_feature_reshape errors:
Agent infeasible
slice4 errors:
Agent infeasible
slice4 failed on kernel validation: 16x4 is not supported in slice4
slice4 failed on kernel validation: More than 1 scs is not supported in current hw_arch for slice4
format_conversion5_defuse_width_feature_reshape errors:
Agent infeasible
format_conversion5_defuse_reshape_f_to_hxw_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change45_to_slice3_defuse_reshape_hxf_to_w_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change45_to_slice3_defuse_width_feature_reshape errors:
Agent infeasible
slice3 errors:
Agent infeasible
slice3 failed on kernel validation: 16x4 is not supported in slice3
slice3 failed on kernel validation: More than 1 scs is not supported in current hw_arch for slice3
format_conversion4_defuse_width_feature_reshape errors:
Agent infeasible
format_conversion4_defuse_reshape_f_to_hxw_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change38_to_slice2_defuse_reshape_hxf_to_w_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change38_to_slice2_defuse_width_feature_reshape errors:
Agent infeasible
slice2 errors:
Agent infeasible
slice2 failed on kernel validation: 16x4 is not supported in slice2
slice2 failed on kernel validation: More than 1 scs is not supported in current hw_arch for slice2
format_conversion3_defuse_width_feature_reshape errors:
Agent infeasible
format_conversion3_defuse_reshape_f_to_hxw_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change31_to_slice1_defuse_reshape_hxf_to_w_transposed errors:
Agent infeasible
auto_spatial_reshape_from_precision_change31_to_slice1_defuse_width_feature_reshape errors:
Agent infeasible
slice1 errors:
Agent infeasible
slice1 failed on kernel validation: 16x4 is not supported in slice1
slice1 failed on kernel validation: More than 1 scs is not supported in current hw_arch for slice1
format_conversion2_defuse_width_feature_reshape errors:
Agent infeasible
format_conversion2_defuse_reshape_f_to_hxw_transposed errors:
Agent infeasible
Is there a way to fix compile errors?
The following is what I investigated for the cause.
1. See the structure of networks
I checked other models. ViT (vit_base in Hailo Model Zoo) has the same structure and compiling is successful despite compiling DepthAnythingV2 failing.
See the differences between ViT and DepthAnythingV2, it seems that the difference in input size in a part of Patch Embedding is related.
So I extracted a part of the Patch Embedding processes (Conv2D, Reshape, Transpose) and tested them with a small model.
2. Test a part of patch embedding module
I ran to parse a model with 224x224 input (same as ViT), it was translated into space_to_depth + Conv2D, and the compilation was successful.
On the other hand, I ran to parse a model with 518x518 input (from DepthAnything V2), it was translated into Conv2D + format_conversion, and the compilation failed.
An compilation log of 518x518 model is following:
$ hailo parser onnx embed_518_384_14.onnx
$ hailo optimize --use-random-calib-set embed_518_384_14.har
$ hailo compiler embed_518_384_14_optimized.har
[info] Current Time: 11:21:25, 05/13/25
[info] CPU: Architecture: x86_64, Model: 12th Gen Intel(R) Core(TM) i7-1280P, Number Of Cores: 20, Utilization: 0.2%
[info] Memory: Total: 15GB, Available: 14GB
[info] System info: OS: Linux, Kernel: 5.15.167.4-microsoft-standard-WSL2
[info] Hailo DFC Version: 3.31.0
[info] HailoRT Version: 4.21.0
[info] PCIe: No Hailo PCIe device was found
[info] Running `hailo compiler embed_518_384_14_optimized.har`
[info] Compiling network
[info] To achieve optimal performance, set the compiler_optimization_level to "max" by adding performance_param(compiler_optimization_level=max) to the model script. Note that this may increase compilation time.
[info] Loading network parameters
[info] Starting Hailo allocation and compilation flow
[info] Building optimization options for network layers...
[info] Successfully built optimization options - 5s 227ms
[info] Trying to compile the network in a single context
[info] Single context flow failed: Recoverable single context error
[info] Building optimization options for network layers...
[info] Successfully built optimization options - 29s 464ms
[error] Mapping Failed (allocation time: 29s)
No successful assignments: format_conversion1_defuse_reshape_hxf_to_w_transposed errors:
Agent infeasible
format_conversion1_defuse_width_feature_reshape errors:
Agent infeasible
[error] Failed to produce compiled graph
[error] BackendAllocatorException: Compilation failed: No successful assignments: format_conversion1_defuse_reshape_hxf_to_w_transposed errors:
Agent infeasible
format_conversion1_defuse_width_feature_reshape errors:
Agent infeasible
What is the difference? Is there any way to compile a model with 518x518 input somehow?