From 7208fcbe1c855c12d1f42aadb4093ab9ff3ead7e Mon Sep 17 00:00:00 2001 From: Yufeng Li Date: Mon, 3 Jan 2022 10:55:08 -0800 Subject: [PATCH] use wasmscalar as default kernel (#9988) * use wasmscalar as default kernel --- cmake/onnxruntime_mlas.cmake | 13 ++++++++----- .../SconvDepthwiseKernelScalar.cpp} | 2 +- .../SgemmKernelScalar.cpp} | 4 ++-- .../SgemvKernelScalar.cpp} | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) rename onnxruntime/core/mlas/lib/{wasm/SconvDepthwiseKernelWasmScalar.cpp => scalar/SconvDepthwiseKernelScalar.cpp} (99%) rename onnxruntime/core/mlas/lib/{wasm/SgemmKernelWasmScalar.cpp => scalar/SgemmKernelScalar.cpp} (99%) rename onnxruntime/core/mlas/lib/{wasm/SgemvKernelWasmScalar.cpp => scalar/SgemvKernelScalar.cpp} (99%) diff --git a/cmake/onnxruntime_mlas.cmake b/cmake/onnxruntime_mlas.cmake index d1ddc06301..2fe9bd4e28 100644 --- a/cmake/onnxruntime_mlas.cmake +++ b/cmake/onnxruntime_mlas.cmake @@ -176,7 +176,7 @@ if (onnxruntime_BUILD_WEBASSEMBLY) ) else() file(GLOB_RECURSE mlas_platform_srcs - "${MLAS_SRC_DIR}/wasm/*.cpp" + "${MLAS_SRC_DIR}/scalar/*.cpp" ) endif() target_sources(onnxruntime_mlas PRIVATE ${mlas_platform_srcs}) @@ -336,7 +336,7 @@ else() ${mlas_platform_srcs_power10} ) endif() - endif() + endif() if(NOT ONNXRUNTIME_MLAS_MULTI_ARCH) set(MLAS_SOURCE_IS_NOT_SET 0) endif() @@ -367,7 +367,7 @@ else() ${mlas_platform_srcs} ${MLAS_SRC_DIR}/x86/x86.get_pc_thunk.S ) - endif() + endif() if(NOT ONNXRUNTIME_MLAS_MULTI_ARCH) set(MLAS_SOURCE_IS_NOT_SET 0) @@ -462,9 +462,12 @@ else() list(APPEND ONNXRUNTIME_MLAS_LIBS onnxruntime_mlas_x86_64) set(mlas_platform_srcs ) else() - set(MLAS_SOURCE_IS_NOT_SET 1) + set(MLAS_SOURCE_IS_NOT_SET 0) endif() - + endif() + if(NOT ONNXRUNTIME_MLAS_MULTI_ARCH AND MLAS_SOURCE_IS_NOT_SET) + file(GLOB_RECURSE mlas_platform_srcs + "${MLAS_SRC_DIR}/scalar/*.cpp") endif() target_sources(onnxruntime_mlas PRIVATE ${mlas_platform_srcs}) endif() diff --git a/onnxruntime/core/mlas/lib/wasm/SconvDepthwiseKernelWasmScalar.cpp b/onnxruntime/core/mlas/lib/scalar/SconvDepthwiseKernelScalar.cpp similarity index 99% rename from onnxruntime/core/mlas/lib/wasm/SconvDepthwiseKernelWasmScalar.cpp rename to onnxruntime/core/mlas/lib/scalar/SconvDepthwiseKernelScalar.cpp index ad243777b3..a805f98fef 100644 --- a/onnxruntime/core/mlas/lib/wasm/SconvDepthwiseKernelWasmScalar.cpp +++ b/onnxruntime/core/mlas/lib/scalar/SconvDepthwiseKernelScalar.cpp @@ -6,7 +6,7 @@ Licensed under the MIT License. Module Name: - SconvDepthwiseKernelWasmScalar.cpp + SconvDepthwiseKernelScalar.cpp Abstract: diff --git a/onnxruntime/core/mlas/lib/wasm/SgemmKernelWasmScalar.cpp b/onnxruntime/core/mlas/lib/scalar/SgemmKernelScalar.cpp similarity index 99% rename from onnxruntime/core/mlas/lib/wasm/SgemmKernelWasmScalar.cpp rename to onnxruntime/core/mlas/lib/scalar/SgemmKernelScalar.cpp index 38e873adb0..62729256da 100644 --- a/onnxruntime/core/mlas/lib/wasm/SgemmKernelWasmScalar.cpp +++ b/onnxruntime/core/mlas/lib/scalar/SgemmKernelScalar.cpp @@ -6,7 +6,7 @@ Licensed under the MIT License. Module Name: - SgemmKernelWasmScalar.cpp + SgemmKernelScalar.cpp Abstract: @@ -41,7 +41,7 @@ Arguments: A - Supplies the address of matrix A. B - Supplies the address of matrix B. The matrix data has been packed using - MlasSgemmCopyPackB or MlasSgemmTransposePackB. Note that in WASM scalar, + MlasSgemmCopyPackB or MlasSgemmTransposePackB. Note that in scalar, the packing wide is 4. C - Supplies the address of matrix C. diff --git a/onnxruntime/core/mlas/lib/wasm/SgemvKernelWasmScalar.cpp b/onnxruntime/core/mlas/lib/scalar/SgemvKernelScalar.cpp similarity index 99% rename from onnxruntime/core/mlas/lib/wasm/SgemvKernelWasmScalar.cpp rename to onnxruntime/core/mlas/lib/scalar/SgemvKernelScalar.cpp index bd74c04b40..609a6f251e 100644 --- a/onnxruntime/core/mlas/lib/wasm/SgemvKernelWasmScalar.cpp +++ b/onnxruntime/core/mlas/lib/scalar/SgemvKernelScalar.cpp @@ -6,7 +6,7 @@ Licensed under the MIT License. Module Name: - SgemvKernelWasmScalar.cpp + SgemvKernelScalar.cpp Abstract: