Skip to content

allow a build that disable string type#27348

Open
fs-eire wants to merge 2 commits intomainfrom
fs-eire/allow-disable-string-type
Open

allow a build that disable string type#27348
fs-eire wants to merge 2 commits intomainfrom
fs-eire/allow-disable-string-type

Conversation

@fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Feb 14, 2026

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.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can commit the suggested changes from lintrunner.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_types build argument
  • Added CMake option onnxruntime_DISABLE_STRING_TYPE and corresponding compile definition DISABLE_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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant