mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Check kernel def hashes (#7120)
Add unit test for verifying kernel def hashes. Add way to add new types to kernel definition without changing hash.
This commit is contained in:
parent
15c67ddbf0
commit
0ebeaf529d
23 changed files with 3474 additions and 76 deletions
|
|
@ -709,6 +709,10 @@ endif()
|
|||
|
||||
add_subdirectory(external/mp11 EXCLUDE_FROM_ALL)
|
||||
|
||||
set(JSON_BuildTests OFF CACHE INTERNAL "")
|
||||
set(JSON_Install OFF CACHE INTERNAL "")
|
||||
add_subdirectory(external/json EXCLUDE_FROM_ALL)
|
||||
|
||||
if(onnxruntime_PREFER_SYSTEM_LIB)
|
||||
find_package(re2)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -139,10 +139,20 @@ if (onnxruntime_ENABLE_TRAINING_OPS)
|
|||
list(APPEND onnxruntime_providers_src ${onnxruntime_cpu_training_ops_srcs})
|
||||
|
||||
file(GLOB_RECURSE onnxruntime_cpu_full_training_only_srcs
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/gist/*.h"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/collective/*.cc"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/collective/*.h"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/communication/*.cc"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/communication/*.h"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/controlflow/record.cc"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/controlflow/record.h"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/controlflow/wait.cc"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/controlflow/wait.h"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/controlflow/yield.cc"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/controlflow/yield.h"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/gist/*.cc"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/tensorboard/*.h"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/gist/*.h"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/tensorboard/*.cc"
|
||||
"${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/tensorboard/*.h"
|
||||
)
|
||||
|
||||
list(REMOVE_ITEM onnxruntime_providers_src ${onnxruntime_cpu_full_training_only_srcs})
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ onnxruntime_add_include_to_target(onnxruntime_session onnxruntime_common onnxrun
|
|||
if(onnxruntime_ENABLE_INSTRUMENT)
|
||||
target_compile_definitions(onnxruntime_session PUBLIC ONNXRUNTIME_ENABLE_INSTRUMENT)
|
||||
endif()
|
||||
target_include_directories(onnxruntime_session PRIVATE ${ONNXRUNTIME_ROOT} ${PROJECT_SOURCE_DIR}/external/json ${eigen_INCLUDE_DIRS})
|
||||
target_include_directories(onnxruntime_session PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS})
|
||||
target_link_libraries(onnxruntime_session PRIVATE nlohmann_json::nlohmann_json)
|
||||
add_dependencies(onnxruntime_session ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
set_target_properties(onnxruntime_session PROPERTIES FOLDER "ONNXRuntime")
|
||||
if (onnxruntime_USE_CUDA)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ add_dependencies(onnxruntime_training_runner ${onnxruntime_EXTERNAL_DEPENDENCIES
|
|||
|
||||
onnxruntime_add_include_to_target(onnxruntime_training_runner onnxruntime_training onnxruntime_framework onnxruntime_common onnx onnx_proto protobuf::libprotobuf onnxruntime_training flatbuffers)
|
||||
|
||||
target_include_directories(onnxruntime_training_runner PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${ORTTRAINING_ROOT} ${eigen_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/external/json PUBLIC ${onnxruntime_graph_header})
|
||||
target_include_directories(onnxruntime_training_runner PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${ORTTRAINING_ROOT} ${eigen_INCLUDE_DIRS} PUBLIC ${onnxruntime_graph_header})
|
||||
target_link_libraries(onnxruntime_training_runner PRIVATE nlohmann_json::nlohmann_json)
|
||||
if (onnxruntime_USE_CUDA)
|
||||
target_include_directories(onnxruntime_training_runner PUBLIC ${onnxruntime_CUDNN_HOME}/include ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -607,7 +607,9 @@ endif()
|
|||
AddTest(
|
||||
TARGET onnxruntime_test_all
|
||||
SOURCES ${all_tests} ${onnxruntime_unittest_main_src}
|
||||
LIBS onnx_test_runner_common ${onnxruntime_test_providers_libs} ${onnxruntime_test_common_libs} re2::re2 onnx_test_data_proto
|
||||
LIBS
|
||||
onnx_test_runner_common ${onnxruntime_test_providers_libs} ${onnxruntime_test_common_libs} re2::re2
|
||||
onnx_test_data_proto nlohmann_json::nlohmann_json
|
||||
DEPENDS ${all_dependencies}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,13 @@ class KernelDef {
|
|||
return provider_type_;
|
||||
}
|
||||
|
||||
// type constraints with types supported by default
|
||||
const std::map<std::string, std::vector<MLDataType>>& TypeConstraints() const {
|
||||
return default_type_constraints_;
|
||||
}
|
||||
|
||||
// type constraints with types supported in this build
|
||||
const std::map<std::string, std::vector<MLDataType>>& EnabledTypeConstraints() const {
|
||||
return enabled_type_constraints_;
|
||||
}
|
||||
|
||||
|
|
@ -127,16 +133,20 @@ class KernelDef {
|
|||
// The type of the execution provider.
|
||||
std::string provider_type_;
|
||||
|
||||
// The supported data types for inputs/outputs.
|
||||
// The data types that are supported by default for inputs/outputs.
|
||||
// Key is input/output name defined in op schema, Value are supported types.
|
||||
// note: std::map as we need the order to be deterministic for the hash
|
||||
// Note: supported_type_constraints_ are used to calculate the kernel hash so that the hash is
|
||||
// Note: default_type_constraints_ are used to calculate the kernel hash so that the hash is
|
||||
// stable across builds with and without kernel type reduction enabled.
|
||||
std::map<std::string, std::vector<MLDataType>> supported_type_constraints_;
|
||||
std::map<std::string, std::vector<MLDataType>> default_type_constraints_;
|
||||
|
||||
// the type constraints that are enabled in this build for the kernel
|
||||
// the type constraints that are supported in this build (enabled) for the kernel
|
||||
std::map<std::string, std::vector<MLDataType>> enabled_type_constraints_;
|
||||
|
||||
// optional alternate type constraints to use to calculate the hash instead of default_type_constraints_
|
||||
// note: this provides a way to update the default type constraints while preserving the hash value
|
||||
optional<std::map<std::string, std::vector<MLDataType>>> hash_type_constraints_;
|
||||
|
||||
// An element <i, j> means that output j reuses the memory of input i.
|
||||
std::vector<std::pair<int, int>> inplace_map_;
|
||||
|
||||
|
|
@ -209,27 +219,41 @@ class KernelDefBuilder {
|
|||
/**
|
||||
Specify the set of types that this kernel supports. A further restriction
|
||||
of the set of types specified in the op schema.
|
||||
The arg name could be either op formal parameter name, say "X", or type
|
||||
argument name specified in op schema, say "T".
|
||||
If this build uses type reduction the enabled types can optionally be provided.
|
||||
|
||||
@param arg_name The arg name can be either op formal parameter name, say "X", or type
|
||||
argument name specified in op schema, say "T".
|
||||
@param default_types The types that are supported by default.
|
||||
@param enabled_types The types that are supported in this build.
|
||||
Possibly different from default_types when type reduction is enabled.
|
||||
*/
|
||||
KernelDefBuilder& TypeConstraint(const std::string& arg_name,
|
||||
const std::vector<MLDataType>& supported_types);
|
||||
const std::vector<MLDataType>& default_types);
|
||||
KernelDefBuilder& TypeConstraint(const char* arg_name,
|
||||
const std::vector<MLDataType>& supported_types);
|
||||
const std::vector<MLDataType>& default_types);
|
||||
|
||||
KernelDefBuilder& TypeConstraint(const std::string& arg_name,
|
||||
const std::vector<MLDataType>& supported_types,
|
||||
const std::vector<MLDataType>& default_types,
|
||||
const std::vector<MLDataType>& enabled_types);
|
||||
KernelDefBuilder& TypeConstraint(const char* arg_name,
|
||||
const std::vector<MLDataType>& supported_types,
|
||||
const std::vector<MLDataType>& default_types,
|
||||
const std::vector<MLDataType>& enabled_types);
|
||||
|
||||
/**
|
||||
Like TypeConstraint but supports just a single type.
|
||||
*/
|
||||
KernelDefBuilder& TypeConstraint(const std::string& arg_name, MLDataType supported_type);
|
||||
KernelDefBuilder& TypeConstraint(const char* arg_name, MLDataType supported_type);
|
||||
KernelDefBuilder& TypeConstraint(const std::string& arg_name, MLDataType default_type);
|
||||
KernelDefBuilder& TypeConstraint(const char* arg_name, MLDataType default_type);
|
||||
|
||||
/**
|
||||
Specify the original set of types that this kernel supports by default to use when computing the kernel def hash.
|
||||
The set of types supported by default may change over time, but the hash should stay the same.
|
||||
*/
|
||||
KernelDefBuilder& FixedTypeConstraintForHash(
|
||||
const std::string& arg_name,
|
||||
const std::vector<MLDataType>& default_types_for_hash);
|
||||
KernelDefBuilder& FixedTypeConstraintForHash(
|
||||
const char* arg_name,
|
||||
const std::vector<MLDataType>& default_types_for_hash);
|
||||
|
||||
/**
|
||||
Inplace mapping from inputs to outputs allowed.
|
||||
|
|
@ -360,7 +384,7 @@ class KernelDefBuilder {
|
|||
|
||||
private:
|
||||
KernelDefBuilder& TypeConstraintImpl(const std::string& arg_name,
|
||||
const std::vector<MLDataType>& supported_types,
|
||||
const std::vector<MLDataType>& default_types,
|
||||
const std::vector<MLDataType>* enabled_types = nullptr);
|
||||
|
||||
// we own the KernelDef until Build() is called.
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
namespace onnxruntime {
|
||||
|
||||
using KernelCreateMap = std::multimap<std::string, KernelCreateInfo>;
|
||||
using KernelDefHashes = std::vector<std::pair<std::string, uint64_t>>;
|
||||
|
||||
/**
|
||||
* Each provider has a KernelRegistry. Often, the KernelRegistry only belongs to that specific provider.
|
||||
|
|
@ -61,6 +62,9 @@ class KernelRegistry {
|
|||
}
|
||||
#endif
|
||||
|
||||
// Get sorted kernel def key and hash pairs.
|
||||
KernelDefHashes ExportKernelDefHashes() const;
|
||||
|
||||
private:
|
||||
#if !defined(ORT_MINIMAL_BUILD)
|
||||
// Check whether the types of inputs/outputs of the given node match the extra
|
||||
|
|
|
|||
|
|
@ -56,8 +56,11 @@ void KernelDef::CalculateHash() {
|
|||
hash_str(op_domain_);
|
||||
hash_str(provider_type_);
|
||||
|
||||
// use the supported_type_constraints_ list for the hash so the value in an ORT format model is stable.
|
||||
for (const auto& key_value : supported_type_constraints_) {
|
||||
// use the hash_type_constraints_ or default_type_constraints_ list for the hash so the value in an ORT format model
|
||||
// is stable.
|
||||
const auto& hash_type_constraints =
|
||||
hash_type_constraints_.has_value() ? *hash_type_constraints_ : default_type_constraints_;
|
||||
for (const auto& key_value : hash_type_constraints) {
|
||||
hash_str(key_value.first);
|
||||
auto data_type_strings = DataTypeImpl::ToString(key_value.second);
|
||||
// sort type constraint data type strings so that order does not matter
|
||||
|
|
@ -94,9 +97,9 @@ bool KernelDef::IsConflict(const KernelDef& other) const {
|
|||
//only one case they don't conflict:
|
||||
//There is a type_constraint, it exists in both hands, but they don't overlap
|
||||
//check types
|
||||
const auto& other_types = other.TypeConstraints();
|
||||
const auto& other_types = other.default_type_constraints_;
|
||||
bool type_has_conflict = true;
|
||||
for (const auto& it : supported_type_constraints_) {
|
||||
for (const auto& it : default_type_constraints_) {
|
||||
auto iter = other_types.find(it.first);
|
||||
if (iter != other_types.end()) {
|
||||
if (!AreVectorsOverlap(it.second, iter->second)) {
|
||||
|
|
@ -173,46 +176,63 @@ KernelDefBuilder& KernelDefBuilder::Provider(const char* provider_type) {
|
|||
}
|
||||
|
||||
KernelDefBuilder& KernelDefBuilder::TypeConstraintImpl(const std::string& arg_name,
|
||||
const std::vector<MLDataType>& supported_types,
|
||||
const std::vector<MLDataType>& default_types,
|
||||
const std::vector<MLDataType>* enabled_types) {
|
||||
// use the enabled types list if provided
|
||||
kernel_def_->enabled_type_constraints_[arg_name] = enabled_types ? *enabled_types : supported_types;
|
||||
kernel_def_->supported_type_constraints_[arg_name] = supported_types;
|
||||
kernel_def_->enabled_type_constraints_[arg_name] = enabled_types ? *enabled_types : default_types;
|
||||
kernel_def_->default_type_constraints_[arg_name] = default_types;
|
||||
return *this;
|
||||
}
|
||||
|
||||
KernelDefBuilder& KernelDefBuilder::TypeConstraint(const std::string& arg_name,
|
||||
const std::vector<MLDataType>& supported_types) {
|
||||
return TypeConstraintImpl(arg_name, supported_types, nullptr);
|
||||
const std::vector<MLDataType>& default_types) {
|
||||
return TypeConstraintImpl(arg_name, default_types, nullptr);
|
||||
}
|
||||
|
||||
KernelDefBuilder& KernelDefBuilder::TypeConstraint(const char* arg_name,
|
||||
const std::vector<MLDataType>& supported_types) {
|
||||
return TypeConstraintImpl(arg_name, supported_types, nullptr);
|
||||
const std::vector<MLDataType>& default_types) {
|
||||
return TypeConstraintImpl(arg_name, default_types, nullptr);
|
||||
}
|
||||
|
||||
KernelDefBuilder& KernelDefBuilder::TypeConstraint(const std::string& arg_name,
|
||||
const std::vector<MLDataType>& supported_types,
|
||||
const std::vector<MLDataType>& default_types,
|
||||
const std::vector<MLDataType>& enabled_types) {
|
||||
return TypeConstraintImpl(arg_name, supported_types, &enabled_types);
|
||||
return TypeConstraintImpl(arg_name, default_types, &enabled_types);
|
||||
}
|
||||
|
||||
KernelDefBuilder& KernelDefBuilder::TypeConstraint(const char* arg_name,
|
||||
const std::vector<MLDataType>& supported_types,
|
||||
const std::vector<MLDataType>& default_types,
|
||||
const std::vector<MLDataType>& enabled_types) {
|
||||
return TypeConstraintImpl(arg_name, supported_types, &enabled_types);
|
||||
return TypeConstraintImpl(arg_name, default_types, &enabled_types);
|
||||
}
|
||||
|
||||
KernelDefBuilder& KernelDefBuilder::TypeConstraint(const std::string& arg_name,
|
||||
MLDataType supported_type) {
|
||||
kernel_def_->enabled_type_constraints_[arg_name] = std::vector<MLDataType>{supported_type};
|
||||
kernel_def_->supported_type_constraints_[arg_name] = std::vector<MLDataType>{supported_type};
|
||||
MLDataType default_type) {
|
||||
kernel_def_->enabled_type_constraints_[arg_name] = std::vector<MLDataType>{default_type};
|
||||
kernel_def_->default_type_constraints_[arg_name] = std::vector<MLDataType>{default_type};
|
||||
return *this;
|
||||
}
|
||||
|
||||
KernelDefBuilder& KernelDefBuilder::TypeConstraint(const char* arg_name,
|
||||
MLDataType supported_type) {
|
||||
return TypeConstraint(std::string(arg_name), supported_type);
|
||||
MLDataType default_type) {
|
||||
return TypeConstraint(std::string(arg_name), default_type);
|
||||
}
|
||||
|
||||
KernelDefBuilder& KernelDefBuilder::FixedTypeConstraintForHash(
|
||||
const std::string& arg_name,
|
||||
const std::vector<MLDataType>& default_types_for_hash) {
|
||||
auto& hash_type_constraints = kernel_def_->hash_type_constraints_;
|
||||
if (!hash_type_constraints.has_value()) {
|
||||
hash_type_constraints.emplace();
|
||||
}
|
||||
(*hash_type_constraints)[arg_name] = default_types_for_hash;
|
||||
return *this;
|
||||
}
|
||||
|
||||
KernelDefBuilder& KernelDefBuilder::FixedTypeConstraintForHash(
|
||||
const char* arg_name,
|
||||
const std::vector<MLDataType>& default_types_for_hash) {
|
||||
return FixedTypeConstraintForHash(std::string{arg_name}, default_types_for_hash);
|
||||
}
|
||||
|
||||
KernelDefBuilder& KernelDefBuilder::MayInplace(const std::vector<std::pair<int, int>>& inplaces) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "core/framework/kernel_registry.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include "core/framework/kernel_registry.h"
|
||||
|
||||
#include "core/framework/session_state.h"
|
||||
|
||||
using namespace ::onnxruntime::common;
|
||||
|
|
@ -149,7 +152,7 @@ bool KernelRegistry::VerifyKernelDef(const onnxruntime::Node& node,
|
|||
}
|
||||
|
||||
// check if type matches
|
||||
auto& kernel_type_constraints = kernel_def.TypeConstraints();
|
||||
auto& kernel_type_constraints = kernel_def.EnabledTypeConstraints();
|
||||
|
||||
// Note: The number of formal input/output parameters is N and the number of
|
||||
// type constraints is M. We select between an O(N*M) and an O(N+M) approach.
|
||||
|
|
@ -323,4 +326,17 @@ Status KernelRegistry::Register(KernelCreateInfo&& create_info) {
|
|||
return Status::OK();
|
||||
}
|
||||
|
||||
KernelDefHashes KernelRegistry::ExportKernelDefHashes() const {
|
||||
KernelDefHashes result{};
|
||||
result.reserve(kernel_creator_fn_map_.size());
|
||||
std::transform(
|
||||
kernel_creator_fn_map_.begin(), kernel_creator_fn_map_.end(),
|
||||
std::back_inserter(result),
|
||||
[](const KernelCreateMap::value_type& kvp) {
|
||||
return std::make_pair(kvp.first, kvp.second.kernel_def->GetHash());
|
||||
});
|
||||
std::sort(result.begin(), result.end());
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace onnxruntime
|
||||
|
|
|
|||
|
|
@ -1882,7 +1882,7 @@ Status RegisterOnnxMLOperatorKernels(KernelRegistry& kernel_registry) {
|
|||
} // namespace ml
|
||||
#endif
|
||||
|
||||
static Status RegisterCPUKernels(KernelRegistry& kernel_registry) {
|
||||
Status RegisterCPUKernels(KernelRegistry& kernel_registry) {
|
||||
ORT_RETURN_IF_ERROR(RegisterOnnxOperatorKernels(kernel_registry));
|
||||
#ifndef DISABLE_ML_OPS
|
||||
ORT_RETURN_IF_ERROR(::onnxruntime::ml::RegisterOnnxMLOperatorKernels(kernel_registry));
|
||||
|
|
|
|||
|
|
@ -52,4 +52,8 @@ class CPUExecutionProvider : public IExecutionProvider {
|
|||
private:
|
||||
std::vector<FuseRuleFn> fuse_rules_;
|
||||
};
|
||||
|
||||
// Registers all available CPU kernels
|
||||
Status RegisterCPUKernels(KernelRegistry& kernel_registry);
|
||||
|
||||
} // namespace onnxruntime
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#pragma warning(push)
|
||||
#pragma warning(disable : 28020)
|
||||
#endif
|
||||
#include "single_include/nlohmann/json.hpp"
|
||||
#include "nlohmann/json.hpp"
|
||||
#ifdef _WIN32
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ TEST(KernelDefTest, HashIgnoresTypeConstraintTypeOrdering) {
|
|||
auto build_kernel_def = [](std::vector<MLDataType> type_constraint_types) {
|
||||
return KernelDefBuilder{}
|
||||
.SetName("MyOp")
|
||||
.SetDomain("MyDomain")
|
||||
.Provider("MyProvider")
|
||||
.TypeConstraint("T", type_constraint_types)
|
||||
.Build();
|
||||
};
|
||||
|
|
@ -26,5 +24,21 @@ TEST(KernelDefTest, HashIgnoresTypeConstraintTypeOrdering) {
|
|||
ASSERT_EQ(a->GetHash(), b->GetHash());
|
||||
}
|
||||
|
||||
TEST(KernelDefTest, HashUsesFixedTypeConstraint) {
|
||||
const auto a =
|
||||
KernelDefBuilder{}
|
||||
.SetName("MyOp")
|
||||
.TypeConstraint("T", BuildKernelDefConstraints<int, double>())
|
||||
.Build();
|
||||
const auto b =
|
||||
KernelDefBuilder{}
|
||||
.SetName("MyOp")
|
||||
.TypeConstraint("T", BuildKernelDefConstraints<int, double, float>())
|
||||
.FixedTypeConstraintForHash("T", BuildKernelDefConstraints<int, double>())
|
||||
.Build();
|
||||
|
||||
ASSERT_EQ(a->GetHash(), b->GetHash());
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace onnxruntime
|
||||
|
|
|
|||
184
onnxruntime/test/providers/kernel_def_hash_test.cc
Normal file
184
onnxruntime/test/providers/kernel_def_hash_test.cc
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* IMPORTANT NOTE AT THE TOP OF THE FILE
|
||||
*
|
||||
* This file contains tests which verify expected kernel def hashes.
|
||||
* It is important for these to remain stable so that ORT format models are
|
||||
* backward compatible.
|
||||
*
|
||||
* If you are seeing a test failure from one of these tests, it is likely that
|
||||
* some kernel definition changed in a way that updated its hash value.
|
||||
* This is what we want to catch! Please update the kernel definition.
|
||||
* If adding more supported types to an existing kernel definition, consider
|
||||
* using KernelDefBuilder::FixedTypeConstraintForHash().
|
||||
*
|
||||
* For example:
|
||||
* Say we have a kernel definition like this, which supports types int and
|
||||
* double:
|
||||
* KernelDefBuilder{}
|
||||
* .TypeConstraint(
|
||||
* "T", BuildKernelDefConstraints<int, double>())
|
||||
* If we want to update the kernel definition to add support for float, we can
|
||||
* change it to something like this:
|
||||
* KernelDefBuilder{}
|
||||
* .TypeConstraint(
|
||||
* "T", BuildKernelDefConstraints<int, double, float>())
|
||||
* .FixedTypeConstraintForHash(
|
||||
* "T", BuildKernelDefConstraints<int, double>())
|
||||
* In the updated kernel definition, the original types are specified with
|
||||
* FixedTypeConstraintForHash().
|
||||
*
|
||||
* New kernel definitions should not use FixedTypeConstraintForHash().
|
||||
* It is a way to keep the hash stable as kernel definitions change.
|
||||
*
|
||||
* It is also possible that you have added a new kernel definition and are
|
||||
* seeing a message from one of these tests about updating the expected data.
|
||||
* Please do that if appropriate.
|
||||
*
|
||||
* The expected value files are in this directory:
|
||||
* onnxruntime/test/testdata/kernel_def_hashes
|
||||
* The data is specified in JSON as an array of key-value arrays.
|
||||
* Example data can be written to stdout with this test:
|
||||
* KernelDefHashTest.DISABLED_PrintCpuKernelDefHashes
|
||||
* Use the option --gtest_also_run_disabled_tests to enable it.
|
||||
* Be careful about updating the expected values - as mentioned before, the
|
||||
* values should be stable. Typically, we should only add new entries.
|
||||
*
|
||||
* In the unlikely event that we need to make a change to the kernel def
|
||||
* hashing that breaks backward compatibility, the expected values may need to
|
||||
* be updated.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <cinttypes>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 28020)
|
||||
#endif
|
||||
#include "nlohmann/json.hpp"
|
||||
#ifdef _WIN32
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include "asserts.h"
|
||||
#include "core/common/common.h"
|
||||
#include "core/common/path_string.h"
|
||||
#include "core/framework/kernel_registry.h"
|
||||
#include "core/mlas/inc/mlas.h"
|
||||
#include "core/platform/env_var_utils.h"
|
||||
#include "core/providers/cpu/cpu_execution_provider.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace onnxruntime {
|
||||
namespace test {
|
||||
|
||||
namespace {
|
||||
// If set to 1, do strict checking of the kernel def hash values.
|
||||
// With strict checking, the expected and actual values must match exactly.
|
||||
// Otherwise, the expected values must be present in the actual values.
|
||||
static constexpr const char* kStrictKernelDefHashCheckEnvVar =
|
||||
"ORT_TEST_STRICT_KERNEL_DEF_HASH_CHECK";
|
||||
|
||||
std::string DumpKernelDefHashes(const onnxruntime::KernelDefHashes& kernel_def_hashes) {
|
||||
const json j(kernel_def_hashes);
|
||||
return j.dump(/* indent */ 4);
|
||||
}
|
||||
|
||||
KernelDefHashes ParseKernelDefHashes(std::istream& in) {
|
||||
KernelDefHashes kernel_def_hashes{};
|
||||
const json j = json::parse(in);
|
||||
j.get_to<onnxruntime::KernelDefHashes>(kernel_def_hashes);
|
||||
return kernel_def_hashes;
|
||||
}
|
||||
|
||||
void AppendKernelDefHashesFromFile(const PathString& path, KernelDefHashes& kernel_def_hashes) {
|
||||
std::ifstream in{path};
|
||||
ORT_ENFORCE(in, "Failed to open file: ", ToMBString(path));
|
||||
const auto file_kernel_def_hashes = ParseKernelDefHashes(in);
|
||||
kernel_def_hashes.insert(
|
||||
kernel_def_hashes.end(), file_kernel_def_hashes.begin(), file_kernel_def_hashes.end());
|
||||
}
|
||||
|
||||
void CheckKernelDefHashes(const KernelDefHashes& actual, const KernelDefHashes& expected, bool is_strict) {
|
||||
ASSERT_TRUE(std::is_sorted(actual.begin(), actual.end()));
|
||||
ASSERT_TRUE(std::is_sorted(expected.begin(), expected.end()));
|
||||
|
||||
constexpr const char* kNoteReference = "Note: Please read the note at the top of this file: " __FILE__;
|
||||
|
||||
KernelDefHashes expected_minus_actual{};
|
||||
std::set_difference(expected.begin(), expected.end(), actual.begin(), actual.end(),
|
||||
std::back_inserter(expected_minus_actual));
|
||||
if (!expected_minus_actual.empty()) {
|
||||
const auto message = MakeString(
|
||||
"Some expected kernel def hashes were not found.\n",
|
||||
kNoteReference, "\n",
|
||||
DumpKernelDefHashes(expected_minus_actual));
|
||||
ADD_FAILURE() << message;
|
||||
}
|
||||
|
||||
KernelDefHashes actual_minus_expected{};
|
||||
std::set_difference(actual.begin(), actual.end(), expected.begin(), expected.end(),
|
||||
std::back_inserter(actual_minus_expected));
|
||||
if (!actual_minus_expected.empty()) {
|
||||
const auto message = MakeString(
|
||||
"Unexpected kernel def hashes were found, please update the expected values as needed "
|
||||
"(see the output below).\n",
|
||||
kNoteReference, "\n",
|
||||
DumpKernelDefHashes(actual_minus_expected));
|
||||
if (is_strict) {
|
||||
ADD_FAILURE() << message;
|
||||
} else {
|
||||
std::cerr << message << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TEST(KernelDefHashTest, DISABLED_PrintCpuKernelDefHashes) {
|
||||
KernelRegistry kernel_registry{};
|
||||
ASSERT_STATUS_OK(RegisterCPUKernels(kernel_registry));
|
||||
const auto cpu_kernel_def_hashes = kernel_registry.ExportKernelDefHashes();
|
||||
std::cout << DumpKernelDefHashes(cpu_kernel_def_hashes) << "\n";
|
||||
}
|
||||
|
||||
TEST(KernelDefHashTest, ExpectedCpuKernelDefHashes) {
|
||||
const bool is_strict = ParseEnvironmentVariableWithDefault<bool>(kStrictKernelDefHashCheckEnvVar, false);
|
||||
|
||||
const auto expected_cpu_kernel_def_hashes = []() {
|
||||
KernelDefHashes result{};
|
||||
AppendKernelDefHashesFromFile(ORT_TSTR("testdata/kernel_def_hashes/onnx.cpu.json"), result);
|
||||
#if !defined(DISABLE_ML_OPS)
|
||||
AppendKernelDefHashesFromFile(ORT_TSTR("testdata/kernel_def_hashes/onnx.ml.cpu.json"), result);
|
||||
#endif // !DISABLE_ML_OPS
|
||||
#if !defined(DISABLE_CONTRIB_OPS)
|
||||
AppendKernelDefHashesFromFile(ORT_TSTR("testdata/kernel_def_hashes/contrib.cpu.json"), result);
|
||||
// NCHWc kernels are enabled if MlasNchwcGetBlockSize() > 1
|
||||
if (MlasNchwcGetBlockSize() > 1) {
|
||||
AppendKernelDefHashesFromFile(ORT_TSTR("testdata/kernel_def_hashes/contrib.nchwc.cpu.json"), result);
|
||||
}
|
||||
#endif // !DISABLE_CONTRIB_OPS
|
||||
#if defined(ENABLE_TRAINING_OPS)
|
||||
AppendKernelDefHashesFromFile(ORT_TSTR("testdata/kernel_def_hashes/training_ops.cpu.json"), result);
|
||||
#endif // ENABLE_TRAINING_OPS
|
||||
// TODO also handle kernels enabled by these symbols: ML_FEATURIZERS, BUILD_MS_EXPERIMENTAL_OPS
|
||||
std::sort(result.begin(), result.end());
|
||||
return result;
|
||||
}();
|
||||
|
||||
KernelRegistry kernel_registry{};
|
||||
ASSERT_STATUS_OK(RegisterCPUKernels(kernel_registry));
|
||||
auto cpu_kernel_def_hashes = kernel_registry.ExportKernelDefHashes();
|
||||
|
||||
CheckKernelDefHashes(cpu_kernel_def_hashes, expected_cpu_kernel_def_hashes, is_strict);
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace onnxruntime
|
||||
250
onnxruntime/test/testdata/kernel_def_hashes/contrib.cpu.json
vendored
Normal file
250
onnxruntime/test/testdata/kernel_def_hashes/contrib.cpu.json
vendored
Normal file
|
|
@ -0,0 +1,250 @@
|
|||
[
|
||||
[
|
||||
"Affine ai.onnx CPUExecutionProvider",
|
||||
7811918192248490408
|
||||
],
|
||||
[
|
||||
"Crop ai.onnx CPUExecutionProvider",
|
||||
6914973556202621376
|
||||
],
|
||||
[
|
||||
"DynamicSlice ai.onnx CPUExecutionProvider",
|
||||
5387668728763060584
|
||||
],
|
||||
[
|
||||
"ImageScaler ai.onnx CPUExecutionProvider",
|
||||
2013093418027264536
|
||||
],
|
||||
[
|
||||
"LayerNormalization ai.onnx CPUExecutionProvider",
|
||||
4058615579523172864
|
||||
],
|
||||
[
|
||||
"LayerNormalization ai.onnx CPUExecutionProvider",
|
||||
8466416990072218056
|
||||
],
|
||||
[
|
||||
"MeanVarianceNormalization ai.onnx CPUExecutionProvider",
|
||||
13114085849278607104
|
||||
],
|
||||
[
|
||||
"ParametricSoftplus ai.onnx CPUExecutionProvider",
|
||||
17971715260566574960
|
||||
],
|
||||
[
|
||||
"Scale ai.onnx CPUExecutionProvider",
|
||||
12599351089228483328
|
||||
],
|
||||
[
|
||||
"ScaledTanh ai.onnx CPUExecutionProvider",
|
||||
15584477984618710520
|
||||
],
|
||||
[
|
||||
"SimplifiedLayerNormalization ai.onnx CPUExecutionProvider",
|
||||
16349480652468900704
|
||||
],
|
||||
[
|
||||
"SimplifiedLayerNormalization ai.onnx CPUExecutionProvider",
|
||||
418129161279605176
|
||||
],
|
||||
[
|
||||
"ThresholdedRelu ai.onnx CPUExecutionProvider",
|
||||
17820769706565099200
|
||||
],
|
||||
[
|
||||
"Attention com.microsoft CPUExecutionProvider",
|
||||
16464502426529915864
|
||||
],
|
||||
[
|
||||
"AttnLSTM com.microsoft CPUExecutionProvider",
|
||||
15421184737689665128
|
||||
],
|
||||
[
|
||||
"BiasGelu com.microsoft CPUExecutionProvider",
|
||||
12457646955212583504
|
||||
],
|
||||
[
|
||||
"CDist com.microsoft CPUExecutionProvider",
|
||||
889036143745127232
|
||||
],
|
||||
[
|
||||
"CDist com.microsoft CPUExecutionProvider",
|
||||
6280134801002897280
|
||||
],
|
||||
[
|
||||
"ConvTransposeWithDynamicPads com.microsoft CPUExecutionProvider",
|
||||
1596732273609633752
|
||||
],
|
||||
[
|
||||
"CropAndResize com.microsoft CPUExecutionProvider",
|
||||
7642430665819070720
|
||||
],
|
||||
[
|
||||
"DequantizeLinear com.microsoft CPUExecutionProvider",
|
||||
9034670407031092344
|
||||
],
|
||||
[
|
||||
"DequantizeLinear com.microsoft CPUExecutionProvider",
|
||||
12760451019866331016
|
||||
],
|
||||
[
|
||||
"DynamicQuantizeLSTM com.microsoft CPUExecutionProvider",
|
||||
640700714499684624
|
||||
],
|
||||
[
|
||||
"DynamicQuantizeMatMul com.microsoft CPUExecutionProvider",
|
||||
9591826880179639184
|
||||
],
|
||||
[
|
||||
"EmbedLayerNormalization com.microsoft CPUExecutionProvider",
|
||||
14614049725238705256
|
||||
],
|
||||
[
|
||||
"ExpandDims com.microsoft CPUExecutionProvider",
|
||||
5671892069881567792
|
||||
],
|
||||
[
|
||||
"FastGelu com.microsoft CPUExecutionProvider",
|
||||
18210983793195477200
|
||||
],
|
||||
[
|
||||
"FusedConv com.microsoft CPUExecutionProvider",
|
||||
11366858116389652832
|
||||
],
|
||||
[
|
||||
"FusedGemm com.microsoft CPUExecutionProvider",
|
||||
1341171831223136792
|
||||
],
|
||||
[
|
||||
"FusedMatMul com.microsoft CPUExecutionProvider",
|
||||
665364151288353496
|
||||
],
|
||||
[
|
||||
"GatherND com.microsoft CPUExecutionProvider",
|
||||
8466578404783779600
|
||||
],
|
||||
[
|
||||
"Gelu com.microsoft CPUExecutionProvider",
|
||||
4658746266161736328
|
||||
],
|
||||
[
|
||||
"Inverse com.microsoft CPUExecutionProvider",
|
||||
1037755270231788608
|
||||
],
|
||||
[
|
||||
"MatMulInteger16 com.microsoft CPUExecutionProvider",
|
||||
5265636774129358144
|
||||
],
|
||||
[
|
||||
"MatMulIntegerToFloat com.microsoft CPUExecutionProvider",
|
||||
7172777464471435800
|
||||
],
|
||||
[
|
||||
"MaxpoolWithMask com.microsoft CPUExecutionProvider",
|
||||
3144686615632467360
|
||||
],
|
||||
[
|
||||
"MurmurHash3 com.microsoft CPUExecutionProvider",
|
||||
2533733396673225096
|
||||
],
|
||||
[
|
||||
"NhwcMaxPool com.microsoft CPUExecutionProvider",
|
||||
8512357837341844248
|
||||
],
|
||||
[
|
||||
"Pad com.microsoft CPUExecutionProvider",
|
||||
15076596470814458544
|
||||
],
|
||||
[
|
||||
"QAttention com.microsoft CPUExecutionProvider",
|
||||
9844377440996919912
|
||||
],
|
||||
[
|
||||
"QLinearAdd com.microsoft CPUExecutionProvider",
|
||||
9958112514164905192
|
||||
],
|
||||
[
|
||||
"QLinearAdd com.microsoft CPUExecutionProvider",
|
||||
16322459350118343880
|
||||
],
|
||||
[
|
||||
"QLinearAveragePool com.microsoft CPUExecutionProvider",
|
||||
9152647959212466896
|
||||
],
|
||||
[
|
||||
"QLinearConv com.microsoft CPUExecutionProvider",
|
||||
16835965565578160400
|
||||
],
|
||||
[
|
||||
"QLinearGlobalAveragePool com.microsoft CPUExecutionProvider",
|
||||
8729391959357542728
|
||||
],
|
||||
[
|
||||
"QLinearLeakyRelu com.microsoft CPUExecutionProvider",
|
||||
3677670974923917280
|
||||
],
|
||||
[
|
||||
"QLinearLeakyRelu com.microsoft CPUExecutionProvider",
|
||||
17073324515720209136
|
||||
],
|
||||
[
|
||||
"QLinearMul com.microsoft CPUExecutionProvider",
|
||||
2406593953080780408
|
||||
],
|
||||
[
|
||||
"QLinearMul com.microsoft CPUExecutionProvider",
|
||||
17403503869116794888
|
||||
],
|
||||
[
|
||||
"QLinearSigmoid com.microsoft CPUExecutionProvider",
|
||||
17020165931626188400
|
||||
],
|
||||
[
|
||||
"QLinearSigmoid com.microsoft CPUExecutionProvider",
|
||||
17315947486917903320
|
||||
],
|
||||
[
|
||||
"QuantizeLinear com.microsoft CPUExecutionProvider",
|
||||
616915237400456368
|
||||
],
|
||||
[
|
||||
"QuantizeLinear com.microsoft CPUExecutionProvider",
|
||||
13556449850953958792
|
||||
],
|
||||
[
|
||||
"Range com.microsoft CPUExecutionProvider",
|
||||
9333951582187402912
|
||||
],
|
||||
[
|
||||
"SampleOp com.microsoft CPUExecutionProvider",
|
||||
11028204786545834016
|
||||
],
|
||||
[
|
||||
"SkipLayerNormalization com.microsoft CPUExecutionProvider",
|
||||
1829676129267529920
|
||||
],
|
||||
[
|
||||
"SkipLayerNormalization com.microsoft CPUExecutionProvider",
|
||||
15124962608939318760
|
||||
],
|
||||
[
|
||||
"Tokenizer com.microsoft CPUExecutionProvider",
|
||||
12821105347567077024
|
||||
],
|
||||
[
|
||||
"TransposeMatMul com.microsoft CPUExecutionProvider",
|
||||
3696625852111461496
|
||||
],
|
||||
[
|
||||
"Trilu com.microsoft CPUExecutionProvider",
|
||||
1828108687906670152
|
||||
],
|
||||
[
|
||||
"Unique com.microsoft CPUExecutionProvider",
|
||||
17512097873619224240
|
||||
],
|
||||
[
|
||||
"WordConvEmbedding com.microsoft CPUExecutionProvider",
|
||||
7416606351345164776
|
||||
]
|
||||
]
|
||||
34
onnxruntime/test/testdata/kernel_def_hashes/contrib.nchwc.cpu.json
vendored
Normal file
34
onnxruntime/test/testdata/kernel_def_hashes/contrib.nchwc.cpu.json
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[
|
||||
[
|
||||
"AveragePool com.microsoft.nchwc CPUExecutionProvider",
|
||||
12528194512485261552
|
||||
],
|
||||
[
|
||||
"Conv com.microsoft.nchwc CPUExecutionProvider",
|
||||
10643058043438608528
|
||||
],
|
||||
[
|
||||
"GlobalAveragePool com.microsoft.nchwc CPUExecutionProvider",
|
||||
9401543287182687288
|
||||
],
|
||||
[
|
||||
"GlobalMaxPool com.microsoft.nchwc CPUExecutionProvider",
|
||||
17341568537930161320
|
||||
],
|
||||
[
|
||||
"MaxPool com.microsoft.nchwc CPUExecutionProvider",
|
||||
14527249939908647936
|
||||
],
|
||||
[
|
||||
"ReorderInput com.microsoft.nchwc CPUExecutionProvider",
|
||||
14330795113746035424
|
||||
],
|
||||
[
|
||||
"ReorderOutput com.microsoft.nchwc CPUExecutionProvider",
|
||||
13428915370009679360
|
||||
],
|
||||
[
|
||||
"Upsample com.microsoft.nchwc CPUExecutionProvider",
|
||||
16347985363638744760
|
||||
]
|
||||
]
|
||||
2402
onnxruntime/test/testdata/kernel_def_hashes/onnx.cpu.json
vendored
Normal file
2402
onnxruntime/test/testdata/kernel_def_hashes/onnx.cpu.json
vendored
Normal file
File diff suppressed because it is too large
Load diff
178
onnxruntime/test/testdata/kernel_def_hashes/onnx.ml.cpu.json
vendored
Normal file
178
onnxruntime/test/testdata/kernel_def_hashes/onnx.ml.cpu.json
vendored
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
[
|
||||
[
|
||||
"ArrayFeatureExtractor ai.onnx.ml CPUExecutionProvider",
|
||||
2350526174341531704
|
||||
],
|
||||
[
|
||||
"ArrayFeatureExtractor ai.onnx.ml CPUExecutionProvider",
|
||||
6530469673967836712
|
||||
],
|
||||
[
|
||||
"ArrayFeatureExtractor ai.onnx.ml CPUExecutionProvider",
|
||||
6756475889913415064
|
||||
],
|
||||
[
|
||||
"ArrayFeatureExtractor ai.onnx.ml CPUExecutionProvider",
|
||||
11064940903354222584
|
||||
],
|
||||
[
|
||||
"ArrayFeatureExtractor ai.onnx.ml CPUExecutionProvider",
|
||||
16432528150559367472
|
||||
],
|
||||
[
|
||||
"Binarizer ai.onnx.ml CPUExecutionProvider",
|
||||
5046510072939685048
|
||||
],
|
||||
[
|
||||
"CastMap ai.onnx.ml CPUExecutionProvider",
|
||||
8048827990321743320
|
||||
],
|
||||
[
|
||||
"CategoryMapper ai.onnx.ml CPUExecutionProvider",
|
||||
2303612724843538232
|
||||
],
|
||||
[
|
||||
"DictVectorizer ai.onnx.ml CPUExecutionProvider",
|
||||
6689651410341671832
|
||||
],
|
||||
[
|
||||
"DictVectorizer ai.onnx.ml CPUExecutionProvider",
|
||||
7005642460916971440
|
||||
],
|
||||
[
|
||||
"DictVectorizer ai.onnx.ml CPUExecutionProvider",
|
||||
9815805762175478424
|
||||
],
|
||||
[
|
||||
"DictVectorizer ai.onnx.ml CPUExecutionProvider",
|
||||
10888259614400691552
|
||||
],
|
||||
[
|
||||
"DictVectorizer ai.onnx.ml CPUExecutionProvider",
|
||||
12166013579191601224
|
||||
],
|
||||
[
|
||||
"DictVectorizer ai.onnx.ml CPUExecutionProvider",
|
||||
14175801436008296008
|
||||
],
|
||||
[
|
||||
"FeatureVectorizer ai.onnx.ml CPUExecutionProvider",
|
||||
13725963185932500216
|
||||
],
|
||||
[
|
||||
"Imputer ai.onnx.ml CPUExecutionProvider",
|
||||
1198484622450883960
|
||||
],
|
||||
[
|
||||
"LabelEncoder ai.onnx.ml CPUExecutionProvider",
|
||||
72584427791628640
|
||||
],
|
||||
[
|
||||
"LabelEncoder ai.onnx.ml CPUExecutionProvider",
|
||||
643259145804007712
|
||||
],
|
||||
[
|
||||
"LabelEncoder ai.onnx.ml CPUExecutionProvider",
|
||||
2667163092143996224
|
||||
],
|
||||
[
|
||||
"LabelEncoder ai.onnx.ml CPUExecutionProvider",
|
||||
5922496927153994000
|
||||
],
|
||||
[
|
||||
"LabelEncoder ai.onnx.ml CPUExecutionProvider",
|
||||
11838196408428523536
|
||||
],
|
||||
[
|
||||
"LabelEncoder ai.onnx.ml CPUExecutionProvider",
|
||||
12429922703862798200
|
||||
],
|
||||
[
|
||||
"LabelEncoder ai.onnx.ml CPUExecutionProvider",
|
||||
12910259746827434448
|
||||
],
|
||||
[
|
||||
"LabelEncoder ai.onnx.ml CPUExecutionProvider",
|
||||
13358273281151927664
|
||||
],
|
||||
[
|
||||
"LinearClassifier ai.onnx.ml CPUExecutionProvider",
|
||||
2370253020407350728
|
||||
],
|
||||
[
|
||||
"LinearRegressor ai.onnx.ml CPUExecutionProvider",
|
||||
16822518791234245504
|
||||
],
|
||||
[
|
||||
"Normalizer ai.onnx.ml CPUExecutionProvider",
|
||||
4575839837655511352
|
||||
],
|
||||
[
|
||||
"OneHotEncoder ai.onnx.ml CPUExecutionProvider",
|
||||
566681355974248448
|
||||
],
|
||||
[
|
||||
"OneHotEncoder ai.onnx.ml CPUExecutionProvider",
|
||||
5824294864440328760
|
||||
],
|
||||
[
|
||||
"OneHotEncoder ai.onnx.ml CPUExecutionProvider",
|
||||
10362613019971997872
|
||||
],
|
||||
[
|
||||
"OneHotEncoder ai.onnx.ml CPUExecutionProvider",
|
||||
10397925769639456800
|
||||
],
|
||||
[
|
||||
"Scaler ai.onnx.ml CPUExecutionProvider",
|
||||
2957692969286147560
|
||||
],
|
||||
[
|
||||
"Scaler ai.onnx.ml CPUExecutionProvider",
|
||||
4622934914100034264
|
||||
],
|
||||
[
|
||||
"Scaler ai.onnx.ml CPUExecutionProvider",
|
||||
15151724670894748016
|
||||
],
|
||||
[
|
||||
"Scaler ai.onnx.ml CPUExecutionProvider",
|
||||
17146108806137553320
|
||||
],
|
||||
[
|
||||
"SVMClassifier ai.onnx.ml CPUExecutionProvider",
|
||||
16410276550989508464
|
||||
],
|
||||
[
|
||||
"SVMRegressor ai.onnx.ml CPUExecutionProvider",
|
||||
6414907892091941152
|
||||
],
|
||||
[
|
||||
"TreeEnsembleClassifier ai.onnx.ml CPUExecutionProvider",
|
||||
486797053154945264
|
||||
],
|
||||
[
|
||||
"TreeEnsembleClassifier ai.onnx.ml CPUExecutionProvider",
|
||||
7696156941733005088
|
||||
],
|
||||
[
|
||||
"TreeEnsembleClassifier ai.onnx.ml CPUExecutionProvider",
|
||||
7775841366762359432
|
||||
],
|
||||
[
|
||||
"TreeEnsembleClassifier ai.onnx.ml CPUExecutionProvider",
|
||||
18326787492602399840
|
||||
],
|
||||
[
|
||||
"TreeEnsembleRegressor ai.onnx.ml CPUExecutionProvider",
|
||||
1006399804521896912
|
||||
],
|
||||
[
|
||||
"TreeEnsembleRegressor ai.onnx.ml CPUExecutionProvider",
|
||||
12993125630596348064
|
||||
],
|
||||
[
|
||||
"ZipMap ai.onnx.ml CPUExecutionProvider",
|
||||
868519487849210656
|
||||
]
|
||||
]
|
||||
238
onnxruntime/test/testdata/kernel_def_hashes/training_ops.cpu.json
vendored
Normal file
238
onnxruntime/test/testdata/kernel_def_hashes/training_ops.cpu.json
vendored
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
[
|
||||
[
|
||||
"AdamOptimizer com.microsoft CPUExecutionProvider",
|
||||
13275719513674142848
|
||||
],
|
||||
[
|
||||
"AveragePoolGrad ai.onnx CPUExecutionProvider",
|
||||
5748823370585834408
|
||||
],
|
||||
[
|
||||
"BiasFastGeluGrad_dX com.microsoft CPUExecutionProvider",
|
||||
18012658855595136536
|
||||
],
|
||||
[
|
||||
"BiasGeluGrad_dX com.microsoft CPUExecutionProvider",
|
||||
15594101660509653368
|
||||
],
|
||||
[
|
||||
"BroadcastGradientArgs com.microsoft CPUExecutionProvider",
|
||||
11924624129611280440
|
||||
],
|
||||
[
|
||||
"ConcatTraining com.microsoft CPUExecutionProvider",
|
||||
407435603592769928
|
||||
],
|
||||
[
|
||||
"ConvGrad ai.onnx CPUExecutionProvider",
|
||||
551027277226613536
|
||||
],
|
||||
[
|
||||
"DropoutGrad com.microsoft CPUExecutionProvider",
|
||||
5281827689086376112
|
||||
],
|
||||
[
|
||||
"DropoutGrad com.microsoft CPUExecutionProvider",
|
||||
5974036940246406232
|
||||
],
|
||||
[
|
||||
"DropoutGrad com.microsoft CPUExecutionProvider",
|
||||
6251139593746398664
|
||||
],
|
||||
[
|
||||
"DropoutGrad com.microsoft CPUExecutionProvider",
|
||||
11134433709210415000
|
||||
],
|
||||
[
|
||||
"DropoutGrad com.microsoft CPUExecutionProvider",
|
||||
14442689431073529904
|
||||
],
|
||||
[
|
||||
"DropoutGrad com.microsoft CPUExecutionProvider",
|
||||
14487527510076876072
|
||||
],
|
||||
[
|
||||
"FastGeluGrad com.microsoft CPUExecutionProvider",
|
||||
15449034010577224840
|
||||
],
|
||||
[
|
||||
"GatherElementsGrad com.microsoft CPUExecutionProvider",
|
||||
4371565130613539784
|
||||
],
|
||||
[
|
||||
"GatherGrad com.microsoft CPUExecutionProvider",
|
||||
16767260238333903216
|
||||
],
|
||||
[
|
||||
"GatherNDGrad com.microsoft CPUExecutionProvider",
|
||||
14458526033602252960
|
||||
],
|
||||
[
|
||||
"GeluGrad com.microsoft CPUExecutionProvider",
|
||||
3065626784130845072
|
||||
],
|
||||
[
|
||||
"Group com.microsoft CPUExecutionProvider",
|
||||
488667512000820344
|
||||
],
|
||||
[
|
||||
"InPlaceAccumulator com.microsoft CPUExecutionProvider",
|
||||
10152728201494720480
|
||||
],
|
||||
[
|
||||
"InvertibleLayerNormalizationGrad com.microsoft CPUExecutionProvider",
|
||||
678361860206315480
|
||||
],
|
||||
[
|
||||
"InvertibleLayerNormalizationGrad com.microsoft CPUExecutionProvider",
|
||||
3647079615262464056
|
||||
],
|
||||
[
|
||||
"LayerNormalizationGrad com.microsoft CPUExecutionProvider",
|
||||
9571863035992961528
|
||||
],
|
||||
[
|
||||
"LayerNormalizationGrad com.microsoft CPUExecutionProvider",
|
||||
15120500842480246904
|
||||
],
|
||||
[
|
||||
"LogSoftmaxGrad com.microsoft CPUExecutionProvider",
|
||||
2657523710083167200
|
||||
],
|
||||
[
|
||||
"MaxPoolGrad ai.onnx CPUExecutionProvider",
|
||||
17526822836083413768
|
||||
],
|
||||
[
|
||||
"PassThrough com.microsoft CPUExecutionProvider",
|
||||
15753758832962034552
|
||||
],
|
||||
[
|
||||
"ReduceAllL2 com.microsoft CPUExecutionProvider",
|
||||
10206006236140935288
|
||||
],
|
||||
[
|
||||
"ReduceSumTraining com.microsoft CPUExecutionProvider",
|
||||
4143442227179196240
|
||||
],
|
||||
[
|
||||
"ReduceSumTraining com.microsoft CPUExecutionProvider",
|
||||
8270932107741781432
|
||||
],
|
||||
[
|
||||
"ReduceSumTraining com.microsoft CPUExecutionProvider",
|
||||
10014758284200613760
|
||||
],
|
||||
[
|
||||
"ReduceSumTraining com.microsoft CPUExecutionProvider",
|
||||
11970256914235931792
|
||||
],
|
||||
[
|
||||
"ReluGrad com.microsoft CPUExecutionProvider",
|
||||
6194712211707544696
|
||||
],
|
||||
[
|
||||
"SGDOptimizer com.microsoft CPUExecutionProvider",
|
||||
6413752339355984752
|
||||
],
|
||||
[
|
||||
"Scale com.microsoft CPUExecutionProvider",
|
||||
4626702086191057400
|
||||
],
|
||||
[
|
||||
"Scale com.microsoft CPUExecutionProvider",
|
||||
7066774539152819712
|
||||
],
|
||||
[
|
||||
"Scale com.microsoft CPUExecutionProvider",
|
||||
7086129391615471904
|
||||
],
|
||||
[
|
||||
"Scale com.microsoft CPUExecutionProvider",
|
||||
8529929466096310624
|
||||
],
|
||||
[
|
||||
"Scale com.microsoft CPUExecutionProvider",
|
||||
9194708927698241584
|
||||
],
|
||||
[
|
||||
"Scale com.microsoft CPUExecutionProvider",
|
||||
15004008446550052608
|
||||
],
|
||||
[
|
||||
"Scale com.microsoft CPUExecutionProvider",
|
||||
16665599877841166880
|
||||
],
|
||||
[
|
||||
"Scale com.microsoft CPUExecutionProvider",
|
||||
17615601449933173216
|
||||
],
|
||||
[
|
||||
"SimplifiedLayerNormalizationGrad com.microsoft CPUExecutionProvider",
|
||||
9823114592183077488
|
||||
],
|
||||
[
|
||||
"SimplifiedLayerNormalizationGrad com.microsoft CPUExecutionProvider",
|
||||
17704727407887118880
|
||||
],
|
||||
[
|
||||
"SinGrad ai.onnx CPUExecutionProvider",
|
||||
6971400065913943256
|
||||
],
|
||||
[
|
||||
"SliceGrad com.microsoft CPUExecutionProvider",
|
||||
18003932513454931536
|
||||
],
|
||||
[
|
||||
"SoftmaxCrossEntropy com.microsoft CPUExecutionProvider",
|
||||
5470752940282787040
|
||||
],
|
||||
[
|
||||
"SoftmaxCrossEntropyGrad com.microsoft CPUExecutionProvider",
|
||||
17579254067477868408
|
||||
],
|
||||
[
|
||||
"SoftmaxCrossEntropyLoss ai.onnx CPUExecutionProvider",
|
||||
379111282162709688
|
||||
],
|
||||
[
|
||||
"SoftmaxCrossEntropyLoss ai.onnx CPUExecutionProvider",
|
||||
5256121368123320104
|
||||
],
|
||||
[
|
||||
"SoftmaxCrossEntropyLoss ai.onnx CPUExecutionProvider",
|
||||
14833827121724789864
|
||||
],
|
||||
[
|
||||
"SoftmaxCrossEntropyLoss ai.onnx CPUExecutionProvider",
|
||||
15405100773745075656
|
||||
],
|
||||
[
|
||||
"SoftmaxCrossEntropyLossGrad com.microsoft CPUExecutionProvider",
|
||||
8253282220433537112
|
||||
],
|
||||
[
|
||||
"SoftmaxCrossEntropyLossGrad com.microsoft CPUExecutionProvider",
|
||||
16283082098560169504
|
||||
],
|
||||
[
|
||||
"SoftmaxGrad com.microsoft CPUExecutionProvider",
|
||||
4483165757863027152
|
||||
],
|
||||
[
|
||||
"SparseSoftmaxCrossEntropy ai.onnx CPUExecutionProvider",
|
||||
10638058507241762520
|
||||
],
|
||||
[
|
||||
"SparseSoftmaxCrossEntropyGrad ai.onnx CPUExecutionProvider",
|
||||
17612183648106847376
|
||||
],
|
||||
[
|
||||
"SplitTraining com.microsoft CPUExecutionProvider",
|
||||
12689204749897364688
|
||||
],
|
||||
[
|
||||
"ZeroGradient com.microsoft CPUExecutionProvider",
|
||||
3284255990062374928
|
||||
]
|
||||
]
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
#if defined(USE_CUDA) && defined(ORT_USE_NCCL) && defined(USE_NCCL_P2P)
|
||||
#include "orttraining/training_ops/cuda/communication/nccl_service.h"
|
||||
#endif
|
||||
#include "single_include/nlohmann/json.hpp"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "test/perftest/utils.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
|
|
|||
|
|
@ -7,10 +7,6 @@
|
|||
namespace onnxruntime {
|
||||
namespace contrib {
|
||||
|
||||
#ifdef USE_MPI
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, AdasumAllReduce);
|
||||
#endif
|
||||
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SGDOptimizer);
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, AdamOptimizer);
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, InPlaceAccumulator);
|
||||
|
|
@ -58,14 +54,6 @@ class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1,
|
|||
class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, double_float, DropoutGrad);
|
||||
class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, double_double, DropoutGrad);
|
||||
|
||||
#ifdef ENABLE_TRAINING
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryScalar);
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryHistogram);
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryMerge);
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryText);
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, GistBinarizeEncoder);
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, GistBinarizeDecoder);
|
||||
#endif
|
||||
class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, float, LayerNormalizationGrad);
|
||||
class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, double, LayerNormalizationGrad);
|
||||
class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, float, SimplifiedLayerNormalizationGrad);
|
||||
|
|
@ -88,7 +76,12 @@ class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1,
|
|||
|
||||
class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, float_float, ReduceAllL2);
|
||||
|
||||
// the kernels within the following ifdef are not included in a build with
|
||||
// --enable_training_ops but without --enable_training
|
||||
#ifdef ENABLE_TRAINING
|
||||
#ifdef USE_MPI
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, AdasumAllReduce);
|
||||
|
||||
// Pipeline communication operators.
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, Send);
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, Recv);
|
||||
|
|
@ -98,12 +91,18 @@ class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, Recor
|
|||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, WaitEvent);
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, YieldOp);
|
||||
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryScalar);
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryHistogram);
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryMerge);
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryText);
|
||||
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, GistBinarizeEncoder);
|
||||
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, GistBinarizeDecoder);
|
||||
#endif
|
||||
|
||||
Status RegisterCpuTrainingKernels(KernelRegistry& kernel_registry) {
|
||||
static const BuildKernelCreateInfoFn function_table[] = {
|
||||
|
||||
#ifdef USE_MPI
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, AdasumAllReduce)>,
|
||||
#endif
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SGDOptimizer)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, AdamOptimizer)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, InPlaceAccumulator)>,
|
||||
|
|
@ -150,22 +149,13 @@ Status RegisterCpuTrainingKernels(KernelRegistry& kernel_registry) {
|
|||
BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, double_float, DropoutGrad)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, double_double, DropoutGrad)>,
|
||||
|
||||
#ifdef ENABLE_TRAINING
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryScalar)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryHistogram)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryMerge)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryText)>,
|
||||
#endif
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, float, LayerNormalizationGrad)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, double, LayerNormalizationGrad)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, float, SimplifiedLayerNormalizationGrad)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, double, SimplifiedLayerNormalizationGrad)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, float, InvertibleLayerNormalizationGrad)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, double, InvertibleLayerNormalizationGrad)>,
|
||||
#ifdef ENABLE_TRAINING
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, GistBinarizeEncoder)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, GistBinarizeDecoder)>,
|
||||
#endif
|
||||
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SliceGrad)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, FastGeluGrad)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, BiasGeluGrad_dX)>,
|
||||
|
|
@ -182,14 +172,29 @@ Status RegisterCpuTrainingKernels(KernelRegistry& kernel_registry) {
|
|||
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, float_float, ReduceAllL2)>,
|
||||
|
||||
// the kernels within the following ifdef are not included in a build with
|
||||
// --enable_training_ops but without --enable_training
|
||||
#ifdef ENABLE_TRAINING
|
||||
#ifdef USE_MPI
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, AdasumAllReduce)>,
|
||||
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, Send)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, Recv)>,
|
||||
#endif
|
||||
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, RecordEvent)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, WaitEvent)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, YieldOp)>};
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, YieldOp)>,
|
||||
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryScalar)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryHistogram)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryMerge)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, SummaryText)>,
|
||||
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, GistBinarizeEncoder)>,
|
||||
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kMSDomain, 1, GistBinarizeDecoder)>,
|
||||
#endif
|
||||
};
|
||||
|
||||
for (auto& function_table_entry : function_table) {
|
||||
ORT_RETURN_IF_ERROR(kernel_registry.Register(function_table_entry()));
|
||||
|
|
|
|||
|
|
@ -59,10 +59,10 @@ jobs:
|
|||
workingDirectory: $(Build.SourcesDirectory)
|
||||
|
||||
- task: CmdLine@2
|
||||
displayName: Build minimal onnxruntime [exceptions DISABLED, type reduction DISABLED]
|
||||
displayName: Build minimal onnxruntime [exceptions DISABLED, type reduction DISABLED, training ops ENABLED]
|
||||
inputs:
|
||||
script: |
|
||||
# We will try to build minimal ORT with exceptions disabled
|
||||
# We will try to build minimal ORT with exceptions disabled and training ops enabled
|
||||
# Only the building process is verified here, no test will be performed
|
||||
docker run --rm \
|
||||
--volume $(Build.SourcesDirectory):/onnxruntime_src \
|
||||
|
|
@ -79,7 +79,8 @@ jobs:
|
|||
--parallel \
|
||||
--skip_tests \
|
||||
--minimal_build \
|
||||
--disable_exceptions
|
||||
--disable_exceptions \
|
||||
--enable_training_ops
|
||||
workingDirectory: $(Build.SourcesDirectory)
|
||||
|
||||
- task: CmdLine@2
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ python3 /onnxruntime_src/tools/ci_build/op_registration_validator.py
|
|||
|
||||
# Run a full build of ORT.
|
||||
# We need the ORT python package to generate the ORT format files and the required ops config files.
|
||||
# We do not run tests since those are covered by other CIs
|
||||
# We do not run tests in this command since those are covered by other CIs.
|
||||
python3 /onnxruntime_src/tools/ci_build/build.py \
|
||||
--build_dir /build --cmake_generator Ninja \
|
||||
--config Debug \
|
||||
|
|
@ -22,8 +22,14 @@ python3 /onnxruntime_src/tools/ci_build/build.py \
|
|||
--parallel \
|
||||
--build_wheel \
|
||||
--skip_tests \
|
||||
--enable_training_ops \
|
||||
--enable_pybind --cmake_extra_defines PYTHON_INCLUDE_DIR=/opt/python/cp37-cp37m/include/python3.7m PYTHON_LIBRARY=/usr/lib64/librt.so
|
||||
|
||||
# Run kernel def hash verification test
|
||||
pushd /build/Debug
|
||||
ORT_TEST_STRICT_KERNEL_DEF_HASH_CHECK=1 ./onnxruntime_test_all --gtest_filter="KernelDefHashTest.ExpectedCpuKernelDefHashes"
|
||||
popd
|
||||
|
||||
# Install the ORT python wheel
|
||||
python3 -m pip install --user /build/Debug/dist/*
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue