Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/linux_minimal_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ jobs:
--build_wheel
--use_binskim_compliant_compile_flags
--disable_ml_ops
--disable_types sparsetensor float4 float8 optional
--disable_types string sparsetensor float4 float8 optional
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF

Expand All @@ -361,7 +361,7 @@ jobs:
--build_wheel
--use_binskim_compliant_compile_flags
--disable_ml_ops
--disable_types sparsetensor float4 float8 optional
--disable_types string sparsetensor float4 float8 optional
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF

Expand All @@ -377,7 +377,7 @@ jobs:
--build_wheel
--use_binskim_compliant_compile_flags
--disable_ml_ops
--disable_types sparsetensor float4 float8 optional
--disable_types string sparsetensor float4 float8 optional
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF

Expand Down Expand Up @@ -430,7 +430,7 @@ jobs:
--disable_ml_ops
--skip_tests
--enable_reduced_operator_type_support
--disable_types sparsetensor optional float4 float8
--disable_types string sparsetensor optional float4 float8
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF

Expand All @@ -448,7 +448,7 @@ jobs:
--disable_ml_ops
--skip_tests
--enable_reduced_operator_type_support
--disable_types sparsetensor optional float4 float8
--disable_types string sparsetensor optional float4 float8
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF

Expand Down Expand Up @@ -507,7 +507,7 @@ jobs:
--disable_ml_ops
--skip_tests
--enable_reduced_operator_type_support
--disable_types sparsetensor optional float4 float8
--disable_types string sparsetensor optional float4 float8
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF

Expand All @@ -525,7 +525,7 @@ jobs:
--disable_ml_ops
--skip_tests
--enable_reduced_operator_type_support
--disable_types sparsetensor optional float4 float8
--disable_types string sparsetensor optional float4 float8
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF

Expand Down
5 changes: 5 additions & 0 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ option(onnxruntime_DISABLE_SPARSE_TENSORS "Disable sparse tensors data types" OF
option(onnxruntime_DISABLE_OPTIONAL_TYPE "Disable optional type" OFF)
option(onnxruntime_DISABLE_FLOAT8_TYPES "Disable float 8 types" OFF)
option(onnxruntime_DISABLE_FLOAT4_TYPES "Disable float 4 types" OFF)
option(onnxruntime_DISABLE_STRING_TYPE "Disable string type" OFF)
option(onnxruntime_MINIMAL_BUILD "Exclude as much as possible from the build. Support ORT format models. No support for ONNX format models." OFF)
option(onnxruntime_CLIENT_PACKAGE_BUILD "Enables default settings that are more appropriate for client/on-device workloads." OFF)
cmake_dependent_option(onnxruntime_DISABLE_RTTI "Disable RTTI" ON "NOT onnxruntime_ENABLE_PYTHON;NOT onnxruntime_USE_CUDA" OFF)
Expand Down Expand Up @@ -1079,6 +1080,10 @@ function(onnxruntime_set_compile_flags target_name)
target_compile_definitions(${target_name} PRIVATE DISABLE_FLOAT4_TYPES)
endif()

if (onnxruntime_DISABLE_STRING_TYPE)
target_compile_definitions(${target_name} PRIVATE DISABLE_STRING_TYPE)
endif()

if (onnxruntime_ENABLE_ATEN)
target_compile_definitions(${target_name} PRIVATE ENABLE_ATEN)
endif()
Expand Down
40 changes: 40 additions & 0 deletions onnxruntime/core/providers/cpu/cpu_execution_provider.cc

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions onnxruntime/core/providers/cpu/nn/tfidfvectorizer.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#if !defined(DISABLE_STRING_TYPE)

#include "tfidfvectorizer.h"
#include "core/common/common.h"
#include "core/common/inlined_containers.h"
Expand Down Expand Up @@ -430,3 +432,5 @@ Status TfIdfVectorizer::Compute(OpKernelContext* ctx) const {
}

} // namespace onnxruntime

#endif // !defined(DISABLE_STRING_TYPE)
4 changes: 4 additions & 0 deletions onnxruntime/core/providers/cpu/nn/tfidfvectorizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#pragma once

#if !defined(DISABLE_STRING_TYPE)

#include "core/common/common.h"
#include "core/framework/op_kernel.h"
#include <memory>
Expand All @@ -27,3 +29,5 @@ class TfIdfVectorizer final : public OpKernel {
};

} // namespace onnxruntime

#endif // !defined(DISABLE_STRING_TYPE)
4 changes: 4 additions & 0 deletions onnxruntime/core/providers/cpu/text/regex_full_match.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#if !defined(DISABLE_STRING_TYPE)

#include "regex_full_match.h"
#include "core/common/common.h"

Expand Down Expand Up @@ -33,3 +35,5 @@ Status RegexFullMatch::Compute(OpKernelContext* context) const {
}

} // namespace onnxruntime

