Skip to content

Commit b27cdbd

Browse files
committed
allow a build that disable string type
1 parent 735e69a commit b27cdbd

File tree

15 files changed

+95
-8
lines changed

15 files changed

+95
-8
lines changed

.github/workflows/linux_minimal_build.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ jobs:
346346
--build_wheel
347347
--use_binskim_compliant_compile_flags
348348
--disable_ml_ops
349-
--disable_types sparsetensor float4 float8 optional
349+
--disable_types string sparsetensor float4 float8 optional
350350
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
351351
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF
352352
@@ -361,7 +361,7 @@ jobs:
361361
--build_wheel
362362
--use_binskim_compliant_compile_flags
363363
--disable_ml_ops
364-
--disable_types sparsetensor float4 float8 optional
364+
--disable_types string sparsetensor float4 float8 optional
365365
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
366366
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF
367367
@@ -377,7 +377,7 @@ jobs:
377377
--build_wheel
378378
--use_binskim_compliant_compile_flags
379379
--disable_ml_ops
380-
--disable_types sparsetensor float4 float8 optional
380+
--disable_types string sparsetensor float4 float8 optional
381381
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
382382
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF
383383
@@ -430,7 +430,7 @@ jobs:
430430
--disable_ml_ops
431431
--skip_tests
432432
--enable_reduced_operator_type_support
433-
--disable_types sparsetensor optional float4 float8
433+
--disable_types string sparsetensor optional float4 float8
434434
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
435435
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF
436436
@@ -448,7 +448,7 @@ jobs:
448448
--disable_ml_ops
449449
--skip_tests
450450
--enable_reduced_operator_type_support
451-
--disable_types sparsetensor optional float4 float8
451+
--disable_types string sparsetensor optional float4 float8
452452
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
453453
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF
454454
@@ -507,7 +507,7 @@ jobs:
507507
--disable_ml_ops
508508
--skip_tests
509509
--enable_reduced_operator_type_support
510-
--disable_types sparsetensor optional float4 float8
510+
--disable_types string sparsetensor optional float4 float8
511511
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
512512
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF
513513
@@ -525,7 +525,7 @@ jobs:
525525
--disable_ml_ops
526526
--skip_tests
527527
--enable_reduced_operator_type_support
528-
--disable_types sparsetensor optional float4 float8
528+
--disable_types string sparsetensor optional float4 float8
529529
--include_ops_by_config /onnxruntime_src/build/.test_data/include_no_operators.config
530530
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF
531531

cmake/CMakeLists.txt

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

1083+
if (onnxruntime_DISABLE_STRING_TYPE)
1084+
target_compile_definitions(${target_name} PRIVATE DISABLE_STRING_TYPE)
1085+
endif()
1086+
10821087
if (onnxruntime_ENABLE_ATEN)
10831088
target_compile_definitions(${target_name} PRIVATE ENABLE_ATEN)
10841089
endif()

onnxruntime/core/providers/cpu/cpu_execution_provider.cc

Lines changed: 40 additions & 0 deletions
Large diffs are not rendered by default.

onnxruntime/core/providers/cpu/nn/tfidfvectorizer.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4+
#if !defined(DISABLE_STRING_TYPE)
5+
46
#include "tfidfvectorizer.h"
57
#include "core/common/common.h"
68
#include "core/common/inlined_containers.h"
@@ -430,3 +432,5 @@ Status TfIdfVectorizer::Compute(OpKernelContext* ctx) const {
430432
}
431433

432434
} // namespace onnxruntime
435+
436+
#endif // !defined(DISABLE_STRING_TYPE)

onnxruntime/core/providers/cpu/nn/tfidfvectorizer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#pragma once
55

6+
#if !defined(DISABLE_STRING_TYPE)
7+
68
#include "core/common/common.h"
79
#include "core/framework/op_kernel.h"
810
#include <memory>
@@ -27,3 +29,5 @@ class TfIdfVectorizer final : public OpKernel {
2729
};
2830

2931
} // namespace onnxruntime
32+
33+
#endif // !defined(DISABLE_STRING_TYPE)

onnxruntime/core/providers/cpu/text/regex_full_match.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4+
#if !defined(DISABLE_STRING_TYPE)
5+
46
#include "regex_full_match.h"
57
#include "core/common/common.h"
68

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

3537
} // namespace onnxruntime
38+
39+
#endif // !defined(DISABLE_STRING_TYPE)

onnxruntime/core/providers/cpu/text/regex_full_match.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#pragma once
55

6+
#if !defined(DISABLE_STRING_TYPE)
7+
68
#include "core/framework/op_kernel.h"
79
#include "re2/re2.h"
810

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

2022
} // namespace onnxruntime
23+
24+
#endif // !defined(DISABLE_STRING_TYPE)

onnxruntime/core/providers/cpu/text/string_concat.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4+
#if !defined(DISABLE_STRING_TYPE)
5+
46
#include "string_concat.h"
57
#include "core/providers/cpu/math/element_wise_ops.h"
68
#include "core/common/common.h"
@@ -58,3 +60,5 @@ Status StringConcat::Compute(OpKernelContext* context) const {
5860
}
5961

6062
} // namespace onnxruntime
63+
64+
#endif // !defined(DISABLE_STRING_TYPE)

onnxruntime/core/providers/cpu/text/string_concat.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#pragma once
55

6+
#if !defined(DISABLE_STRING_TYPE)
7+
68
#include "core/framework/op_kernel.h"
79

810
namespace onnxruntime {
@@ -15,3 +17,5 @@ class StringConcat final : public OpKernel {
1517
};
1618

1719
} // namespace onnxruntime
20+
21+
#endif // !defined(DISABLE_STRING_TYPE)

onnxruntime/core/providers/cpu/text/string_normalizer.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4+
#if !defined(DISABLE_STRING_TYPE)
5+
46
#include "string_normalizer.h"
57
#include "core/common/common.h"
68
#include "core/framework/tensor.h"
@@ -635,3 +637,5 @@ Status StringNormalizer::Compute(OpKernelContext* ctx) const {
635637
return status;
636638
}
637639
} // namespace onnxruntime
640+
641+
#endif // !defined(DISABLE_STRING_TYPE)

0 commit comments

Comments
 (0)