onnxruntime/onnxruntime/core/graph/op_identifier_utils.h
Adam Louly 32558134a9
[On-Device-Training] Upgrade Flatbuffers to Support 2GB+ Checkpoints. (#19770)
### Description
Modifications to support 2GB+ checkpoint & Upgrading Flatbuffers


### Motivation and Context
This PR includes changes that will make ort handle 2GB+ checkpoints.
To do that we need to upgrade flatbuffers to 23.5.9 -
https://github.com/google/flatbuffers/pull/7945

- Modified the commitHash and the hash for the new version
- Removed the patch for rust generator's unused variable warning as it
is no longer producing this - [Check it out
here](d121e09d89/src/idl_gen_rust.cpp)
- Updated the VerifyField calls with alignment values that were
introduced in the new version.

---------

Co-authored-by: Sumit Agarwal <sumitagarwal@microsoft.com>
2024-03-14 16:36:24 -07:00

47 lines
1.3 KiB
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "core/common/flatbuffers.h"
#include "core/graph/op_identifier.h"
#include "core/common/status.h"
#include "core/graph/graph.h"
#include "core/graph/onnx_protobuf.h"
namespace onnxruntime {
namespace fbs::utils {
#if !defined(ORT_MINIMAL_BUILD)
Status SaveOpIdentifierOrtFormat(flatbuffers::FlatBufferBuilder& builder,
const onnxruntime::OpIdentifier& op_id,
flatbuffers::Offset<flatbuffers::String>& fbs_op_id_str);
#endif // !defined(ORT_MINIMAL_BUILD)
Status LoadOpIdentifierOrtFormat(const flatbuffers::String& fbs_op_id_str,
onnxruntime::OpIdentifier& op_id);
} // namespace fbs::utils
namespace utils {
inline onnxruntime::OpIdentifier MakeOpId(const Node& node) {
return onnxruntime::OpIdentifier{node.Domain(), node.OpType(), node.SinceVersion()};
}
#if !defined(ORT_MINIMAL_BUILD)
inline onnxruntime::OpIdentifier MakeOpId(const ONNX_NAMESPACE::OpSchema& op_schema) {
return onnxruntime::OpIdentifier{op_schema.domain(), op_schema.Name(), op_schema.SinceVersion()};
}
#endif // !defined(ORT_MINIMAL_BUILD)
} // namespace utils
} // namespace onnxruntime