Skip to content

Use ExternalProject_Add to build tokenizers #11550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

larryliu0820
Copy link
Contributor

@larryliu0820 larryliu0820 commented Jun 11, 2025

This way it avoids the CMake target name collision between XNNPACK's memory and Abseil's memory

This pull request updates the build configuration for the extension_llm_runner target in CMakeLists.txt and modifies the tokenizers submodule reference. The changes aim to improve dependency management by transitioning from a subdirectory approach to using ExternalProject_Add, and updating the tokenizers submodule to a new commit.

Build Configuration Updates:

  • extension/llm/runner/CMakeLists.txt: Replaced add_subdirectory for the tokenizers dependency with ExternalProject_Add, enabling more flexible configuration options such as setting regex lookahead support and specifying an installation directory. Updated dependency handling by adding tokenizers_external_project as a dependency and using find_package to locate tokenizers. Adjusted target_include_directories to use TOKENIZERS_INCLUDE_DIRS and the new installation path.

Submodule Update:

This way it avoids the CMake target name collision between XNNPACK's
`memory` and Abseil's `memory`
Copy link

pytorch-bot bot commented Jun 11, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/11550

Note: Links to docs will display an error until the docs builds have been completed.

❌ 14 New Failures

As of commit e92ac85 with merge base 09a4b9d (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 11, 2025
@larryliu0820 larryliu0820 added the release notes: none Do not include this in the release notes label Jun 11, 2025
add_subdirectory(
${EXECUTORCH_ROOT}/extension/llm/tokenizers
${CMAKE_CURRENT_BINARY_DIR}/../../../extension/llm/tokenizers
ExternalProject_Add(
Copy link
Contributor

Choose a reason for hiding this comment

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

So, if i understand correctly, ExternalProject_Add creates a separate build process and as a result cmake variables aren't shared.

If you're cross-compiling, don't you wanna propagate toolchain settings and compiler flags?

I think FetchContent propagates compiler flags and toolchain setting. Looks like FetchContent_Declare and FetchContent_MakeAvailable will do the job, and it happens during config time, not build time.

Also, fwiw, looks like XNNPACK is fixing this issue (google/XNNPACK#8488) with this PR (google/XNNPACK#8552)

Copy link
Contributor

Choose a reason for hiding this comment

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

alt text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. release notes: none Do not include this in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants