Repository navigation
fix(executorch): accept only portable names for external_engine_data - #4917
Closed
shoumikhin wants to merge 1 commit into
Closed
shoumikhin wants to merge 1 commit into
shoumikhin wants to merge 1 commit into
Conversation
The .ptd name check refused directories, drive prefixes and a trailing .ptd, but let through names that cannot become a file: Windows device names such as NUL or CON, characters Windows does not allow (? * | < > and the double quote), control characters, and names too long for a file system. save() then failed only when it wrote the .ptd, after the .pte was already on disk, and a device name might not fail at all. Its comment also gave a reason for refusing "." and ".." that does not apply, and one message covered every rule, so "engines:v2" was told it had a directory or a drive. Now the name must use only ASCII letters, digits, ".", "-" and "_", start with a letter, a digit or "_", and fit the 255 byte file name limit once .ptd is added. It may not end with .ptd or be a Windows device name. Each kind of problem gets its own message. This also refuses some names that worked on Linux before, such as ones with a space, a "+" or a non-ASCII letter, so a program saved on one system does not fail to save or load on another.
shoumikhin
force-pushed
the
executorch-ptd-name-check
branch
from
October 22, 2026 19:10
12ea849 to
a24a66f
Compare
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.
What is wrong today
external_engine_data=names the.ptdfile that holds the TensorRT engines. Its check refuses directories, drive prefixes and a trailing.ptd, but it accepts names that cannot become a normal file:NUL,CON,COM1orLPT1, in any case. On Windows these open a device, not a file, so the engines may be lost with no error.? * | < >and the double quote, plus control characters.save()only fails when it writes the.ptd. By then the.pteis already on disk, and it cannot load without its engines.Also, one error message covers every rule, so
engines:v2is told it has "a directory, a drive or the .ptd extension". And the code comment gives a reason for refusing.and..that does not apply.What this change does
The name must now:
.,-and_,_,<name>.ptdfits the usual 255 byte limit,.ptd, which ExecuTorch adds,Each kind of problem gets its own error message. The check still runs before anything is compiled or written, in
export(),save(), the partitioner and the backend, so a bad name fails at once.Names like
model,my-model_v2.1andaoti_cuda_blob(to share the CUDA backend's file) still work. Some names that worked on Linux before are now refused, such as ones with a space, a+or a non-ASCII letter. That is on purpose: a short portable name keeps a saved program usable on every system.What was tested
On Linux x86-64 with the pinned ExecuTorch nightly:
test_external_engine_data.py,test_backend.pyandtest_partitioner.py: 101 passed.