[wasm] upgrade emsdk to 3.1.44 (#17069)

### Description
This change upgrade emsdk to 3.1.44.

Because backend is upgraded to LLVM 16, so need to fix a lot of build
failures caused by "-Wshorten-64-to-32".

most of the build failures comes from generated `onnx.pb.h`, and this
can be fixed by including "core/graph/onnx_protobuf.h", which detects
and ignore shorten-64-to-32 warnings.
This commit is contained in:
Yulong Wang 2023-08-10 16:08:36 -07:00 committed by GitHub
parent 66b45e0085
commit 9cd4e5af68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 79 additions and 137 deletions

2
.gitmodules vendored
View file

@ -7,7 +7,7 @@
[submodule "cmake/external/emsdk"]
path = cmake/external/emsdk
url = https://github.com/emscripten-core/emsdk.git
branch = 3.1.37
branch = 3.1.44
[submodule "cmake/external/onnxruntime-extensions"]
path = cmake/external/onnxruntime-extensions
url = https://github.com/microsoft/onnxruntime-extensions.git

View file

@ -82,7 +82,7 @@
"component": {
"type": "git",
"git": {
"commitHash": "b113f24842c6e97fe3e352084db09a6e278593ae",
"commitHash": "a896e3d066448b3530dbcaa48869fafefd738f57",
"repositoryUrl": "https://github.com/emscripten-core/emsdk.git"
},
"comments": "git submodule at cmake/external/emsdk"

@ -1 +1 @@
Subproject commit b113f24842c6e97fe3e352084db09a6e278593ae
Subproject commit a896e3d066448b3530dbcaa48869fafefd738f57

View file

@ -15,14 +15,8 @@
#include "core/framework/endian.h"
#include "core/framework/float8.h"
#include "core/framework/float16.h"
#include "core/graph/onnx_protobuf.h"
#include "core/framework/to_tensor_proto_element_type.h"
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#else
#include "onnx/defs/data_type_utils.h"
#endif
#include "onnx/onnx_pb.h"
#include "onnx/onnx-operators_pb.h"
struct OrtValue;

View file

@ -17,13 +17,7 @@
#ifndef SHARED_PROVIDER
#include "core/common/type_list.h"
#include "core/framework/data_types.h"
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#else
#include "onnx/defs/data_type_utils.h"
#endif
#include "onnx/onnx_pb.h"
#include "onnx/onnx-operators_pb.h"
#include "core/graph/onnx_protobuf.h"
#endif
namespace onnxruntime {

View file

@ -24,14 +24,8 @@
#include "core/framework/tensor.h"
#include "core/graph/constants.h"
#include "core/graph/graph_viewer.h"
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#else
#include "onnx/defs/data_type_utils.h"
#endif
#include "core/graph/onnx_protobuf.h"
#include "core/common/gsl.h"
#include "onnx/onnx-operators_pb.h"
#include "onnx/onnx_pb.h"
namespace onnxruntime {
class OpKernelContext;
}

View file

@ -7,7 +7,7 @@
#include <string>
#ifndef SHARED_PROVIDER
#include "onnx/onnx_pb.h"
#include "core/graph/onnx_protobuf.h"
#endif
#include "core/framework/float8.h"

View file

@ -16,15 +16,6 @@
#pragma warning(disable : 4244)
#endif
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#include "core/common/inlined_containers.h"
#else
#include "onnx/defs/data_type_utils.h"
#endif
#include "onnx/onnx_pb.h"
#include "onnx/onnx-operators_pb.h"
#ifdef _WIN32
#pragma warning(pop)
#endif
@ -33,11 +24,15 @@
#include "core/common/common.h"
#include "core/common/const_pointer_container.h"
#if !defined(ORT_MINIMAL_BUILD)
#include "core/common/inlined_containers.h"
#endif
#include "core/common/inlined_containers_fwd.h"
#include "core/common/path.h"
#include "core/common/span_utils.h"
#include "core/common/status.h"
#include "core/common/logging/logging.h"
#include "core/graph/onnx_protobuf.h"
#include "core/graph/basic_types.h"
#include "core/graph/constants.h"
#include "core/graph/function.h"

View file

@ -8,13 +8,7 @@
#include <vector>
#include "core/graph/basic_types.h"
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#else
#include "onnx/defs/data_type_utils.h"
#endif
#include "onnx/onnx_pb.h"
#include "onnx/onnx-operators_pb.h"
#include "core/graph/onnx_protobuf.h"
namespace onnxruntime {

View file

@ -7,10 +7,8 @@
#include <map>
#include <sstream>
#include "onnx/onnx_pb.h"
#include "onnx/onnx-operators_pb.h"
#include "core/graph/onnx_protobuf.h"
#include "onnx/defs/schema.h"
#include "core/graph/constants.h"
#include "core/common/common.h"
#include "core/common/status.h"

View file

@ -8,7 +8,7 @@
#include <utility>
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#include "core/graph/onnx_protobuf.h"
#endif // !defined(ORT_MINIMAL_BUILD)
#include "core/common/gsl.h"

View file

@ -3,13 +3,7 @@
#pragma once
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#else
#include "onnx/defs/data_type_utils.h"
#endif
#include "onnx/onnx_pb.h"
#include "onnx/onnx-operators_pb.h"
#include "core/graph/onnx_protobuf.h"
namespace onnxruntime {
namespace contrib {

View file

@ -3,11 +3,8 @@
#include "core/graph/contrib_ops/contrib_defs.h"
#include <cmath>
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#else
#include "onnx/defs/data_type_utils.h"
#endif
#include "core/graph/onnx_protobuf.h"
#include "onnx/defs/shape_inference.h"
#include "onnx/defs/tensor_proto_util.h"

View file

@ -4,7 +4,7 @@
#pragma once
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#include "core/graph/onnx_protobuf.h"
#include "core/graph/contrib_ops/ms_schema.h"
#else
#include "onnx/defs/data_type_utils.h"

View file

@ -9,6 +9,8 @@
#include "core/graph/contrib_ops/nhwc_inference_context.h"
#include "core/graph/contrib_ops/ms_schema.h" // contrib::GetOpSchema
#ifndef ORT_MINIMAL_BUILD
namespace onnxruntime {
namespace contrib {
class ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME(Microsoft, 1, QLinearAveragePool);
@ -157,3 +159,5 @@ void OpSet_Internal_NHWC_ONNX::ForEachSchema(const std::function<void(ONNX_NAMES
} // namespace internal_nhwc_onnx
} // namespace onnxruntime
#endif // !ORT_MINIMAL_BUILD

View file

@ -2,7 +2,9 @@
// Licensed under the MIT License.
#pragma once
#include "onnx/defs/schema.h"
#include "core/graph/onnx_protobuf.h"
#ifndef ORT_MINIMAL_BUILD
namespace onnxruntime {
namespace internal_nhwc_onnx {
@ -17,3 +19,5 @@ class OpSet_Internal_NHWC_ONNX {
} // namespace internal_nhwc_onnx
} // namespace onnxruntime
#endif // !ORT_MINIMAL_BUILD

View file

@ -2,7 +2,7 @@
// Licensed under the MIT License.
#pragma once
#include "onnx/defs/schema.h"
#include "core/graph/onnx_protobuf.h"
#include "core/graph/contrib_ops/ms_schema.h"
namespace onnxruntime {

View file

@ -3,7 +3,7 @@
#pragma once
#include "onnx/defs/schema.h"
#include "core/graph/onnx_protobuf.h"
namespace onnxruntime {
namespace contrib {
@ -12,4 +12,4 @@ namespace contrib {
template <typename T>
::ONNX_NAMESPACE::OpSchema GetOpSchema();
} // namespace contrib
} // namespace onnxruntime
} // namespace onnxruntime

View file

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "onnx/defs/schema.h"
#include "core/graph/onnx_protobuf.h"
#include "onnx/defs/shape_inference.h"
#include "onnx/defs/tensor_proto_util.h"
@ -503,4 +503,4 @@ ONNX_CONTRIB_OPERATOR_SET_SCHEMA(
// End of ONNX exp ops(Affine, Crop, ParametricSoftplus, ImageScaler, ThresholdedRelu, DynamicSlice, ScaledTanh, MVN)
// old version history maintenance
} // namespace contrib
} // namespace onnxruntime
} // namespace onnxruntime

View file

@ -3,7 +3,7 @@
#pragma once
#include "onnx/defs/schema.h"
#include "core/graph/onnx_protobuf.h"
#include "core/graph/contrib_ops/ms_schema.h"
// This file contains deprecated ONNX operators that have been removed from ONNX spec, but we still need to keep them
@ -59,4 +59,4 @@ class OpSet_ONNX_Deprecated {
}
};
} // namespace contrib
} // namespace onnxruntime
} // namespace onnxruntime

View file

@ -6,8 +6,7 @@
#include <string>
#include <vector>
#include "onnx/onnx-operators_pb.h"
#include "onnx/defs/schema.h"
#include "core/graph/onnx_protobuf.h"
#include "onnx/defs/function.h"
#include "onnx/defs/parser.h"
@ -21,4 +20,4 @@ inline static FunctionBodyHelper::NodeDef Const(const std::string& name, double
return FunctionBodyHelper::NodeDef{
{name}, "Constant", {}, {{"value", ToTensor(value, elem_type)}}};
}
} // namespace ONNX_NAMESPACE
} // namespace ONNX_NAMESPACE

View file

@ -4,13 +4,7 @@
#include <stdexcept>
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#else
#include "onnx/defs/data_type_utils.h"
#endif
#include "onnx/onnx_pb.h"
#include "onnx/onnx-operators_pb.h"
#include "core/graph/onnx_protobuf.h"
namespace onnxruntime {
namespace contrib {

View file

@ -3,13 +3,7 @@
#pragma once
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#else
#include "onnx/defs/data_type_utils.h"
#endif
#include "onnx/onnx_pb.h"
#include "onnx/onnx-operators_pb.h"
#include "core/graph/onnx_protobuf.h"
namespace onnxruntime {
namespace contrib {

View file

@ -2,6 +2,7 @@
// Licensed under the MIT License.
#include "core/graph/contrib_ops/shape_inference_functions.h"
#include "core/graph/onnx_protobuf.h"
#include <onnx/defs/shape_inference.h>
#include <iostream>

View file

@ -3,13 +3,7 @@
#pragma once
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#else
#include "onnx/defs/data_type_utils.h"
#endif
#include "onnx/onnx_pb.h"
#include "onnx/onnx-operators_pb.h"
#include "core/graph/onnx_protobuf.h"
namespace onnxruntime {
namespace dml {

View file

@ -5,7 +5,7 @@
#include <string>
#include "core/common/common.h"
#include "onnx/onnx_pb.h"
#include "core/graph/onnx_protobuf.h"
#include "core/graph/graph.h"
#include "core/graph/indexed_sub_graph.h"
#include "core/graph/function.h"

View file

@ -3,16 +3,9 @@
#pragma once
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#else
#include "onnx/defs/data_type_utils.h"
#endif
#include "onnx/onnx_pb.h"
#include "onnx/onnx-operators_pb.h"
#include "core/common/inlined_containers.h"
#include "core/common/span_utils.h"
#include "core/graph/onnx_protobuf.h"
#include "core/graph/graph.h"
namespace onnxruntime {

View file

@ -7,8 +7,7 @@
#include "core/common/gsl.h"
#include "onnx/onnx_pb.h"
#include "core/graph/onnx_protobuf.h"
#include "core/graph/basic_types.h"
namespace onnxruntime::utils {

View file

@ -2,6 +2,21 @@
// Licensed under the MIT License.
#pragma once
#include "onnxruntime_config.h"
#ifdef _WIN32
#pragma warning(push)
#pragma warning(disable : 4244)
#endif
#if defined(__GNUC__)
#pragma GCC diagnostic push
#ifdef HAS_SHORTEN_64_TO_32
#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
#endif
#endif
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
@ -11,3 +26,11 @@
#include "onnx/onnx_pb.h"
#include "onnx/onnx-operators_pb.h"
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
#ifdef _WIN32
#pragma warning(pop)
#endif

View file

@ -5,13 +5,7 @@
#include <functional>
#include <unordered_map>
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#else
#include "onnx/defs/data_type_utils.h"
#endif
#include "onnx/onnx_pb.h"
#include "onnx/onnx-operators_pb.h"
#include "core/graph/onnx_protobuf.h"
#include "core/common/status.h"
#include "core/graph/constants.h"

View file

@ -7,12 +7,7 @@
#include "core/common/status.h"
#include "core/graph/graph.h"
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h" // for ONNX_NAMESPACE::OpSchema
#endif // !defined(ORT_MINIMAL_BUILD)
#include "core/graph/onnx_protobuf.h"
namespace flatbuffers {
class FlatBufferBuilder;

View file

@ -10,7 +10,7 @@
#include "core/graph/basic_types.h"
#if !defined(ORT_MINIMAL_BUILD)
#include "onnx/defs/schema.h"
#include "core/graph/onnx_protobuf.h"
#endif
namespace onnxruntime {
@ -85,4 +85,4 @@ Status ValidateNodeGroupDQNodes(const GraphViewer& graph_viewer,
gsl::span<const Node* const> dq_nodes);
} // namespace QDQ
} // namespace onnxruntime
} // namespace onnxruntime

View file

@ -193,22 +193,6 @@ class PosixThread : public EnvThread {
}
size_t stack_size = thread_options.stack_size;
#if defined(__wasm__)
// emscripten 3.1.37 has a bug which does not take build flags 'STACK_SIZE' or 'DEFAULT_PTHREAD_STACK_SIZE'.
// the pthread stack size will always be 64kB, which is insufficient to run some kernels.
// we set the stack_size to a bigger value
//
// https://github.com/emscripten-core/emscripten/issues/19302
//
// TODO: once this issue is fixed by emscripten's new release, remove this code.
// future changes to DEFAULT_PTHREAD_STACK_SIZE will be in the following files
// - cmake/onnxruntime_unittests.cmake (target onnxruntime_test_all)
// - cmake/onnxruntime_webassembly.cmake (target onnxruntime_webassembly)
//
if (stack_size == 0) {
stack_size = 131072;
}
#endif
if (stack_size > 0) {
s = pthread_attr_setstacksize(&attr, stack_size);
if (s != 0) {

View file

@ -33,6 +33,10 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include "onnxruntime_config.h"
#ifdef HAS_SHORTEN_64_TO_32
#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
#endif
#endif
#include <google/protobuf/message_lite.h>
#include <google/protobuf/io/coded_stream.h>

View file

@ -402,7 +402,7 @@ def parse_arguments():
# WebAssembly build
parser.add_argument("--build_wasm", action="store_true", help="Build for WebAssembly")
parser.add_argument("--build_wasm_static_lib", action="store_true", help="Build for WebAssembly static library")
parser.add_argument("--emsdk_version", default="3.1.37", help="Specify version of emsdk")
parser.add_argument("--emsdk_version", default="3.1.44", help="Specify version of emsdk")
parser.add_argument("--enable_wasm_simd", action="store_true", help="Enable WebAssembly SIMD")
parser.add_argument("--enable_wasm_threads", action="store_true", help="Enable WebAssembly multi-threads support")

View file

@ -42,7 +42,7 @@ jobs:
variables:
EnvSetupScript: setup_env.bat
buildArch: x64
CommonBuildArgs: '--parallel --config ${{ parameters.BuildConfig }} --skip_submodule_sync --build_wasm --use_xnnpack --emsdk_version releases-7c905cfc1ca6699f6ccb288ae174902cfbdcf0a2-64bit ${{ parameters.ExtraBuildArgs }}'
CommonBuildArgs: '--parallel --config ${{ parameters.BuildConfig }} --skip_submodule_sync --build_wasm --use_xnnpack ${{ parameters.ExtraBuildArgs }}'
runCodesignValidationInjection: false
TODAY: $[format('{0:dd}{0:MM}{0:yyyy}', pipeline.startTime)]
ORT_CACHE_DIR: $(Agent.TempDirectory)/ort_ccache
@ -92,8 +92,8 @@ jobs:
- script: |
set -ex
cd '$(Build.SourcesDirectory)/cmake/external/emsdk'
./emsdk install 3.1.37 ccache-git-emscripten-64bit
./emsdk activate 3.1.37 ccache-git-emscripten-64bit
./emsdk install 3.1.44 ccache-git-emscripten-64bit
./emsdk activate 3.1.44 ccache-git-emscripten-64bit
ln -s $(Build.SourcesDirectory)/cmake/external/emsdk/ccache/git-emscripten_64bit/bin/ccache /usr/local/bin/ccache
displayName: 'emsdk install and activate ccache for emscripten'
condition: eq('${{ parameters.WithCache }}', 'true')

View file

@ -42,7 +42,7 @@ jobs:
variables:
EnvSetupScript: setup_env.bat
buildArch: x64
CommonBuildArgs: '--parallel --config ${{ parameters.BuildConfig }} --skip_submodule_sync --cmake_generator "MinGW Makefiles" --build_wasm --use_xnnpack --emsdk_version releases-7c905cfc1ca6699f6ccb288ae174902cfbdcf0a2-64bit ${{ parameters.ExtraBuildArgs }}'
CommonBuildArgs: '--parallel --config ${{ parameters.BuildConfig }} --skip_submodule_sync --cmake_generator "MinGW Makefiles" --build_wasm --use_xnnpack ${{ parameters.ExtraBuildArgs }}'
runCodesignValidationInjection: false
timeoutInMinutes: ${{ parameters.TimeoutInMinutes }}
workspace: