Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds the ability to disable string types and related operators using the --disable_types string build flag to reduce binary size. The implementation follows the established pattern used for other type-disabling flags (optional, sparsetensor, float4, float8).
Changes:
- Added "string" as a choice for the
--disable_typesbuild argument - Added CMake option
onnxruntime_DISABLE_STRING_TYPEand corresponding compile definitionDISABLE_STRING_TYPE - Wrapped string-specific text operators (StringSplit, StringNormalizer, StringConcat, RegexFullMatch) and TfIdfVectorizer with
#if !defined(DISABLE_STRING_TYPE)guards - Conditionally compiled string-typed kernel declarations and registrations in cpu_execution_provider.cc for operators: Expand, OneHot, Where, Equal, TfIdfVectorizer, StringNormalizer, StringConcat, RegexFullMatch, StringSplit
- Updated CI/CD workflow to include "string" in the list of disabled types for minimal build configurations
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/ci_build/build_args.py | Added "string" to the choices for --disable_types argument |
| tools/ci_build/build.py | Added logic to derive disable_string_type flag and pass it to CMake |
| cmake/CMakeLists.txt | Added onnxruntime_DISABLE_STRING_TYPE option and compile definition |
| onnxruntime/core/providers/cpu/text/string_split.h | Wrapped entire file content with DISABLE_STRING_TYPE guard |
| onnxruntime/core/providers/cpu/text/string_split.cc | Wrapped entire file content with DISABLE_STRING_TYPE guard |
| onnxruntime/core/providers/cpu/text/string_normalizer.h | Wrapped entire file content with DISABLE_STRING_TYPE guard |
| onnxruntime/core/providers/cpu/text/string_normalizer.cc | Wrapped entire file content with DISABLE_STRING_TYPE guard |
| onnxruntime/core/providers/cpu/text/string_concat.h | Wrapped entire file content with DISABLE_STRING_TYPE guard |
| onnxruntime/core/providers/cpu/text/string_concat.cc | Wrapped entire file content with DISABLE_STRING_TYPE guard |
| onnxruntime/core/providers/cpu/text/regex_full_match.h | Wrapped entire file content with DISABLE_STRING_TYPE guard |
| onnxruntime/core/providers/cpu/text/regex_full_match.cc | Wrapped entire file content with DISABLE_STRING_TYPE guard |
| onnxruntime/core/providers/cpu/nn/tfidfvectorizer.h | Wrapped entire file content with DISABLE_STRING_TYPE guard |
| onnxruntime/core/providers/cpu/nn/tfidfvectorizer.cc | Wrapped entire file content with DISABLE_STRING_TYPE guard |
| onnxruntime/core/providers/cpu/cpu_execution_provider.cc | Added conditional compilation guards for string-typed kernel declarations and registrations |
| .github/workflows/linux_minimal_build.yml | Added "string" to all --disable_types flags in minimal build configurations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Allow disabling string types and related operators using
--disable_types string.Motivation and Context
For some use scenarios we want to trim down the binary size so the build flag offers one more option.