diff --git a/cgmanifests/generated/cgmanifest.json b/cgmanifests/generated/cgmanifest.json index cfad59be6b4c0..dc7e9c3fddb2f 100644 --- a/cgmanifests/generated/cgmanifest.json +++ b/cgmanifests/generated/cgmanifest.json @@ -86,7 +86,7 @@ "component": { "type": "git", "git": { - "commitHash": "6df40a2471737b27271bdd9b900ab5f3aec746c7", + "commitHash": "0100f6a5779831fa7a651e4b67ef389a8752bd9b", "repositoryUrl": "https://github.com/google/flatbuffers.git" }, "comments": "flatbuffers" diff --git a/cmake/deps.txt b/cmake/deps.txt index 9630b6185fcf6..4111689c5def9 100644 --- a/cmake/deps.txt +++ b/cmake/deps.txt @@ -23,7 +23,7 @@ dlpack;https://github.com/dmlc/dlpack/archive/refs/tags/v0.6.zip;4d565dd2e5b3132 # Until the 3.4.1 release this is the best option we have. # Issue link: https://gitlab.com/libeigen/eigen/-/issues/2744 eigen;https://gitlab.com/libeigen/eigen/-/archive/e7248b26a1ed53fa030c5c459f7ea095dfd276ac/eigen-e7248b26a1ed53fa030c5c459f7ea095dfd276ac.zip;be8be39fdbc6e60e94fa7870b280707069b5b81a -flatbuffers;https://github.com/google/flatbuffers/archive/refs/tags/v1.12.0.zip;ba0a75fd12dbef8f6557a74e611b7a3d0c5fe7bf +flatbuffers;https://github.com/google/flatbuffers/archive/refs/tags/v23.5.26.zip;59422c3b5e573dd192fead2834d25951f1c1670c fp16;https://github.com/Maratyszcza/FP16/archive/0a92994d729ff76a58f692d3028ca1b64b145d91.zip;b985f6985a05a1c03ff1bb71190f66d8f98a1494 fxdiv;https://github.com/Maratyszcza/FXdiv/archive/63058eff77e11aa15bf531df5dd34395ec3017c8.zip;a5658f4036402dbca7cebee32be57fb8149811e1 google_benchmark;https://github.com/google/benchmark/archive/refs/tags/v1.8.3.zip;bf9870756ee3f8d2d3b346b24ee3600a41c74d3d diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake index 75ccc2dfd83a0..ac1e187f357aa 100644 --- a/cmake/external/onnxruntime_external_deps.cmake +++ b/cmake/external/onnxruntime_external_deps.cmake @@ -109,7 +109,7 @@ FetchContent_Declare( URL ${DEP_URL_flatbuffers} URL_HASH SHA1=${DEP_SHA1_flatbuffers} PATCH_COMMAND ${ONNXRUNTIME_FLATBUFFERS_PATCH_COMMAND} - FIND_PACKAGE_ARGS 1.12.0...<2.0.0 NAMES Flatbuffers + FIND_PACKAGE_ARGS 23.5.9 NAMES Flatbuffers ) # Download a protoc binary from Internet if needed diff --git a/cmake/patches/flatbuffers/flatbuffers.patch b/cmake/patches/flatbuffers/flatbuffers.patch index f141d358c54b6..fbe8db37ecb0e 100644 --- a/cmake/patches/flatbuffers/flatbuffers.patch +++ b/cmake/patches/flatbuffers/flatbuffers.patch @@ -2,35 +2,11 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 3987eac9..5e5462f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -223,7 +223,7 @@ elseif(CMAKE_COMPILER_IS_GNUCXX) - "${CMAKE_CXX_FLAGS} -std=c++0x") - endif(CYGWIN) - set(CMAKE_CXX_FLAGS -- "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Werror=shadow") -+ "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Werror=shadow -Wno-error=stringop-overflow") - set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.4) - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0) -diff --git a/src/idl_gen_rust.cpp b/src/idl_gen_rust.cpp -index 55b8439b..dc03e8a8 100644 ---- a/src/idl_gen_rust.cpp -+++ b/src/idl_gen_rust.cpp -@@ -406,7 +406,8 @@ class RustGenerator : public BaseGenerator { - // example: f(A, D::E) -> super::D::E - // does not include leaf object (typically a struct type). - -- size_t i = 0; -+ // fix unused but set variable warning -+ //size_t i = 0; - std::stringstream stream; - - auto s = src->components.begin(); -@@ -417,7 +418,7 @@ class RustGenerator : public BaseGenerator { - if (*s != *d) { break; } - ++s; - ++d; -- ++i; -+ //++i; - } - - for (; s != src->components.end(); ++s) { stream << "super::"; } +@@ -279,5 +279,5 @@ + # Append FLATBUFFERS_CXX_FLAGS to CMAKE_CXX_FLAGS. + if(DEFINED FLATBUFFERS_CXX_FLAGS) + message(STATUS "extend CXX_FLAGS with ${FLATBUFFERS_CXX_FLAGS}") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLATBUFFERS_CXX_FLAGS}") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLATBUFFERS_CXX_FLAGS} -Wno-error=stringop-overflow") + endif() + message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") diff --git a/include/onnxruntime/core/graph/graph.h b/include/onnxruntime/core/graph/graph.h index b9b8a25286b7b..b16d52dbdab68 100644 --- a/include/onnxruntime/core/graph/graph.h +++ b/include/onnxruntime/core/graph/graph.h @@ -21,7 +21,7 @@ #pragma warning(pop) #endif -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" #include "core/common/gsl.h" diff --git a/onnxruntime/core/common/flatbuffers.h b/onnxruntime/core/common/flatbuffers.h new file mode 100644 index 0000000000000..0d61e1038a82c --- /dev/null +++ b/onnxruntime/core/common/flatbuffers.h @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#pragma once +#if defined(__GNUC__) +#include "onnxruntime_config.h" +#pragma GCC diagnostic push + +#ifdef HAS_SHORTEN_64_TO_32 +#pragma GCC diagnostic ignored "-Wshorten-64-to-32" +#endif +#endif + +#include "flatbuffers/flatbuffers.h" + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif \ No newline at end of file diff --git a/onnxruntime/core/flatbuffers/flatbuffers_utils.h b/onnxruntime/core/flatbuffers/flatbuffers_utils.h index 55bde0b2df806..76860d6ab1db8 100644 --- a/onnxruntime/core/flatbuffers/flatbuffers_utils.h +++ b/onnxruntime/core/flatbuffers/flatbuffers_utils.h @@ -5,7 +5,7 @@ #include -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" #include "core/common/common.h" #include "core/common/path_string.h" diff --git a/onnxruntime/core/flatbuffers/schema/README.md b/onnxruntime/core/flatbuffers/schema/README.md index 932478111ee68..96a2936c196ae 100644 --- a/onnxruntime/core/flatbuffers/schema/README.md +++ b/onnxruntime/core/flatbuffers/schema/README.md @@ -21,7 +21,7 @@ e.g. - /build/Linux/Debug/_deps/flatbuffers-build/flatc It is possible to use another flatc as well, e.g., from a separate installation. Note that ONNX Runtime uses -FlatBuffers 1.12. +FlatBuffers 23.5.26. To update the flatbuffers schemas and generated files: 1. Modify [the ORT file format schema](ort.fbs) or [training checkpoint schema](ort_training_checkpoint.fbs). diff --git a/onnxruntime/core/flatbuffers/schema/ort.fbs.h b/onnxruntime/core/flatbuffers/schema/ort.fbs.h index e0f5342c29621..dc8a471f2d81f 100644 --- a/onnxruntime/core/flatbuffers/schema/ort.fbs.h +++ b/onnxruntime/core/flatbuffers/schema/ort.fbs.h @@ -4,7 +4,7 @@ #ifndef FLATBUFFERS_GENERATED_ORT_ONNXRUNTIME_FBS_H_ #define FLATBUFFERS_GENERATED_ORT_ONNXRUNTIME_FBS_H_ -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" namespace onnxruntime { namespace fbs { @@ -562,8 +562,8 @@ struct DimensionValue FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_DIM_TYPE) && - VerifyField(verifier, VT_DIM_VALUE) && + VerifyField(verifier, VT_DIM_TYPE, 1) && + VerifyField(verifier, VT_DIM_VALUE, 8) && VerifyOffset(verifier, VT_DIM_PARAM) && verifier.VerifyString(dim_param()) && verifier.EndTable(); @@ -634,7 +634,7 @@ struct TensorTypeAndShape FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ELEM_TYPE) && + VerifyField(verifier, VT_ELEM_TYPE, 4) && VerifyOffset(verifier, VT_SHAPE) && verifier.VerifyTable(shape()) && verifier.EndTable(); @@ -687,7 +687,7 @@ struct MapType FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_KEY_TYPE) && + VerifyField(verifier, VT_KEY_TYPE, 4) && VerifyOffset(verifier, VT_VALUE_TYPE) && verifier.VerifyTable(value_type()) && verifier.EndTable(); @@ -787,7 +787,7 @@ struct NodeEdge FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_NODE_INDEX) && + VerifyField(verifier, VT_NODE_INDEX, 4) && VerifyOffset(verifier, VT_INPUT_EDGES) && verifier.VerifyVector(input_edges()) && VerifyOffset(verifier, VT_OUTPUT_EDGES) && @@ -911,11 +911,11 @@ struct Node FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { verifier.VerifyString(doc_string()) && VerifyOffset(verifier, VT_DOMAIN) && verifier.VerifyString(domain()) && - VerifyField(verifier, VT_SINCE_VERSION) && - VerifyField(verifier, VT_INDEX) && + VerifyField(verifier, VT_SINCE_VERSION, 4) && + VerifyField(verifier, VT_INDEX, 4) && VerifyOffset(verifier, VT_OP_TYPE) && verifier.VerifyString(op_type()) && - VerifyField(verifier, VT_TYPE) && + VerifyField(verifier, VT_TYPE, 4) && VerifyOffset(verifier, VT_EXECUTION_PROVIDER_TYPE) && verifier.VerifyString(execution_provider_type()) && VerifyOffset(verifier, VT_INPUTS) && @@ -1174,7 +1174,7 @@ struct TypeInfo FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_DENOTATION) && verifier.VerifyString(denotation()) && - VerifyField(verifier, VT_VALUE_TYPE) && + VerifyField(verifier, VT_VALUE_TYPE, 1) && VerifyOffset(verifier, VT_VALUE) && VerifyTypeInfoValue(verifier, value(), value_type()) && verifier.EndTable(); @@ -1259,7 +1259,7 @@ struct OperatorSetId FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_DOMAIN) && verifier.VerifyString(domain()) && - VerifyField(verifier, VT_VERSION) && + VerifyField(verifier, VT_VERSION, 8) && verifier.EndTable(); } }; @@ -1343,7 +1343,7 @@ struct Tensor FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { verifier.VerifyString(doc_string()) && VerifyOffset(verifier, VT_DIMS) && verifier.VerifyVector(dims()) && - VerifyField(verifier, VT_DATA_TYPE) && + VerifyField(verifier, VT_DATA_TYPE, 4) && VerifyOffset(verifier, VT_RAW_DATA) && verifier.VerifyVector(raw_data()) && VerifyOffset(verifier, VT_STRING_DATA) && @@ -1568,9 +1568,9 @@ struct Attribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { verifier.VerifyString(name()) && VerifyOffset(verifier, VT_DOC_STRING) && verifier.VerifyString(doc_string()) && - VerifyField(verifier, VT_TYPE) && - VerifyField(verifier, VT_F) && - VerifyField(verifier, VT_I) && + VerifyField(verifier, VT_TYPE, 4) && + VerifyField(verifier, VT_F, 4) && + VerifyField(verifier, VT_I, 8) && VerifyOffset(verifier, VT_S) && verifier.VerifyString(s()) && VerifyOffset(verifier, VT_T) && @@ -1759,12 +1759,12 @@ struct NodesToOptimizeIndices FLATBUFFERS_FINAL_CLASS : private flatbuffers::Tab return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_NODE_INDICES) && verifier.VerifyVector(node_indices()) && - VerifyField(verifier, VT_NUM_INPUTS) && - VerifyField(verifier, VT_NUM_OUTPUTS) && - VerifyField(verifier, VT_HAS_VARIADIC_INPUT) && - VerifyField(verifier, VT_HAS_VARIADIC_OUTPUT) && - VerifyField(verifier, VT_NUM_VARIADIC_INPUTS) && - VerifyField(verifier, VT_NUM_VARIADIC_OUTPUTS) && + VerifyField(verifier, VT_NUM_INPUTS, 4) && + VerifyField(verifier, VT_NUM_OUTPUTS, 4) && + VerifyField(verifier, VT_HAS_VARIADIC_INPUT, 1) && + VerifyField(verifier, VT_HAS_VARIADIC_OUTPUT, 1) && + VerifyField(verifier, VT_NUM_VARIADIC_INPUTS, 4) && + VerifyField(verifier, VT_NUM_VARIADIC_OUTPUTS, 4) && verifier.EndTable(); } }; @@ -1862,8 +1862,8 @@ struct DeprecatedNodeIndexAndKernelDefHash FLATBUFFERS_FINAL_CLASS : private fla } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_NODE_INDEX) && - VerifyField(verifier, VT_KERNEL_DEF_HASH) && + VerifyField(verifier, VT_NODE_INDEX, 4) && + VerifyField(verifier, VT_KERNEL_DEF_HASH, 8) && verifier.EndTable(); } }; @@ -2161,7 +2161,7 @@ struct Graph FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { VerifyOffset(verifier, VT_NODES) && verifier.VerifyVector(nodes()) && verifier.VerifyVectorOfTables(nodes()) && - VerifyField(verifier, VT_MAX_NODE_INDEX) && + VerifyField(verifier, VT_MAX_NODE_INDEX, 4) && VerifyOffset(verifier, VT_NODE_EDGES) && verifier.VerifyVector(node_edges()) && verifier.VerifyVectorOfTables(node_edges()) && @@ -2390,7 +2390,7 @@ struct Model FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_IR_VERSION) && + VerifyField(verifier, VT_IR_VERSION, 8) && VerifyOffset(verifier, VT_OPSET_IMPORT) && verifier.VerifyVector(opset_import()) && verifier.VerifyVectorOfTables(opset_import()) && @@ -2400,7 +2400,7 @@ struct Model FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { verifier.VerifyString(producer_version()) && VerifyOffset(verifier, VT_DOMAIN) && verifier.VerifyString(domain()) && - VerifyField(verifier, VT_MODEL_VERSION) && + VerifyField(verifier, VT_MODEL_VERSION, 8) && VerifyOffset(verifier, VT_DOC_STRING) && verifier.VerifyString(doc_string()) && VerifyOffset(verifier, VT_GRAPH) && @@ -2740,8 +2740,8 @@ struct ArgTypeAndIndex FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ARG_TYPE) && - VerifyField(verifier, VT_INDEX) && + VerifyField(verifier, VT_ARG_TYPE, 1) && + VerifyField(verifier, VT_INDEX, 4) && verifier.EndTable(); } }; diff --git a/onnxruntime/core/flatbuffers/schema/ort_training_checkpoint.fbs.h b/onnxruntime/core/flatbuffers/schema/ort_training_checkpoint.fbs.h index d205c5eb8f409..62e6cf74394e5 100644 --- a/onnxruntime/core/flatbuffers/schema/ort_training_checkpoint.fbs.h +++ b/onnxruntime/core/flatbuffers/schema/ort_training_checkpoint.fbs.h @@ -4,7 +4,7 @@ #ifndef FLATBUFFERS_GENERATED_ORTTRAININGCHECKPOINT_ONNXRUNTIME_FBS_H_ #define FLATBUFFERS_GENERATED_ORTTRAININGCHECKPOINT_ONNXRUNTIME_FBS_H_ -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" #include "ort.fbs.h" @@ -59,7 +59,7 @@ struct ModuleState FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { VerifyOffset(verifier, VT_FROZEN_PARAMS) && verifier.VerifyVector(frozen_params()) && verifier.VerifyVectorOfTables(frozen_params()) && - VerifyField(verifier, VT_IS_NOMINAL_STATE) && + VerifyField(verifier, VT_IS_NOMINAL_STATE, 1) && verifier.EndTable(); } }; @@ -206,8 +206,8 @@ struct OptimizerGroup FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_GROUP_NAME) && verifier.VerifyString(group_name()) && - VerifyField(verifier, VT_STEP) && - VerifyField(verifier, VT_INITIAL_LEARNING_RATE) && + VerifyField(verifier, VT_STEP, 8) && + VerifyField(verifier, VT_INITIAL_LEARNING_RATE, 4) && VerifyOffset(verifier, VT_OPTIMIZER_STATES) && verifier.VerifyVector(optimizer_states()) && verifier.VerifyVectorOfTables(optimizer_states()) && @@ -289,7 +289,7 @@ struct IntProperty FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_NAME) && verifier.VerifyString(name()) && - VerifyField(verifier, VT_VALUE) && + VerifyField(verifier, VT_VALUE, 8) && verifier.EndTable(); } }; @@ -353,7 +353,7 @@ struct FloatProperty FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_NAME) && verifier.VerifyString(name()) && - VerifyField(verifier, VT_VALUE) && + VerifyField(verifier, VT_VALUE, 4) && verifier.EndTable(); } }; @@ -572,7 +572,7 @@ struct Checkpoint FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_VERSION) && + VerifyField(verifier, VT_VERSION, 4) && VerifyOffset(verifier, VT_MODULE_STATE) && verifier.VerifyTable(module_state()) && VerifyOffset(verifier, VT_OPTIMIZER_GROUPS) && diff --git a/onnxruntime/core/framework/kernel_type_str_resolver.h b/onnxruntime/core/framework/kernel_type_str_resolver.h index 31a806dd52291..fea2a6ef3a439 100644 --- a/onnxruntime/core/framework/kernel_type_str_resolver.h +++ b/onnxruntime/core/framework/kernel_type_str_resolver.h @@ -7,7 +7,7 @@ #include #include -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" #if !defined(ORT_MINIMAL_BUILD) #include "core/graph/onnx_protobuf.h" diff --git a/onnxruntime/core/framework/kernel_type_str_resolver_utils.cc b/onnxruntime/core/framework/kernel_type_str_resolver_utils.cc index 4f5fa9910b5df..473e78c3f5e25 100644 --- a/onnxruntime/core/framework/kernel_type_str_resolver_utils.cc +++ b/onnxruntime/core/framework/kernel_type_str_resolver_utils.cc @@ -5,7 +5,7 @@ #include "core/framework/kernel_type_str_resolver_utils.h" -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" #include "core/common/common.h" #include "core/flatbuffers/schema/ort.fbs.h" diff --git a/onnxruntime/core/framework/session_state.h b/onnxruntime/core/framework/session_state.h index 51bb02918d82f..a2ee1601d386b 100644 --- a/onnxruntime/core/framework/session_state.h +++ b/onnxruntime/core/framework/session_state.h @@ -8,7 +8,7 @@ #include #include -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" #include "core/common/gsl.h" diff --git a/onnxruntime/core/graph/graph_flatbuffers_utils.cc b/onnxruntime/core/graph/graph_flatbuffers_utils.cc index 6d7ed94b2956d..2314a5228f83c 100644 --- a/onnxruntime/core/graph/graph_flatbuffers_utils.cc +++ b/onnxruntime/core/graph/graph_flatbuffers_utils.cc @@ -3,7 +3,7 @@ #include "graph_flatbuffers_utils.h" -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" #include "core/common/narrow.h" #include "core/flatbuffers/flatbuffers_utils.h" diff --git a/onnxruntime/core/graph/graph_flatbuffers_utils.h b/onnxruntime/core/graph/graph_flatbuffers_utils.h index b625cbf3ca492..9c55dad3c41ef 100644 --- a/onnxruntime/core/graph/graph_flatbuffers_utils.h +++ b/onnxruntime/core/graph/graph_flatbuffers_utils.h @@ -5,7 +5,7 @@ #include -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" #include "core/common/status.h" #include "core/graph/ort_format_load_options.h" diff --git a/onnxruntime/core/graph/model.h b/onnxruntime/core/graph/model.h index 4ce6660b794bc..a774d5fe34461 100644 --- a/onnxruntime/core/graph/model.h +++ b/onnxruntime/core/graph/model.h @@ -8,7 +8,7 @@ #include #include -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" #include "core/common/path.h" #include "core/graph/graph_viewer.h" diff --git a/onnxruntime/core/graph/op_identifier_utils.h b/onnxruntime/core/graph/op_identifier_utils.h index 8a9351a2d0ddc..f7b1198c31972 100644 --- a/onnxruntime/core/graph/op_identifier_utils.h +++ b/onnxruntime/core/graph/op_identifier_utils.h @@ -3,7 +3,7 @@ #pragma once -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" #include "core/graph/op_identifier.h" diff --git a/onnxruntime/core/graph/runtime_optimization_record_container.h b/onnxruntime/core/graph/runtime_optimization_record_container.h index a28b19e786de0..75750c2b96987 100644 --- a/onnxruntime/core/graph/runtime_optimization_record_container.h +++ b/onnxruntime/core/graph/runtime_optimization_record_container.h @@ -9,7 +9,7 @@ #include #include -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" #include "core/common/common.h" #include "core/graph/runtime_optimization_record.h" diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/DmlGraphDesc_generated.h b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/DmlGraphDesc_generated.h index 72059b9a3f911..df485396f1e47 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/DmlGraphDesc_generated.h +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/DmlGraphDesc_generated.h @@ -4,7 +4,14 @@ #ifndef FLATBUFFERS_GENERATED_DMLGRAPHDESC_DML_IR_H_ #define FLATBUFFERS_GENERATED_DMLGRAPHDESC_DML_IR_H_ -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" + +// Ensure the included flatbuffers.h is the same version as when this file was +// generated, otherwise it may not be compatible. +static_assert(FLATBUFFERS_VERSION_MAJOR == 23 && + FLATBUFFERS_VERSION_MINOR == 5 && + FLATBUFFERS_VERSION_REVISION == 26, + "Non-compatible flatbuffers version included"); #include "OperatorFieldTypes_generated.h" @@ -32,7 +39,7 @@ struct DmlGraphNodeBuilder; struct DmlGraphDesc; struct DmlGraphDescBuilder; -enum ConstantNodeDescDetail { +enum ConstantNodeDescDetail : uint8_t { ConstantNodeDescDetail_NONE = 0, ConstantNodeDescDetail_ConstantName = 1, ConstantNodeDescDetail_ConstantRawData = 2, @@ -60,7 +67,7 @@ inline const char * const *EnumNamesConstantNodeDescDetail() { } inline const char *EnumNameConstantNodeDescDetail(ConstantNodeDescDetail e) { - if (flatbuffers::IsOutRange(e, ConstantNodeDescDetail_NONE, ConstantNodeDescDetail_ConstantRawData)) return ""; + if (::flatbuffers::IsOutRange(e, ConstantNodeDescDetail_NONE, ConstantNodeDescDetail_ConstantRawData)) return ""; const size_t index = static_cast(e); return EnumNamesConstantNodeDescDetail()[index]; } @@ -77,10 +84,10 @@ template<> struct ConstantNodeDescDetailTraits { static const ConstantNodeDescDetail enum_value = ConstantNodeDescDetail_ConstantRawData; }; -bool VerifyConstantNodeDescDetail(flatbuffers::Verifier &verifier, const void *obj, ConstantNodeDescDetail type); -bool VerifyConstantNodeDescDetailVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types); +bool VerifyConstantNodeDescDetail(::flatbuffers::Verifier &verifier, const void *obj, ConstantNodeDescDetail type); +bool VerifyConstantNodeDescDetailVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset> *values, const ::flatbuffers::Vector *types); -enum NodeDesc { +enum NodeDesc : uint8_t { NodeDesc_NONE = 0, NodeDesc_OperatorNodeDesc = 1, NodeDesc_ConstantNodeDesc = 2, @@ -108,7 +115,7 @@ inline const char * const *EnumNamesNodeDesc() { } inline const char *EnumNameNodeDesc(NodeDesc e) { - if (flatbuffers::IsOutRange(e, NodeDesc_NONE, NodeDesc_ConstantNodeDesc)) return ""; + if (::flatbuffers::IsOutRange(e, NodeDesc_NONE, NodeDesc_ConstantNodeDesc)) return ""; const size_t index = static_cast(e); return EnumNamesNodeDesc()[index]; } @@ -125,18 +132,21 @@ template<> struct NodeDescTraits { static const NodeDesc enum_value = NodeDesc_ConstantNodeDesc; }; -bool VerifyNodeDesc(flatbuffers::Verifier &verifier, const void *obj, NodeDesc type); -bool VerifyNodeDescVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types); +bool VerifyNodeDesc(::flatbuffers::Verifier &verifier, const void *obj, NodeDesc type); +bool VerifyNodeDescVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset> *values, const ::flatbuffers::Vector *types); -struct ConstantRawData FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct ConstantRawData FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef ConstantRawDataBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_DATA = 4 }; - const flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); + const ::flatbuffers::Vector *data() const { + return GetPointer *>(VT_DATA); + } + ::flatbuffers::Vector *mutable_data() { + return GetPointer<::flatbuffers::Vector *>(VT_DATA); } - bool Verify(flatbuffers::Verifier &verifier) const { + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_DATA) && verifier.VerifyVector(data()) && @@ -146,33 +156,32 @@ struct ConstantRawData FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { struct ConstantRawDataBuilder { typedef ConstantRawData Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_data(flatbuffers::Offset> data) { + ::flatbuffers::FlatBufferBuilder &fbb_; + ::flatbuffers::uoffset_t start_; + void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) { fbb_.AddOffset(ConstantRawData::VT_DATA, data); } - explicit ConstantRawDataBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit ConstantRawDataBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - ConstantRawDataBuilder &operator=(const ConstantRawDataBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateConstantRawData( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> data = 0) { +inline ::flatbuffers::Offset CreateConstantRawData( + ::flatbuffers::FlatBufferBuilder &_fbb, + ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) { ConstantRawDataBuilder builder_(_fbb); builder_.add_data(data); return builder_.Finish(); } -inline flatbuffers::Offset CreateConstantRawDataDirect( - flatbuffers::FlatBufferBuilder &_fbb, +inline ::flatbuffers::Offset CreateConstantRawDataDirect( + ::flatbuffers::FlatBufferBuilder &_fbb, const std::vector *data = nullptr) { auto data__ = data ? _fbb.CreateVector(*data) : 0; return dml::ir::CreateConstantRawData( @@ -180,15 +189,18 @@ inline flatbuffers::Offset CreateConstantRawDataDirect( data__); } -struct ConstantName FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct ConstantName FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef ConstantNameBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_NAME = 4 }; - const flatbuffers::String *name() const { - return GetPointer(VT_NAME); + const ::flatbuffers::String *name() const { + return GetPointer(VT_NAME); + } + ::flatbuffers::String *mutable_name() { + return GetPointer<::flatbuffers::String *>(VT_NAME); } - bool Verify(flatbuffers::Verifier &verifier) const { + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_NAME) && verifier.VerifyString(name()) && @@ -198,33 +210,32 @@ struct ConstantName FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { struct ConstantNameBuilder { typedef ConstantName Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_name(flatbuffers::Offset name) { + ::flatbuffers::FlatBufferBuilder &fbb_; + ::flatbuffers::uoffset_t start_; + void add_name(::flatbuffers::Offset<::flatbuffers::String> name) { fbb_.AddOffset(ConstantName::VT_NAME, name); } - explicit ConstantNameBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit ConstantNameBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - ConstantNameBuilder &operator=(const ConstantNameBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateConstantName( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset name = 0) { +inline ::flatbuffers::Offset CreateConstantName( + ::flatbuffers::FlatBufferBuilder &_fbb, + ::flatbuffers::Offset<::flatbuffers::String> name = 0) { ConstantNameBuilder builder_(_fbb); builder_.add_name(name); return builder_.Finish(); } -inline flatbuffers::Offset CreateConstantNameDirect( - flatbuffers::FlatBufferBuilder &_fbb, +inline ::flatbuffers::Offset CreateConstantNameDirect( + ::flatbuffers::FlatBufferBuilder &_fbb, const char *name = nullptr) { auto name__ = name ? _fbb.CreateString(name) : 0; return dml::ir::CreateConstantName( @@ -232,7 +243,7 @@ inline flatbuffers::Offset CreateConstantNameDirect( name__); } -struct ConstantNodeDesc FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct ConstantNodeDesc FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef ConstantNodeDescBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_DATA_TYPE = 4, @@ -251,9 +262,12 @@ struct ConstantNodeDesc FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { const dml::ir::ConstantRawData *data_as_ConstantRawData() const { return data_type() == dml::ir::ConstantNodeDescDetail_ConstantRawData ? static_cast(data()) : nullptr; } - bool Verify(flatbuffers::Verifier &verifier) const { + void *mutable_data() { + return GetPointer(VT_DATA); + } + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_DATA_TYPE) && + VerifyField(verifier, VT_DATA_TYPE, 1) && VerifyOffset(verifier, VT_DATA) && VerifyConstantNodeDescDetail(verifier, data(), data_type()) && verifier.EndTable(); @@ -270,37 +284,36 @@ template<> inline const dml::ir::ConstantRawData *ConstantNodeDesc::data_as(ConstantNodeDesc::VT_DATA_TYPE, static_cast(data_type), 0); } - void add_data(flatbuffers::Offset data) { + void add_data(::flatbuffers::Offset data) { fbb_.AddOffset(ConstantNodeDesc::VT_DATA, data); } - explicit ConstantNodeDescBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit ConstantNodeDescBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - ConstantNodeDescBuilder &operator=(const ConstantNodeDescBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateConstantNodeDesc( - flatbuffers::FlatBufferBuilder &_fbb, +inline ::flatbuffers::Offset CreateConstantNodeDesc( + ::flatbuffers::FlatBufferBuilder &_fbb, dml::ir::ConstantNodeDescDetail data_type = dml::ir::ConstantNodeDescDetail_NONE, - flatbuffers::Offset data = 0) { + ::flatbuffers::Offset data = 0) { ConstantNodeDescBuilder builder_(_fbb); builder_.add_data(data); builder_.add_data_type(data_type); return builder_.Finish(); } -struct DmlBufferTensorDesc FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct DmlBufferTensorDesc FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef DmlBufferTensorDescBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_DATATYPE = 4, @@ -308,19 +321,31 @@ struct DmlBufferTensorDesc FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table VT_STRIDES = 8, VT_TOTALTENSORSIZEINBYTES = 10 }; - const flatbuffers::String *dataType() const { - return GetPointer(VT_DATATYPE); + const ::flatbuffers::String *dataType() const { + return GetPointer(VT_DATATYPE); + } + ::flatbuffers::String *mutable_dataType() { + return GetPointer<::flatbuffers::String *>(VT_DATATYPE); + } + const ::flatbuffers::Vector *sizes() const { + return GetPointer *>(VT_SIZES); } - const flatbuffers::Vector *sizes() const { - return GetPointer *>(VT_SIZES); + ::flatbuffers::Vector *mutable_sizes() { + return GetPointer<::flatbuffers::Vector *>(VT_SIZES); } - const flatbuffers::Vector *strides() const { - return GetPointer *>(VT_STRIDES); + const ::flatbuffers::Vector *strides() const { + return GetPointer *>(VT_STRIDES); + } + ::flatbuffers::Vector *mutable_strides() { + return GetPointer<::flatbuffers::Vector *>(VT_STRIDES); } uint64_t totalTensorSizeInBytes() const { return GetField(VT_TOTALTENSORSIZEINBYTES, 0); } - bool Verify(flatbuffers::Verifier &verifier) const { + bool mutate_totalTensorSizeInBytes(uint64_t _totalTensorSizeInBytes = 0) { + return SetField(VT_TOTALTENSORSIZEINBYTES, _totalTensorSizeInBytes, 0); + } + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_DATATYPE) && verifier.VerifyString(dataType()) && @@ -328,44 +353,43 @@ struct DmlBufferTensorDesc FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table verifier.VerifyVector(sizes()) && VerifyOffset(verifier, VT_STRIDES) && verifier.VerifyVector(strides()) && - VerifyField(verifier, VT_TOTALTENSORSIZEINBYTES) && + VerifyField(verifier, VT_TOTALTENSORSIZEINBYTES, 8) && verifier.EndTable(); } }; struct DmlBufferTensorDescBuilder { typedef DmlBufferTensorDesc Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_dataType(flatbuffers::Offset dataType) { + ::flatbuffers::FlatBufferBuilder &fbb_; + ::flatbuffers::uoffset_t start_; + void add_dataType(::flatbuffers::Offset<::flatbuffers::String> dataType) { fbb_.AddOffset(DmlBufferTensorDesc::VT_DATATYPE, dataType); } - void add_sizes(flatbuffers::Offset> sizes) { + void add_sizes(::flatbuffers::Offset<::flatbuffers::Vector> sizes) { fbb_.AddOffset(DmlBufferTensorDesc::VT_SIZES, sizes); } - void add_strides(flatbuffers::Offset> strides) { + void add_strides(::flatbuffers::Offset<::flatbuffers::Vector> strides) { fbb_.AddOffset(DmlBufferTensorDesc::VT_STRIDES, strides); } void add_totalTensorSizeInBytes(uint64_t totalTensorSizeInBytes) { fbb_.AddElement(DmlBufferTensorDesc::VT_TOTALTENSORSIZEINBYTES, totalTensorSizeInBytes, 0); } - explicit DmlBufferTensorDescBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit DmlBufferTensorDescBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - DmlBufferTensorDescBuilder &operator=(const DmlBufferTensorDescBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateDmlBufferTensorDesc( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset dataType = 0, - flatbuffers::Offset> sizes = 0, - flatbuffers::Offset> strides = 0, +inline ::flatbuffers::Offset CreateDmlBufferTensorDesc( + ::flatbuffers::FlatBufferBuilder &_fbb, + ::flatbuffers::Offset<::flatbuffers::String> dataType = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> sizes = 0, + ::flatbuffers::Offset<::flatbuffers::Vector> strides = 0, uint64_t totalTensorSizeInBytes = 0) { DmlBufferTensorDescBuilder builder_(_fbb); builder_.add_totalTensorSizeInBytes(totalTensorSizeInBytes); @@ -375,8 +399,8 @@ inline flatbuffers::Offset CreateDmlBufferTensorDesc( return builder_.Finish(); } -inline flatbuffers::Offset CreateDmlBufferTensorDescDirect( - flatbuffers::FlatBufferBuilder &_fbb, +inline ::flatbuffers::Offset CreateDmlBufferTensorDescDirect( + ::flatbuffers::FlatBufferBuilder &_fbb, const char *dataType = nullptr, const std::vector *sizes = nullptr, const std::vector *strides = nullptr, @@ -392,7 +416,7 @@ inline flatbuffers::Offset CreateDmlBufferTensorDescDirect( totalTensorSizeInBytes); } -struct OperatorNodeDesc FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct OperatorNodeDesc FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef OperatorNodeDescBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_TYPE = 4, @@ -400,19 +424,31 @@ struct OperatorNodeDesc FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { VT_OUTPUTS = 8, VT_ATTRIBUTES = 10 }; - const flatbuffers::String *type() const { - return GetPointer(VT_TYPE); + const ::flatbuffers::String *type() const { + return GetPointer(VT_TYPE); + } + ::flatbuffers::String *mutable_type() { + return GetPointer<::flatbuffers::String *>(VT_TYPE); + } + const ::flatbuffers::Vector<::flatbuffers::Offset> *inputs() const { + return GetPointer> *>(VT_INPUTS); + } + ::flatbuffers::Vector<::flatbuffers::Offset> *mutable_inputs() { + return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset> *>(VT_INPUTS); + } + const ::flatbuffers::Vector<::flatbuffers::Offset> *outputs() const { + return GetPointer> *>(VT_OUTPUTS); } - const flatbuffers::Vector> *inputs() const { - return GetPointer> *>(VT_INPUTS); + ::flatbuffers::Vector<::flatbuffers::Offset> *mutable_outputs() { + return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset> *>(VT_OUTPUTS); } - const flatbuffers::Vector> *outputs() const { - return GetPointer> *>(VT_OUTPUTS); + const ::flatbuffers::Vector<::flatbuffers::Offset> *attributes() const { + return GetPointer> *>(VT_ATTRIBUTES); } - const flatbuffers::Vector> *attributes() const { - return GetPointer> *>(VT_ATTRIBUTES); + ::flatbuffers::Vector<::flatbuffers::Offset> *mutable_attributes() { + return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset> *>(VT_ATTRIBUTES); } - bool Verify(flatbuffers::Verifier &verifier) const { + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_TYPE) && verifier.VerifyString(type()) && @@ -431,38 +467,37 @@ struct OperatorNodeDesc FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { struct OperatorNodeDescBuilder { typedef OperatorNodeDesc Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_type(flatbuffers::Offset type) { + ::flatbuffers::FlatBufferBuilder &fbb_; + ::flatbuffers::uoffset_t start_; + void add_type(::flatbuffers::Offset<::flatbuffers::String> type) { fbb_.AddOffset(OperatorNodeDesc::VT_TYPE, type); } - void add_inputs(flatbuffers::Offset>> inputs) { + void add_inputs(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> inputs) { fbb_.AddOffset(OperatorNodeDesc::VT_INPUTS, inputs); } - void add_outputs(flatbuffers::Offset>> outputs) { + void add_outputs(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> outputs) { fbb_.AddOffset(OperatorNodeDesc::VT_OUTPUTS, outputs); } - void add_attributes(flatbuffers::Offset>> attributes) { + void add_attributes(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attributes) { fbb_.AddOffset(OperatorNodeDesc::VT_ATTRIBUTES, attributes); } - explicit OperatorNodeDescBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit OperatorNodeDescBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - OperatorNodeDescBuilder &operator=(const OperatorNodeDescBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateOperatorNodeDesc( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset type = 0, - flatbuffers::Offset>> inputs = 0, - flatbuffers::Offset>> outputs = 0, - flatbuffers::Offset>> attributes = 0) { +inline ::flatbuffers::Offset CreateOperatorNodeDesc( + ::flatbuffers::FlatBufferBuilder &_fbb, + ::flatbuffers::Offset<::flatbuffers::String> type = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> inputs = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> outputs = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attributes = 0) { OperatorNodeDescBuilder builder_(_fbb); builder_.add_attributes(attributes); builder_.add_outputs(outputs); @@ -471,16 +506,16 @@ inline flatbuffers::Offset CreateOperatorNodeDesc( return builder_.Finish(); } -inline flatbuffers::Offset CreateOperatorNodeDescDirect( - flatbuffers::FlatBufferBuilder &_fbb, +inline ::flatbuffers::Offset CreateOperatorNodeDescDirect( + ::flatbuffers::FlatBufferBuilder &_fbb, const char *type = nullptr, - const std::vector> *inputs = nullptr, - const std::vector> *outputs = nullptr, - const std::vector> *attributes = nullptr) { + const std::vector<::flatbuffers::Offset> *inputs = nullptr, + const std::vector<::flatbuffers::Offset> *outputs = nullptr, + const std::vector<::flatbuffers::Offset> *attributes = nullptr) { auto type__ = type ? _fbb.CreateString(type) : 0; - auto inputs__ = inputs ? _fbb.CreateVector>(*inputs) : 0; - auto outputs__ = outputs ? _fbb.CreateVector>(*outputs) : 0; - auto attributes__ = attributes ? _fbb.CreateVector>(*attributes) : 0; + auto inputs__ = inputs ? _fbb.CreateVector<::flatbuffers::Offset>(*inputs) : 0; + auto outputs__ = outputs ? _fbb.CreateVector<::flatbuffers::Offset>(*outputs) : 0; + auto attributes__ = attributes ? _fbb.CreateVector<::flatbuffers::Offset>(*attributes) : 0; return dml::ir::CreateOperatorNodeDesc( _fbb, type__, @@ -489,7 +524,7 @@ inline flatbuffers::Offset CreateOperatorNodeDescDirect( attributes__); } -struct DmlGraphNode FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct DmlGraphNode FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef DmlGraphNodeBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_DESC_TYPE = 4, @@ -511,18 +546,30 @@ struct DmlGraphNode FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { const dml::ir::ConstantNodeDesc *desc_as_ConstantNodeDesc() const { return desc_type() == dml::ir::NodeDesc_ConstantNodeDesc ? static_cast(desc()) : nullptr; } - const flatbuffers::String *name() const { - return GetPointer(VT_NAME); + void *mutable_desc() { + return GetPointer(VT_DESC); } - const flatbuffers::Vector> *inputNames() const { - return GetPointer> *>(VT_INPUTNAMES); + const ::flatbuffers::String *name() const { + return GetPointer(VT_NAME); } - const flatbuffers::Vector> *outputNames() const { - return GetPointer> *>(VT_OUTPUTNAMES); + ::flatbuffers::String *mutable_name() { + return GetPointer<::flatbuffers::String *>(VT_NAME); } - bool Verify(flatbuffers::Verifier &verifier) const { + const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *inputNames() const { + return GetPointer> *>(VT_INPUTNAMES); + } + ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *mutable_inputNames() { + return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_INPUTNAMES); + } + const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *outputNames() const { + return GetPointer> *>(VT_OUTPUTNAMES); + } + ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *mutable_outputNames() { + return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_OUTPUTNAMES); + } + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_DESC_TYPE) && + VerifyField(verifier, VT_DESC_TYPE, 1) && VerifyOffset(verifier, VT_DESC) && VerifyNodeDesc(verifier, desc(), desc_type()) && VerifyOffset(verifier, VT_NAME) && @@ -547,42 +594,41 @@ template<> inline const dml::ir::ConstantNodeDesc *DmlGraphNode::desc_as(DmlGraphNode::VT_DESC_TYPE, static_cast(desc_type), 0); } - void add_desc(flatbuffers::Offset desc) { + void add_desc(::flatbuffers::Offset desc) { fbb_.AddOffset(DmlGraphNode::VT_DESC, desc); } - void add_name(flatbuffers::Offset name) { + void add_name(::flatbuffers::Offset<::flatbuffers::String> name) { fbb_.AddOffset(DmlGraphNode::VT_NAME, name); } - void add_inputNames(flatbuffers::Offset>> inputNames) { + void add_inputNames(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> inputNames) { fbb_.AddOffset(DmlGraphNode::VT_INPUTNAMES, inputNames); } - void add_outputNames(flatbuffers::Offset>> outputNames) { + void add_outputNames(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> outputNames) { fbb_.AddOffset(DmlGraphNode::VT_OUTPUTNAMES, outputNames); } - explicit DmlGraphNodeBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit DmlGraphNodeBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - DmlGraphNodeBuilder &operator=(const DmlGraphNodeBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateDmlGraphNode( - flatbuffers::FlatBufferBuilder &_fbb, +inline ::flatbuffers::Offset CreateDmlGraphNode( + ::flatbuffers::FlatBufferBuilder &_fbb, dml::ir::NodeDesc desc_type = dml::ir::NodeDesc_NONE, - flatbuffers::Offset desc = 0, - flatbuffers::Offset name = 0, - flatbuffers::Offset>> inputNames = 0, - flatbuffers::Offset>> outputNames = 0) { + ::flatbuffers::Offset desc = 0, + ::flatbuffers::Offset<::flatbuffers::String> name = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> inputNames = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> outputNames = 0) { DmlGraphNodeBuilder builder_(_fbb); builder_.add_outputNames(outputNames); builder_.add_inputNames(inputNames); @@ -592,16 +638,16 @@ inline flatbuffers::Offset CreateDmlGraphNode( return builder_.Finish(); } -inline flatbuffers::Offset CreateDmlGraphNodeDirect( - flatbuffers::FlatBufferBuilder &_fbb, +inline ::flatbuffers::Offset CreateDmlGraphNodeDirect( + ::flatbuffers::FlatBufferBuilder &_fbb, dml::ir::NodeDesc desc_type = dml::ir::NodeDesc_NONE, - flatbuffers::Offset desc = 0, + ::flatbuffers::Offset desc = 0, const char *name = nullptr, - const std::vector> *inputNames = nullptr, - const std::vector> *outputNames = nullptr) { + const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *inputNames = nullptr, + const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *outputNames = nullptr) { auto name__ = name ? _fbb.CreateString(name) : 0; - auto inputNames__ = inputNames ? _fbb.CreateVector>(*inputNames) : 0; - auto outputNames__ = outputNames ? _fbb.CreateVector>(*outputNames) : 0; + auto inputNames__ = inputNames ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*inputNames) : 0; + auto outputNames__ = outputNames ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*outputNames) : 0; return dml::ir::CreateDmlGraphNode( _fbb, desc_type, @@ -611,23 +657,32 @@ inline flatbuffers::Offset CreateDmlGraphNodeDirect( outputNames__); } -struct DmlGraphDesc FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct DmlGraphDesc FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef DmlGraphDescBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_NODES = 4, VT_GRAPHINPUTNAMES = 6, VT_GRAPHOUTPUTNAMES = 8 }; - const flatbuffers::Vector> *nodes() const { - return GetPointer> *>(VT_NODES); + const ::flatbuffers::Vector<::flatbuffers::Offset> *nodes() const { + return GetPointer> *>(VT_NODES); + } + ::flatbuffers::Vector<::flatbuffers::Offset> *mutable_nodes() { + return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset> *>(VT_NODES); + } + const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *graphInputNames() const { + return GetPointer> *>(VT_GRAPHINPUTNAMES); } - const flatbuffers::Vector> *graphInputNames() const { - return GetPointer> *>(VT_GRAPHINPUTNAMES); + ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *mutable_graphInputNames() { + return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_GRAPHINPUTNAMES); } - const flatbuffers::Vector> *graphOutputNames() const { - return GetPointer> *>(VT_GRAPHOUTPUTNAMES); + const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *graphOutputNames() const { + return GetPointer> *>(VT_GRAPHOUTPUTNAMES); } - bool Verify(flatbuffers::Verifier &verifier) const { + ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *mutable_graphOutputNames() { + return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_GRAPHOUTPUTNAMES); + } + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_NODES) && verifier.VerifyVector(nodes()) && @@ -644,34 +699,33 @@ struct DmlGraphDesc FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { struct DmlGraphDescBuilder { typedef DmlGraphDesc Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_nodes(flatbuffers::Offset>> nodes) { + ::flatbuffers::FlatBufferBuilder &fbb_; + ::flatbuffers::uoffset_t start_; + void add_nodes(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> nodes) { fbb_.AddOffset(DmlGraphDesc::VT_NODES, nodes); } - void add_graphInputNames(flatbuffers::Offset>> graphInputNames) { + void add_graphInputNames(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> graphInputNames) { fbb_.AddOffset(DmlGraphDesc::VT_GRAPHINPUTNAMES, graphInputNames); } - void add_graphOutputNames(flatbuffers::Offset>> graphOutputNames) { + void add_graphOutputNames(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> graphOutputNames) { fbb_.AddOffset(DmlGraphDesc::VT_GRAPHOUTPUTNAMES, graphOutputNames); } - explicit DmlGraphDescBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit DmlGraphDescBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - DmlGraphDescBuilder &operator=(const DmlGraphDescBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateDmlGraphDesc( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset>> nodes = 0, - flatbuffers::Offset>> graphInputNames = 0, - flatbuffers::Offset>> graphOutputNames = 0) { +inline ::flatbuffers::Offset CreateDmlGraphDesc( + ::flatbuffers::FlatBufferBuilder &_fbb, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> nodes = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> graphInputNames = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> graphOutputNames = 0) { DmlGraphDescBuilder builder_(_fbb); builder_.add_graphOutputNames(graphOutputNames); builder_.add_graphInputNames(graphInputNames); @@ -679,14 +733,14 @@ inline flatbuffers::Offset CreateDmlGraphDesc( return builder_.Finish(); } -inline flatbuffers::Offset CreateDmlGraphDescDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector> *nodes = nullptr, - const std::vector> *graphInputNames = nullptr, - const std::vector> *graphOutputNames = nullptr) { - auto nodes__ = nodes ? _fbb.CreateVector>(*nodes) : 0; - auto graphInputNames__ = graphInputNames ? _fbb.CreateVector>(*graphInputNames) : 0; - auto graphOutputNames__ = graphOutputNames ? _fbb.CreateVector>(*graphOutputNames) : 0; +inline ::flatbuffers::Offset CreateDmlGraphDescDirect( + ::flatbuffers::FlatBufferBuilder &_fbb, + const std::vector<::flatbuffers::Offset> *nodes = nullptr, + const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *graphInputNames = nullptr, + const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *graphOutputNames = nullptr) { + auto nodes__ = nodes ? _fbb.CreateVector<::flatbuffers::Offset>(*nodes) : 0; + auto graphInputNames__ = graphInputNames ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*graphInputNames) : 0; + auto graphOutputNames__ = graphOutputNames ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*graphOutputNames) : 0; return dml::ir::CreateDmlGraphDesc( _fbb, nodes__, @@ -694,7 +748,7 @@ inline flatbuffers::Offset CreateDmlGraphDescDirect( graphOutputNames__); } -inline bool VerifyConstantNodeDescDetail(flatbuffers::Verifier &verifier, const void *obj, ConstantNodeDescDetail type) { +inline bool VerifyConstantNodeDescDetail(::flatbuffers::Verifier &verifier, const void *obj, ConstantNodeDescDetail type) { switch (type) { case ConstantNodeDescDetail_NONE: { return true; @@ -711,10 +765,10 @@ inline bool VerifyConstantNodeDescDetail(flatbuffers::Verifier &verifier, const } } -inline bool VerifyConstantNodeDescDetailVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types) { +inline bool VerifyConstantNodeDescDetailVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset> *values, const ::flatbuffers::Vector *types) { if (!values || !types) return !values && !types; if (values->size() != types->size()) return false; - for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { + for (::flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { if (!VerifyConstantNodeDescDetail( verifier, values->Get(i), types->GetEnum(i))) { return false; @@ -723,7 +777,7 @@ inline bool VerifyConstantNodeDescDetailVector(flatbuffers::Verifier &verifier, return true; } -inline bool VerifyNodeDesc(flatbuffers::Verifier &verifier, const void *obj, NodeDesc type) { +inline bool VerifyNodeDesc(::flatbuffers::Verifier &verifier, const void *obj, NodeDesc type) { switch (type) { case NodeDesc_NONE: { return true; @@ -740,10 +794,10 @@ inline bool VerifyNodeDesc(flatbuffers::Verifier &verifier, const void *obj, Nod } } -inline bool VerifyNodeDescVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types) { +inline bool VerifyNodeDescVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset> *values, const ::flatbuffers::Vector *types) { if (!values || !types) return !values && !types; if (values->size() != types->size()) return false; - for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { + for (::flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { if (!VerifyNodeDesc( verifier, values->Get(i), types->GetEnum(i))) { return false; @@ -753,32 +807,40 @@ inline bool VerifyNodeDescVector(flatbuffers::Verifier &verifier, const flatbuff } inline const dml::ir::DmlGraphDesc *GetDmlGraphDesc(const void *buf) { - return flatbuffers::GetRoot(buf); + return ::flatbuffers::GetRoot(buf); } inline const dml::ir::DmlGraphDesc *GetSizePrefixedDmlGraphDesc(const void *buf) { - return flatbuffers::GetSizePrefixedRoot(buf); + return ::flatbuffers::GetSizePrefixedRoot(buf); +} + +inline DmlGraphDesc *GetMutableDmlGraphDesc(void *buf) { + return ::flatbuffers::GetMutableRoot(buf); +} + +inline dml::ir::DmlGraphDesc *GetMutableSizePrefixedDmlGraphDesc(void *buf) { + return ::flatbuffers::GetMutableSizePrefixedRoot(buf); } inline bool VerifyDmlGraphDescBuffer( - flatbuffers::Verifier &verifier) { + ::flatbuffers::Verifier &verifier) { return verifier.VerifyBuffer(nullptr); } inline bool VerifySizePrefixedDmlGraphDescBuffer( - flatbuffers::Verifier &verifier) { + ::flatbuffers::Verifier &verifier) { return verifier.VerifySizePrefixedBuffer(nullptr); } inline void FinishDmlGraphDescBuffer( - flatbuffers::FlatBufferBuilder &fbb, - flatbuffers::Offset root) { + ::flatbuffers::FlatBufferBuilder &fbb, + ::flatbuffers::Offset root) { fbb.Finish(root); } inline void FinishSizePrefixedDmlGraphDescBuffer( - flatbuffers::FlatBufferBuilder &fbb, - flatbuffers::Offset root) { + ::flatbuffers::FlatBufferBuilder &fbb, + ::flatbuffers::Offset root) { fbb.FinishSizePrefixed(root); } diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/OperatorFieldTypes_generated.h b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/OperatorFieldTypes_generated.h index 167a913bb0132..639c31f0dc5c8 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/OperatorFieldTypes_generated.h +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/OperatorFieldTypes_generated.h @@ -4,7 +4,14 @@ #ifndef FLATBUFFERS_GENERATED_OPERATORFIELDTYPES_DML_IR_OPERATORFIELDTYPES_H_ #define FLATBUFFERS_GENERATED_OPERATORFIELDTYPES_DML_IR_OPERATORFIELDTYPES_H_ -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" + +// Ensure the included flatbuffers.h is the same version as when this file was +// generated, otherwise it may not be compatible. +static_assert(FLATBUFFERS_VERSION_MAJOR == 23 && + FLATBUFFERS_VERSION_MINOR == 5 && + FLATBUFFERS_VERSION_REVISION == 26, + "Non-compatible flatbuffers version included"); namespace dml { namespace ir { @@ -59,7 +66,7 @@ struct ScalarUnionDataBuilder; struct Bool; -enum AttributeFieldVariant { +enum AttributeFieldVariant : uint8_t { AttributeFieldVariant_NONE = 0, AttributeFieldVariant_Activation = 1, AttributeFieldVariant_ActivationArray = 2, @@ -120,7 +127,7 @@ inline const char * const *EnumNamesAttributeFieldVariant() { } inline const char *EnumNameAttributeFieldVariant(AttributeFieldVariant e) { - if (flatbuffers::IsOutRange(e, AttributeFieldVariant_NONE, AttributeFieldVariant_Bool)) return ""; + if (::flatbuffers::IsOutRange(e, AttributeFieldVariant_NONE, AttributeFieldVariant_Bool)) return ""; const size_t index = static_cast(e); return EnumNamesAttributeFieldVariant()[index]; } @@ -181,10 +188,10 @@ template<> struct AttributeFieldVariantTraits static const AttributeFieldVariant enum_value = AttributeFieldVariant_Bool; }; -bool VerifyAttributeFieldVariant(flatbuffers::Verifier &verifier, const void *obj, AttributeFieldVariant type); -bool VerifyAttributeFieldVariantVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types); +bool VerifyAttributeFieldVariant(::flatbuffers::Verifier &verifier, const void *obj, AttributeFieldVariant type); +bool VerifyAttributeFieldVariantVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset> *values, const ::flatbuffers::Vector *types); -enum ScalarVariant { +enum ScalarVariant : uint8_t { ScalarVariant_NONE = 0, ScalarVariant_ByteArray = 1, ScalarVariant_Int8 = 2, @@ -239,7 +246,7 @@ inline const char * const *EnumNamesScalarVariant() { } inline const char *EnumNameScalarVariant(ScalarVariant e) { - if (flatbuffers::IsOutRange(e, ScalarVariant_NONE, ScalarVariant_Float64)) return ""; + if (::flatbuffers::IsOutRange(e, ScalarVariant_NONE, ScalarVariant_Float64)) return ""; const size_t index = static_cast(e); return EnumNamesScalarVariant()[index]; } @@ -292,25 +299,25 @@ template<> struct ScalarVariantTraits { static const ScalarVariant enum_value = ScalarVariant_Float64; }; -bool VerifyScalarVariant(flatbuffers::Verifier &verifier, const void *obj, ScalarVariant type); -bool VerifyScalarVariantVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types); +bool VerifyScalarVariant(::flatbuffers::Verifier &verifier, const void *obj, ScalarVariant type); +bool VerifyScalarVariantVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset> *values, const ::flatbuffers::Vector *types); FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) UInt8 FLATBUFFERS_FINAL_CLASS { private: uint8_t data_; public: - UInt8() { - memset(static_cast(this), 0, sizeof(UInt8)); + UInt8() + : data_(0) { } UInt8(uint8_t _data) - : data_(flatbuffers::EndianScalar(_data)) { + : data_(::flatbuffers::EndianScalar(_data)) { } uint8_t data() const { - return flatbuffers::EndianScalar(data_); + return ::flatbuffers::EndianScalar(data_); } void mutate_data(uint8_t _data) { - flatbuffers::WriteScalar(&data_, _data); + ::flatbuffers::WriteScalar(&data_, _data); } }; FLATBUFFERS_STRUCT_END(UInt8, 1); @@ -320,17 +327,17 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(2) UInt16 FLATBUFFERS_FINAL_CLASS { uint16_t data_; public: - UInt16() { - memset(static_cast(this), 0, sizeof(UInt16)); + UInt16() + : data_(0) { } UInt16(uint16_t _data) - : data_(flatbuffers::EndianScalar(_data)) { + : data_(::flatbuffers::EndianScalar(_data)) { } uint16_t data() const { - return flatbuffers::EndianScalar(data_); + return ::flatbuffers::EndianScalar(data_); } void mutate_data(uint16_t _data) { - flatbuffers::WriteScalar(&data_, _data); + ::flatbuffers::WriteScalar(&data_, _data); } }; FLATBUFFERS_STRUCT_END(UInt16, 2); @@ -340,17 +347,17 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) UInt32 FLATBUFFERS_FINAL_CLASS { uint32_t data_; public: - UInt32() { - memset(static_cast(this), 0, sizeof(UInt32)); + UInt32() + : data_(0) { } UInt32(uint32_t _data) - : data_(flatbuffers::EndianScalar(_data)) { + : data_(::flatbuffers::EndianScalar(_data)) { } uint32_t data() const { - return flatbuffers::EndianScalar(data_); + return ::flatbuffers::EndianScalar(data_); } void mutate_data(uint32_t _data) { - flatbuffers::WriteScalar(&data_, _data); + ::flatbuffers::WriteScalar(&data_, _data); } }; FLATBUFFERS_STRUCT_END(UInt32, 4); @@ -360,17 +367,17 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) UInt64 FLATBUFFERS_FINAL_CLASS { uint64_t data_; public: - UInt64() { - memset(static_cast(this), 0, sizeof(UInt64)); + UInt64() + : data_(0) { } UInt64(uint64_t _data) - : data_(flatbuffers::EndianScalar(_data)) { + : data_(::flatbuffers::EndianScalar(_data)) { } uint64_t data() const { - return flatbuffers::EndianScalar(data_); + return ::flatbuffers::EndianScalar(data_); } void mutate_data(uint64_t _data) { - flatbuffers::WriteScalar(&data_, _data); + ::flatbuffers::WriteScalar(&data_, _data); } }; FLATBUFFERS_STRUCT_END(UInt64, 8); @@ -380,17 +387,17 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) Int8 FLATBUFFERS_FINAL_CLASS { int8_t data_; public: - Int8() { - memset(static_cast(this), 0, sizeof(Int8)); + Int8() + : data_(0) { } Int8(int8_t _data) - : data_(flatbuffers::EndianScalar(_data)) { + : data_(::flatbuffers::EndianScalar(_data)) { } int8_t data() const { - return flatbuffers::EndianScalar(data_); + return ::flatbuffers::EndianScalar(data_); } void mutate_data(int8_t _data) { - flatbuffers::WriteScalar(&data_, _data); + ::flatbuffers::WriteScalar(&data_, _data); } }; FLATBUFFERS_STRUCT_END(Int8, 1); @@ -400,17 +407,17 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(2) Int16 FLATBUFFERS_FINAL_CLASS { int16_t data_; public: - Int16() { - memset(static_cast(this), 0, sizeof(Int16)); + Int16() + : data_(0) { } Int16(int16_t _data) - : data_(flatbuffers::EndianScalar(_data)) { + : data_(::flatbuffers::EndianScalar(_data)) { } int16_t data() const { - return flatbuffers::EndianScalar(data_); + return ::flatbuffers::EndianScalar(data_); } void mutate_data(int16_t _data) { - flatbuffers::WriteScalar(&data_, _data); + ::flatbuffers::WriteScalar(&data_, _data); } }; FLATBUFFERS_STRUCT_END(Int16, 2); @@ -420,17 +427,17 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Int32 FLATBUFFERS_FINAL_CLASS { int32_t data_; public: - Int32() { - memset(static_cast(this), 0, sizeof(Int32)); + Int32() + : data_(0) { } Int32(int32_t _data) - : data_(flatbuffers::EndianScalar(_data)) { + : data_(::flatbuffers::EndianScalar(_data)) { } int32_t data() const { - return flatbuffers::EndianScalar(data_); + return ::flatbuffers::EndianScalar(data_); } void mutate_data(int32_t _data) { - flatbuffers::WriteScalar(&data_, _data); + ::flatbuffers::WriteScalar(&data_, _data); } }; FLATBUFFERS_STRUCT_END(Int32, 4); @@ -440,17 +447,17 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Int64 FLATBUFFERS_FINAL_CLASS { int64_t data_; public: - Int64() { - memset(static_cast(this), 0, sizeof(Int64)); + Int64() + : data_(0) { } Int64(int64_t _data) - : data_(flatbuffers::EndianScalar(_data)) { + : data_(::flatbuffers::EndianScalar(_data)) { } int64_t data() const { - return flatbuffers::EndianScalar(data_); + return ::flatbuffers::EndianScalar(data_); } void mutate_data(int64_t _data) { - flatbuffers::WriteScalar(&data_, _data); + ::flatbuffers::WriteScalar(&data_, _data); } }; FLATBUFFERS_STRUCT_END(Int64, 8); @@ -460,17 +467,17 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Float32 FLATBUFFERS_FINAL_CLASS { float data_; public: - Float32() { - memset(static_cast(this), 0, sizeof(Float32)); + Float32() + : data_(0) { } Float32(float _data) - : data_(flatbuffers::EndianScalar(_data)) { + : data_(::flatbuffers::EndianScalar(_data)) { } float data() const { - return flatbuffers::EndianScalar(data_); + return ::flatbuffers::EndianScalar(data_); } void mutate_data(float _data) { - flatbuffers::WriteScalar(&data_, _data); + ::flatbuffers::WriteScalar(&data_, _data); } }; FLATBUFFERS_STRUCT_END(Float32, 4); @@ -480,17 +487,17 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Float64 FLATBUFFERS_FINAL_CLASS { double data_; public: - Float64() { - memset(static_cast(this), 0, sizeof(Float64)); + Float64() + : data_(0) { } Float64(double _data) - : data_(flatbuffers::EndianScalar(_data)) { + : data_(::flatbuffers::EndianScalar(_data)) { } double data() const { - return flatbuffers::EndianScalar(data_); + return ::flatbuffers::EndianScalar(data_); } void mutate_data(double _data) { - flatbuffers::WriteScalar(&data_, _data); + ::flatbuffers::WriteScalar(&data_, _data); } }; FLATBUFFERS_STRUCT_END(Float64, 8); @@ -501,24 +508,25 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) ScaleBias FLATBUFFERS_FINAL_CLASS { float bias_; public: - ScaleBias() { - memset(static_cast(this), 0, sizeof(ScaleBias)); + ScaleBias() + : scale_(0), + bias_(0) { } ScaleBias(float _scale, float _bias) - : scale_(flatbuffers::EndianScalar(_scale)), - bias_(flatbuffers::EndianScalar(_bias)) { + : scale_(::flatbuffers::EndianScalar(_scale)), + bias_(::flatbuffers::EndianScalar(_bias)) { } float scale() const { - return flatbuffers::EndianScalar(scale_); + return ::flatbuffers::EndianScalar(scale_); } void mutate_scale(float _scale) { - flatbuffers::WriteScalar(&scale_, _scale); + ::flatbuffers::WriteScalar(&scale_, _scale); } float bias() const { - return flatbuffers::EndianScalar(bias_); + return ::flatbuffers::EndianScalar(bias_); } void mutate_bias(float _bias) { - flatbuffers::WriteScalar(&bias_, _bias); + ::flatbuffers::WriteScalar(&bias_, _bias); } }; FLATBUFFERS_STRUCT_END(ScaleBias, 8); @@ -529,24 +537,25 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Size2D FLATBUFFERS_FINAL_CLASS { uint32_t height_; public: - Size2D() { - memset(static_cast(this), 0, sizeof(Size2D)); + Size2D() + : width_(0), + height_(0) { } Size2D(uint32_t _width, uint32_t _height) - : width_(flatbuffers::EndianScalar(_width)), - height_(flatbuffers::EndianScalar(_height)) { + : width_(::flatbuffers::EndianScalar(_width)), + height_(::flatbuffers::EndianScalar(_height)) { } uint32_t width() const { - return flatbuffers::EndianScalar(width_); + return ::flatbuffers::EndianScalar(width_); } void mutate_width(uint32_t _width) { - flatbuffers::WriteScalar(&width_, _width); + ::flatbuffers::WriteScalar(&width_, _width); } uint32_t height() const { - return flatbuffers::EndianScalar(height_); + return ::flatbuffers::EndianScalar(height_); } void mutate_height(uint32_t _height) { - flatbuffers::WriteScalar(&height_, _height); + ::flatbuffers::WriteScalar(&height_, _height); } }; FLATBUFFERS_STRUCT_END(Size2D, 8); @@ -556,14 +565,17 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) ByteArray FLATBUFFERS_FINAL_CLASS { uint8_t data_[8]; public: - ByteArray() { - memset(static_cast(this), 0, sizeof(ByteArray)); + ByteArray() + : data_() { + } + ByteArray(::flatbuffers::span _data) { + ::flatbuffers::CastToArray(data_).CopyFromSpan(_data); } - const flatbuffers::Array *data() const { - return reinterpret_cast *>(data_); + const ::flatbuffers::Array *data() const { + return &::flatbuffers::CastToArray(data_); } - flatbuffers::Array *mutable_data() { - return reinterpret_cast *>(data_); + ::flatbuffers::Array *mutable_data() { + return &::flatbuffers::CastToArray(data_); } }; FLATBUFFERS_STRUCT_END(ByteArray, 8); @@ -573,33 +585,33 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) Bool FLATBUFFERS_FINAL_CLASS { uint8_t data_; public: - Bool() { - memset(static_cast(this), 0, sizeof(Bool)); + Bool() + : data_(0) { } Bool(bool _data) - : data_(flatbuffers::EndianScalar(static_cast(_data))) { + : data_(::flatbuffers::EndianScalar(static_cast(_data))) { } bool data() const { - return flatbuffers::EndianScalar(data_) != 0; + return ::flatbuffers::EndianScalar(data_) != 0; } void mutate_data(bool _data) { - flatbuffers::WriteScalar(&data_, static_cast(_data)); + ::flatbuffers::WriteScalar(&data_, static_cast(_data)); } }; FLATBUFFERS_STRUCT_END(Bool, 1); -struct AttributeDesc FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct AttributeDesc FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef AttributeDescBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_NAME = 4, VT_VAL_TYPE = 6, VT_VAL = 8 }; - const flatbuffers::String *name() const { - return GetPointer(VT_NAME); + const ::flatbuffers::String *name() const { + return GetPointer(VT_NAME); } - flatbuffers::String *mutable_name() { - return GetPointer(VT_NAME); + ::flatbuffers::String *mutable_name() { + return GetPointer<::flatbuffers::String *>(VT_NAME); } dml::ir::operatorFieldTypes::AttributeFieldVariant val_type() const { return static_cast(GetField(VT_VAL_TYPE, 0)); @@ -650,11 +662,11 @@ struct AttributeDesc FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { void *mutable_val() { return GetPointer(VT_VAL); } - bool Verify(flatbuffers::Verifier &verifier) const { + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_NAME) && verifier.VerifyString(name()) && - VerifyField(verifier, VT_VAL_TYPE) && + VerifyField(verifier, VT_VAL_TYPE, 1) && VerifyOffset(verifier, VT_VAL) && VerifyAttributeFieldVariant(verifier, val(), val_type()) && verifier.EndTable(); @@ -715,34 +727,33 @@ template<> inline const dml::ir::operatorFieldTypes::Bool *AttributeDesc::val_as struct AttributeDescBuilder { typedef AttributeDesc Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_name(flatbuffers::Offset name) { + ::flatbuffers::FlatBufferBuilder &fbb_; + ::flatbuffers::uoffset_t start_; + void add_name(::flatbuffers::Offset<::flatbuffers::String> name) { fbb_.AddOffset(AttributeDesc::VT_NAME, name); } void add_val_type(dml::ir::operatorFieldTypes::AttributeFieldVariant val_type) { fbb_.AddElement(AttributeDesc::VT_VAL_TYPE, static_cast(val_type), 0); } - void add_val(flatbuffers::Offset val) { + void add_val(::flatbuffers::Offset val) { fbb_.AddOffset(AttributeDesc::VT_VAL, val); } - explicit AttributeDescBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit AttributeDescBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - AttributeDescBuilder &operator=(const AttributeDescBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateAttributeDesc( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset name = 0, +inline ::flatbuffers::Offset CreateAttributeDesc( + ::flatbuffers::FlatBufferBuilder &_fbb, + ::flatbuffers::Offset<::flatbuffers::String> name = 0, dml::ir::operatorFieldTypes::AttributeFieldVariant val_type = dml::ir::operatorFieldTypes::AttributeFieldVariant_NONE, - flatbuffers::Offset val = 0) { + ::flatbuffers::Offset val = 0) { AttributeDescBuilder builder_(_fbb); builder_.add_val(val); builder_.add_name(name); @@ -750,11 +761,11 @@ inline flatbuffers::Offset CreateAttributeDesc( return builder_.Finish(); } -inline flatbuffers::Offset CreateAttributeDescDirect( - flatbuffers::FlatBufferBuilder &_fbb, +inline ::flatbuffers::Offset CreateAttributeDescDirect( + ::flatbuffers::FlatBufferBuilder &_fbb, const char *name = nullptr, dml::ir::operatorFieldTypes::AttributeFieldVariant val_type = dml::ir::operatorFieldTypes::AttributeFieldVariant_NONE, - flatbuffers::Offset val = 0) { + ::flatbuffers::Offset val = 0) { auto name__ = name ? _fbb.CreateString(name) : 0; return dml::ir::operatorFieldTypes::CreateAttributeDesc( _fbb, @@ -763,25 +774,25 @@ inline flatbuffers::Offset CreateAttributeDescDirect( val); } -struct Activation FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct Activation FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef ActivationBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_TYPE = 4, VT_ATTRIBUTES = 6 }; - const flatbuffers::String *type() const { - return GetPointer(VT_TYPE); + const ::flatbuffers::String *type() const { + return GetPointer(VT_TYPE); } - flatbuffers::String *mutable_type() { - return GetPointer(VT_TYPE); + ::flatbuffers::String *mutable_type() { + return GetPointer<::flatbuffers::String *>(VT_TYPE); } - const flatbuffers::Vector> *attributes() const { - return GetPointer> *>(VT_ATTRIBUTES); + const ::flatbuffers::Vector<::flatbuffers::Offset> *attributes() const { + return GetPointer> *>(VT_ATTRIBUTES); } - flatbuffers::Vector> *mutable_attributes() { - return GetPointer> *>(VT_ATTRIBUTES); + ::flatbuffers::Vector<::flatbuffers::Offset> *mutable_attributes() { + return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset> *>(VT_ATTRIBUTES); } - bool Verify(flatbuffers::Verifier &verifier) const { + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_TYPE) && verifier.VerifyString(type()) && @@ -794,60 +805,59 @@ struct Activation FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { struct ActivationBuilder { typedef Activation Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_type(flatbuffers::Offset type) { + ::flatbuffers::FlatBufferBuilder &fbb_; + ::flatbuffers::uoffset_t start_; + void add_type(::flatbuffers::Offset<::flatbuffers::String> type) { fbb_.AddOffset(Activation::VT_TYPE, type); } - void add_attributes(flatbuffers::Offset>> attributes) { + void add_attributes(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attributes) { fbb_.AddOffset(Activation::VT_ATTRIBUTES, attributes); } - explicit ActivationBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit ActivationBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - ActivationBuilder &operator=(const ActivationBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateActivation( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset type = 0, - flatbuffers::Offset>> attributes = 0) { +inline ::flatbuffers::Offset CreateActivation( + ::flatbuffers::FlatBufferBuilder &_fbb, + ::flatbuffers::Offset<::flatbuffers::String> type = 0, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> attributes = 0) { ActivationBuilder builder_(_fbb); builder_.add_attributes(attributes); builder_.add_type(type); return builder_.Finish(); } -inline flatbuffers::Offset CreateActivationDirect( - flatbuffers::FlatBufferBuilder &_fbb, +inline ::flatbuffers::Offset CreateActivationDirect( + ::flatbuffers::FlatBufferBuilder &_fbb, const char *type = nullptr, - const std::vector> *attributes = nullptr) { + const std::vector<::flatbuffers::Offset> *attributes = nullptr) { auto type__ = type ? _fbb.CreateString(type) : 0; - auto attributes__ = attributes ? _fbb.CreateVector>(*attributes) : 0; + auto attributes__ = attributes ? _fbb.CreateVector<::flatbuffers::Offset>(*attributes) : 0; return dml::ir::operatorFieldTypes::CreateActivation( _fbb, type__, attributes__); } -struct ActivationArray FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct ActivationArray FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef ActivationArrayBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_DATA = 4 }; - const flatbuffers::Vector> *data() const { - return GetPointer> *>(VT_DATA); + const ::flatbuffers::Vector<::flatbuffers::Offset> *data() const { + return GetPointer> *>(VT_DATA); } - flatbuffers::Vector> *mutable_data() { - return GetPointer> *>(VT_DATA); + ::flatbuffers::Vector<::flatbuffers::Offset> *mutable_data() { + return GetPointer<::flatbuffers::Vector<::flatbuffers::Offset> *>(VT_DATA); } - bool Verify(flatbuffers::Verifier &verifier) const { + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_DATA) && verifier.VerifyVector(data()) && @@ -858,52 +868,51 @@ struct ActivationArray FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { struct ActivationArrayBuilder { typedef ActivationArray Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_data(flatbuffers::Offset>> data) { + ::flatbuffers::FlatBufferBuilder &fbb_; + ::flatbuffers::uoffset_t start_; + void add_data(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> data) { fbb_.AddOffset(ActivationArray::VT_DATA, data); } - explicit ActivationArrayBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit ActivationArrayBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - ActivationArrayBuilder &operator=(const ActivationArrayBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateActivationArray( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset>> data = 0) { +inline ::flatbuffers::Offset CreateActivationArray( + ::flatbuffers::FlatBufferBuilder &_fbb, + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> data = 0) { ActivationArrayBuilder builder_(_fbb); builder_.add_data(data); return builder_.Finish(); } -inline flatbuffers::Offset CreateActivationArrayDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector> *data = nullptr) { - auto data__ = data ? _fbb.CreateVector>(*data) : 0; +inline ::flatbuffers::Offset CreateActivationArrayDirect( + ::flatbuffers::FlatBufferBuilder &_fbb, + const std::vector<::flatbuffers::Offset> *data = nullptr) { + auto data__ = data ? _fbb.CreateVector<::flatbuffers::Offset>(*data) : 0; return dml::ir::operatorFieldTypes::CreateActivationArray( _fbb, data__); } -struct UIntArray FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct UIntArray FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef UIntArrayBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_DATA = 4 }; - const flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); + const ::flatbuffers::Vector *data() const { + return GetPointer *>(VT_DATA); } - flatbuffers::Vector *mutable_data() { - return GetPointer *>(VT_DATA); + ::flatbuffers::Vector *mutable_data() { + return GetPointer<::flatbuffers::Vector *>(VT_DATA); } - bool Verify(flatbuffers::Verifier &verifier) const { + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_DATA) && verifier.VerifyVector(data()) && @@ -913,33 +922,32 @@ struct UIntArray FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { struct UIntArrayBuilder { typedef UIntArray Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_data(flatbuffers::Offset> data) { + ::flatbuffers::FlatBufferBuilder &fbb_; + ::flatbuffers::uoffset_t start_; + void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) { fbb_.AddOffset(UIntArray::VT_DATA, data); } - explicit UIntArrayBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit UIntArrayBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - UIntArrayBuilder &operator=(const UIntArrayBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateUIntArray( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> data = 0) { +inline ::flatbuffers::Offset CreateUIntArray( + ::flatbuffers::FlatBufferBuilder &_fbb, + ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) { UIntArrayBuilder builder_(_fbb); builder_.add_data(data); return builder_.Finish(); } -inline flatbuffers::Offset CreateUIntArrayDirect( - flatbuffers::FlatBufferBuilder &_fbb, +inline ::flatbuffers::Offset CreateUIntArrayDirect( + ::flatbuffers::FlatBufferBuilder &_fbb, const std::vector *data = nullptr) { auto data__ = data ? _fbb.CreateVector(*data) : 0; return dml::ir::operatorFieldTypes::CreateUIntArray( @@ -947,18 +955,18 @@ inline flatbuffers::Offset CreateUIntArrayDirect( data__); } -struct IntArray FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct IntArray FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef IntArrayBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_DATA = 4 }; - const flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); + const ::flatbuffers::Vector *data() const { + return GetPointer *>(VT_DATA); } - flatbuffers::Vector *mutable_data() { - return GetPointer *>(VT_DATA); + ::flatbuffers::Vector *mutable_data() { + return GetPointer<::flatbuffers::Vector *>(VT_DATA); } - bool Verify(flatbuffers::Verifier &verifier) const { + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_DATA) && verifier.VerifyVector(data()) && @@ -968,33 +976,32 @@ struct IntArray FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { struct IntArrayBuilder { typedef IntArray Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_data(flatbuffers::Offset> data) { + ::flatbuffers::FlatBufferBuilder &fbb_; + ::flatbuffers::uoffset_t start_; + void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) { fbb_.AddOffset(IntArray::VT_DATA, data); } - explicit IntArrayBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit IntArrayBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - IntArrayBuilder &operator=(const IntArrayBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateIntArray( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> data = 0) { +inline ::flatbuffers::Offset CreateIntArray( + ::flatbuffers::FlatBufferBuilder &_fbb, + ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) { IntArrayBuilder builder_(_fbb); builder_.add_data(data); return builder_.Finish(); } -inline flatbuffers::Offset CreateIntArrayDirect( - flatbuffers::FlatBufferBuilder &_fbb, +inline ::flatbuffers::Offset CreateIntArrayDirect( + ::flatbuffers::FlatBufferBuilder &_fbb, const std::vector *data = nullptr) { auto data__ = data ? _fbb.CreateVector(*data) : 0; return dml::ir::operatorFieldTypes::CreateIntArray( @@ -1002,18 +1009,18 @@ inline flatbuffers::Offset CreateIntArrayDirect( data__); } -struct FloatArray FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct FloatArray FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef FloatArrayBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_DATA = 4 }; - const flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); + const ::flatbuffers::Vector *data() const { + return GetPointer *>(VT_DATA); } - flatbuffers::Vector *mutable_data() { - return GetPointer *>(VT_DATA); + ::flatbuffers::Vector *mutable_data() { + return GetPointer<::flatbuffers::Vector *>(VT_DATA); } - bool Verify(flatbuffers::Verifier &verifier) const { + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_DATA) && verifier.VerifyVector(data()) && @@ -1023,33 +1030,32 @@ struct FloatArray FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { struct FloatArrayBuilder { typedef FloatArray Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_data(flatbuffers::Offset> data) { + ::flatbuffers::FlatBufferBuilder &fbb_; + ::flatbuffers::uoffset_t start_; + void add_data(::flatbuffers::Offset<::flatbuffers::Vector> data) { fbb_.AddOffset(FloatArray::VT_DATA, data); } - explicit FloatArrayBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit FloatArrayBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - FloatArrayBuilder &operator=(const FloatArrayBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateFloatArray( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> data = 0) { +inline ::flatbuffers::Offset CreateFloatArray( + ::flatbuffers::FlatBufferBuilder &_fbb, + ::flatbuffers::Offset<::flatbuffers::Vector> data = 0) { FloatArrayBuilder builder_(_fbb); builder_.add_data(data); return builder_.Finish(); } -inline flatbuffers::Offset CreateFloatArrayDirect( - flatbuffers::FlatBufferBuilder &_fbb, +inline ::flatbuffers::Offset CreateFloatArrayDirect( + ::flatbuffers::FlatBufferBuilder &_fbb, const std::vector *data = nullptr) { auto data__ = data ? _fbb.CreateVector(*data) : 0; return dml::ir::operatorFieldTypes::CreateFloatArray( @@ -1057,7 +1063,7 @@ inline flatbuffers::Offset CreateFloatArrayDirect( data__); } -struct ScalarUnionData FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { +struct ScalarUnionData FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef ScalarUnionDataBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_DATA_TYPE = 4, @@ -1106,9 +1112,9 @@ struct ScalarUnionData FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { void *mutable_data() { return GetPointer(VT_DATA); } - bool Verify(flatbuffers::Verifier &verifier) const { + bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_DATA_TYPE) && + VerifyField(verifier, VT_DATA_TYPE, 1) && VerifyOffset(verifier, VT_DATA) && VerifyScalarVariant(verifier, data(), data_type()) && verifier.EndTable(); @@ -1161,37 +1167,36 @@ template<> inline const dml::ir::operatorFieldTypes::Float64 *ScalarUnionData::d struct ScalarUnionDataBuilder { typedef ScalarUnionData Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; + ::flatbuffers::FlatBufferBuilder &fbb_; + ::flatbuffers::uoffset_t start_; void add_data_type(dml::ir::operatorFieldTypes::ScalarVariant data_type) { fbb_.AddElement(ScalarUnionData::VT_DATA_TYPE, static_cast(data_type), 0); } - void add_data(flatbuffers::Offset data) { + void add_data(::flatbuffers::Offset data) { fbb_.AddOffset(ScalarUnionData::VT_DATA, data); } - explicit ScalarUnionDataBuilder(flatbuffers::FlatBufferBuilder &_fbb) + explicit ScalarUnionDataBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - ScalarUnionDataBuilder &operator=(const ScalarUnionDataBuilder &); - flatbuffers::Offset Finish() { + ::flatbuffers::Offset Finish() { const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); + auto o = ::flatbuffers::Offset(end); return o; } }; -inline flatbuffers::Offset CreateScalarUnionData( - flatbuffers::FlatBufferBuilder &_fbb, +inline ::flatbuffers::Offset CreateScalarUnionData( + ::flatbuffers::FlatBufferBuilder &_fbb, dml::ir::operatorFieldTypes::ScalarVariant data_type = dml::ir::operatorFieldTypes::ScalarVariant_NONE, - flatbuffers::Offset data = 0) { + ::flatbuffers::Offset data = 0) { ScalarUnionDataBuilder builder_(_fbb); builder_.add_data(data); builder_.add_data_type(data_type); return builder_.Finish(); } -inline bool VerifyAttributeFieldVariant(flatbuffers::Verifier &verifier, const void *obj, AttributeFieldVariant type) { +inline bool VerifyAttributeFieldVariant(::flatbuffers::Verifier &verifier, const void *obj, AttributeFieldVariant type) { switch (type) { case AttributeFieldVariant_NONE: { return true; @@ -1205,16 +1210,16 @@ inline bool VerifyAttributeFieldVariant(flatbuffers::Verifier &verifier, const v return verifier.VerifyTable(ptr); } case AttributeFieldVariant_UInt32: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 4); } case AttributeFieldVariant_UInt64: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 8); } case AttributeFieldVariant_Int32: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 4); } case AttributeFieldVariant_Float32: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 4); } case AttributeFieldVariant_UIntArray: { auto ptr = reinterpret_cast(obj); @@ -1229,26 +1234,26 @@ inline bool VerifyAttributeFieldVariant(flatbuffers::Verifier &verifier, const v return verifier.VerifyTable(ptr); } case AttributeFieldVariant_ScaleBias: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 4); } case AttributeFieldVariant_Size2D: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 4); } case AttributeFieldVariant_ScalarUnionData: { auto ptr = reinterpret_cast(obj); return verifier.VerifyTable(ptr); } case AttributeFieldVariant_Bool: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 1); } default: return true; } } -inline bool VerifyAttributeFieldVariantVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types) { +inline bool VerifyAttributeFieldVariantVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset> *values, const ::flatbuffers::Vector *types) { if (!values || !types) return !values && !types; if (values->size() != types->size()) return false; - for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { + for (::flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { if (!VerifyAttributeFieldVariant( verifier, values->Get(i), types->GetEnum(i))) { return false; @@ -1257,52 +1262,52 @@ inline bool VerifyAttributeFieldVariantVector(flatbuffers::Verifier &verifier, c return true; } -inline bool VerifyScalarVariant(flatbuffers::Verifier &verifier, const void *obj, ScalarVariant type) { +inline bool VerifyScalarVariant(::flatbuffers::Verifier &verifier, const void *obj, ScalarVariant type) { switch (type) { case ScalarVariant_NONE: { return true; } case ScalarVariant_ByteArray: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 1); } case ScalarVariant_Int8: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 1); } case ScalarVariant_UInt8: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 1); } case ScalarVariant_Int16: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 2); } case ScalarVariant_UInt16: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 2); } case ScalarVariant_Int32: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 4); } case ScalarVariant_UInt32: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 4); } case ScalarVariant_Int64: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 8); } case ScalarVariant_UInt64: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 8); } case ScalarVariant_Float32: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 4); } case ScalarVariant_Float64: { - return verifier.Verify(static_cast(obj), 0); + return verifier.VerifyField(static_cast(obj), 0, 8); } default: return true; } } -inline bool VerifyScalarVariantVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types) { +inline bool VerifyScalarVariantVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset> *values, const ::flatbuffers::Vector *types) { if (!values || !types) return !values && !types; if (values->size() != types->size()) return false; - for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { + for (::flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { if (!VerifyScalarVariant( verifier, values->Get(i), types->GetEnum(i))) { return false; diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/precomp.h b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/precomp.h index 332bf86685e8a..1a796b25c5d1f 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/precomp.h +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/precomp.h @@ -39,7 +39,7 @@ #include #include "External/D3DX12/d3dx12.h" #endif -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" #include "GraphicsUnknownHelper.h" diff --git a/onnxruntime/core/providers/migraphx/ort_trt_int8_cal_table.fbs.h b/onnxruntime/core/providers/migraphx/ort_trt_int8_cal_table.fbs.h index 9639040f772da..a2721f6a5b44f 100644 --- a/onnxruntime/core/providers/migraphx/ort_trt_int8_cal_table.fbs.h +++ b/onnxruntime/core/providers/migraphx/ort_trt_int8_cal_table.fbs.h @@ -4,7 +4,7 @@ #define ONNXRUNTIME_CORE_PROVIDERS_MIGRAPHX_ORT_TRT_INT8_CAL_TABLE_FBS_H_ #include -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" namespace CalTableFlatBuffers { diff --git a/onnxruntime/core/providers/tensorrt/ort_trt_int8_cal_table.fbs.h b/onnxruntime/core/providers/tensorrt/ort_trt_int8_cal_table.fbs.h index 9e4324fb9f516..a2e027f56fbd9 100644 --- a/onnxruntime/core/providers/tensorrt/ort_trt_int8_cal_table.fbs.h +++ b/onnxruntime/core/providers/tensorrt/ort_trt_int8_cal_table.fbs.h @@ -3,7 +3,7 @@ #ifndef FLATBUFFERS_GENERATED_ORTTRTINT8CALTABLE_CALTABLEFLATBUFFERS_H_ #define FLATBUFFERS_GENERATED_ORTTRTINT8CALTABLE_CALTABLEFLATBUFFERS_H_ -#include "flatbuffers/flatbuffers.h" +#include "core/common/flatbuffers.h" namespace CalTableFlatBuffers { diff --git a/tools/ci_build/github/azure-pipelines/templates/download-deps.yml b/tools/ci_build/github/azure-pipelines/templates/download-deps.yml index 01be343795a56..c60b3e467d4f1 100644 --- a/tools/ci_build/github/azure-pipelines/templates/download-deps.yml +++ b/tools/ci_build/github/azure-pipelines/templates/download-deps.yml @@ -11,7 +11,7 @@ steps: packageType: upack feed: '/7424c8e4-5c62-490e-95c4-79446f31017c' definition: '517c4f6f-5437-4392-a70d-4f15ec5be2f0' - version: 1.0.134 + version: 1.0.143 downloadPath: $(Build.BinariesDirectory)/deps # The private ADO project @@ -22,7 +22,7 @@ steps: packageType: upack feed: '/4c7631f5-24c0-4307-8822-1aa8f180c325' definition: 'fd9dd5ad-b73e-4678-890e-edcf680dbc1a' - version: 1.0.134 + version: 1.0.143 downloadPath: $(Build.BinariesDirectory)/deps # You can add more ADO accounts at here. diff --git a/tools/ci_build/github/azure-pipelines/templates/jobs/win-ci-vs-2022-job.yml b/tools/ci_build/github/azure-pipelines/templates/jobs/win-ci-vs-2022-job.yml index dd703f3199d9b..30e427a18509d 100644 --- a/tools/ci_build/github/azure-pipelines/templates/jobs/win-ci-vs-2022-job.yml +++ b/tools/ci_build/github/azure-pipelines/templates/jobs/win-ci-vs-2022-job.yml @@ -148,12 +148,9 @@ jobs: Get-Volume $("$(Build.BinariesDirectory)")[0] displayName: check disk size - - task: DeleteFiles@1 - displayName: 'Delete intermedia files from $(Build.BinariesDirectory)\${{ parameters.BuildConfig }}' - inputs: - SourceFolder: '$(Build.BinariesDirectory)\${{ parameters.BuildConfig }}' - Contents: | - **/*.obj + - powershell: | + Remove-Item "$(Build.BinariesDirectory)\${{ parameters.BuildConfig }}" -Include "*.obj" -Recurse + displayName: 'Delete intermediate files from $(Build.BinariesDirectory)\${{ parameters.BuildConfig }}' - powershell: | Get-Volume $("$(Build.BinariesDirectory)")[0] @@ -221,14 +218,6 @@ jobs: workingDirectory: '$(Build.BinariesDirectory)\${{ parameters.BuildConfig }}\${{ parameters.BuildConfig }}' displayName: 'Run tests' - - task: PublishTestResults@2 - displayName: 'Publish unit test results' - inputs: - testResultsFiles: '**/*.results.xml' - searchFolder: '$(Build.BinariesDirectory)/${{ parameters.BuildConfig }}' - testRunTitle: 'Unit Test Run' - condition: succeededOrFailed() - - ${{ if eq(parameters.GenerateDocumentation, true) }}: - task: PythonScript@0 displayName: 'Generate documentation' @@ -251,4 +240,4 @@ jobs: condition: and(failed(), eq(variables['DocUpdateNeeded'], 'true')) inputs: pathtoPublish: '$(Build.SourcesDirectory)/docs/ContribOperators.md' - artifactName: 'ContribOperators.md' + artifactName: 'ContribOperators.md' \ No newline at end of file