#endif // !defined(DISABLE_STRING_TYPE)
4 changes: 4 additions & 0 deletions onnxruntime/core/providers/cpu/text/regex_full_match.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#pragma once

#if !defined(DISABLE_STRING_TYPE)

#include "core/framework/op_kernel.h"
#include "re2/re2.h"

Expand All @@ -18,3 +20,5 @@ class RegexFullMatch final : public OpKernel {
};

} // namespace onnxruntime

#endif // !defined(DISABLE_STRING_TYPE)
4 changes: 4 additions & 0 deletions onnxruntime/core/providers/cpu/text/string_concat.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#if !defined(DISABLE_STRING_TYPE)

#include "string_concat.h"
#include "core/providers/cpu/math/element_wise_ops.h"
#include "core/common/common.h"
Expand Down Expand Up @@ -58,3 +60,5 @@ Status StringConcat::Compute(OpKernelContext* context) const {
}

} // namespace onnxruntime

#endif // !defined(DISABLE_STRING_TYPE)
4 changes: 4 additions & 0 deletions onnxruntime/core/providers/cpu/text/string_concat.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#pragma once

#if !defined(DISABLE_STRING_TYPE)

#include "core/framework/op_kernel.h"

namespace onnxruntime {
Expand All @@ -15,3 +17,5 @@ class StringConcat final : public OpKernel {
};

} // namespace onnxruntime

#endif // !defined(DISABLE_STRING_TYPE)
4 changes: 4 additions & 0 deletions onnxruntime/core/providers/cpu/text/string_normalizer.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#if !defined(DISABLE_STRING_TYPE)

#include "string_normalizer.h"
#include "core/common/common.h"
#include "core/framework/tensor.h"
Expand Down Expand Up @@ -635,3 +637,5 @@ Status StringNormalizer::Compute(OpKernelContext* ctx) const {
return status;
}
} // namespace onnxruntime

#endif // !defined(DISABLE_STRING_TYPE)
4 changes: 4 additions & 0 deletions onnxruntime/core/providers/cpu/text/string_normalizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#pragma once

#if !defined(DISABLE_STRING_TYPE)

#include "core/common/inlined_containers.h"
#include "core/framework/op_kernel.h"

Expand Down Expand Up @@ -37,3 +39,5 @@ class StringNormalizer : public OpKernel {
};

} // namespace onnxruntime

#endif // !defined(DISABLE_STRING_TYPE)
4 changes: 4 additions & 0 deletions onnxruntime/core/providers/cpu/text/string_split.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#if !defined(DISABLE_STRING_TYPE)

#include "string_split.h"
#include <algorithm>
#include <limits>
Expand Down Expand Up @@ -96,3 +98,5 @@ Status StringSplit::Compute(OpKernelContext* context) const {
}

} // namespace onnxruntime

#endif // !defined(DISABLE_STRING_TYPE)
4 changes: 4 additions & 0 deletions onnxruntime/core/providers/cpu/text/string_split.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#pragma once

#if !defined(DISABLE_STRING_TYPE)

#include "core/framework/op_kernel.h"

namespace onnxruntime {
Expand All @@ -18,3 +20,5 @@ class StringSplit final : public OpKernel {
};

} // namespace onnxruntime

#endif // !defined(DISABLE_STRING_TYPE)
2 changes: 2 additions & 0 deletions tools/ci_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ def generate_build_tree(
disable_float4_types = args.android or ("float4" in types_to_disable)
disable_optional_type = "optional" in types_to_disable
disable_sparse_tensors = "sparsetensor" in types_to_disable
disable_string_type = "string" in types_to_disable
if is_windows():
cmake_args += [
"-Donnxruntime_USE_DML=" + ("ON" if args.use_dml else "OFF"),
Expand Down Expand Up @@ -513,6 +514,7 @@ def generate_build_tree(
"-Donnxruntime_DISABLE_FLOAT4_TYPES=" + ("ON" if disable_float4_types else "OFF"),
"-Donnxruntime_DISABLE_SPARSE_TENSORS=" + ("ON" if disable_sparse_tensors else "OFF"),
"-Donnxruntime_DISABLE_OPTIONAL_TYPE=" + ("ON" if disable_optional_type else "OFF"),
"-Donnxruntime_DISABLE_STRING_TYPE=" + ("ON" if disable_string_type else "OFF"),
"-Donnxruntime_CUDA_MINIMAL=" + ("ON" if args.enable_cuda_minimal_build else "OFF"),
]
if args.minimal_build is not None:
Expand Down
2 changes: 1 addition & 1 deletion tools/ci_build/build_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def add_size_reduction_args(parser: argparse.ArgumentParser) -> None:
"--disable_types",
nargs="+",
default=[],
choices=["float4", "float8", "optional", "sparsetensor"],
choices=["float4", "float8", "optional", "sparsetensor", "string"],
help="Disable selected data types.",
)
parser.add_argument(
Expand Down
Loading