onnxruntime
bb1dfff7 - [MLAS] Update the NHWC sans transposes path to also support Depthwise convolutions (#28565)

Commit
67 days ago
[MLAS] Update the NHWC sans transposes path to also support Depthwise convolutions (#28565) ### Description A path for MLAS to support NHWC Convolutions without the need for transposes was added in PR: https://github.com/microsoft/onnxruntime/pull/26834 This PR expands those changes to also support Depthwise Convolutions via the same pathway ### What changed: - The shared NHWC capability gate in onnxruntime/core/mlas/lib/convolve.cpp:1348 stopped requiring GroupCount == 1. It now allows GroupCount > 1 only when the op is true depthwise, meaning filters_per_group == 1. - The NHWC transformer in onnxruntime/core/optimizer/nhwc_transformer.cc:162 was updated to pass the real group value and compute filter_count per group instead of hard-coding group 1. That is what lets grouped depthwise Conv/FusedConv nodes get rewritten to com.microsoft.NhwcFusedConv. - The KleidiAI execution path in onnxruntime/core/mlas/lib/kleidiai/convolve_kleidiai.cpp:553 learned how to handle grouped NHWC tensors by: - gathering one group’s channels out of interleaved NHWC input into a temporary contiguous buffer, - running the existing per-group kernel, - scattering that group’s output channels back into interleaved NHWC output. - Tests were added for a working NHWC depthwise case in onnxruntime/test/contrib_ops/fused_conv_test.cc:466, and transformer tests were updated to verify both the new positive case and the expected skip cases in onnxruntime/test/optimizer/nhwc_transformer_test.cc:416. Added performance benchmark tests to allow for comparison between the new NHWC path and the old NCHW default. Sample output: ``` ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Benchmark Time CPU Iterations ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- SCONV_NCHW/KleidiAiNhwcComparison_NchwBaseline/Rank:2/N:1/G:1/Cpg:64/Fpg:64/I:56/56/K:3/3/P:1/1/1/1/S:1/1/D:1/1/real_time 508509 ns 508507 ns 1374 SCONV_NCHW/KleidiAiNhwcComparison_NchwBaseline/Rank:2/N:1/G:1/Cpg:128/Fpg:128/I:28/28/K:3/3/P:1/1/1/1/S:1/1/D:1/1/real_time 700573 ns 700386 ns 997 SCONV_NCHW/KleidiAiNhwcComparison_NchwBaseline/Rank:2/N:1/G:64/Cpg:1/Fpg:1/I:56/56/K:3/3/P:1/1/1/1/S:1/1/D:1/1/real_time 6471094 ns 6471114 ns 132 SCONV_NCHW/KleidiAiNhwcComparison_NchwBaseline/Rank:2/N:1/G:72/Cpg:1/Fpg:1/I:48/80/K:3/3/P:1/1/1/1/S:2/2/D:1/1/real_time 3768969 ns 3767797 ns 217 SCONV_NHWC_KLEIDIAI/KleidiAiNhwcComparison_NhwcFastPath/Rank:2/N:1/G:1/Cpg:64/Fpg:64/I:56/56/K:3/3/P:1/1/1/1/S:1/1/D:1/1/real_time 414198 ns 414197 ns 1688 SCONV_NHWC_KLEIDIAI/KleidiAiNhwcComparison_NhwcFastPath/Rank:2/N:1/G:1/Cpg:128/Fpg:128/I:28/28/K:3/3/P:1/1/1/1/S:1/1/D:1/1/real_time 652454 ns 652454 ns 1074 SCONV_NHWC_KLEIDIAI/KleidiAiNhwcComparison_NhwcFastPath/Rank:2/N:1/G:64/Cpg:1/Fpg:1/I:56/56/K:3/3/P:1/1/1/1/S:1/1/D:1/1/real_time 6032947 ns 6032940 ns 117 SCONV_NHWC_KLEIDIAI/KleidiAiNhwcComparison_NhwcFastPath/Rank:2/N:1/G:72/Cpg:1/Fpg:1/I:48/80/K:3/3/P:1/1/1/1/S:2/2/D:1/1/real_time 3022041 ns 3018352 ns 227 ``` --------- Signed-off-by: Orlaith Monahan <orlaith.monahan@arm.com>
Author
Parents
Loading