Skip to content

trtexec fails at the end if --saveEngine path is invalid or unwritable #4448

Open

Description

@PierreMarieCurie

Description

When running trtexec with the --saveEngine flag pointing to an invalid or unwritable path, the tool proceeds to parse the ONNX model and build the engine. However, it only fails at the very end when attempting to serialize the engine, wasting time and resources.

This issue is created to introduce the following pull request: #4449

Environment

This issue should occur regardless of the system configuration.

Steps To Reproduce

trtexec --onnx=model.onnx --saveEngine=/invalid_path/engine.trt

Activity

  1. changed the title [-]XXX failure of TensorRT X.Y when running XXX on GPU XXX[/-] [+] [WIP] XXX failure of TensorRT X.Y when running XXX on GPU XXX[/+] on May 18, 2025
  2. added a commit that references this issue on May 19, 2025
  3. changed the title [-] [WIP] XXX failure of TensorRT X.Y when running XXX on GPU XXX[/-] [+]```trtexec``` fails at the end if --saveEngine path is invalid or unwritable[/+] on May 19, 2025
  4. changed the title [-]```trtexec``` fails at the end if --saveEngine path is invalid or unwritable[/-] [+]```trtexec``` fails at the end if ```--saveEngine``` path is invalid or unwritable[/+] on May 19, 2025
  5. added
    Module:SamplesIssues when using TensorRT samples under the samples/ directory, including usage with trtexec
    triagedIssue has been triaged by maintainers
    on May 19, 2025
  6. added 2 commits that reference this issue on Jul 3, 2025
  7. added a commit that references this issue on Dec 17, 2025
  8. added a commit that references this issue on Dec 26, 2025
  9. AditiThirdEye commented on Dec 28, 2025

    @AditiThirdEye

    I've also submitted an implementation for this: #4675

    My approach validates the --saveEngine path immediately after parsing by checking parent directory existence and testing write permissions via a temporary file. Happy to defer to #4449 if maintainers prefer that implementation, or collaborate on merging the best aspects of both.

  10. PierreMarieCurie commented on Jan 1, 2026

    @PierreMarieCurie
    Author

    Hello @AditiThirdEye ,
    From what I can see, both implementations are functionally identical. Please let me know if I’m missing something.

  11. AditiThirdEye commented on Jan 3, 2026

    @AditiThirdEye

    Hi @PierreMarieCurie, thanks for taking a look!

    You're right - I reviewed both implementations and they are essentially the same approach (checking parent directory existence + testing write permissions via temp file).

    Since your PR #4449 was submitted first, I'm happy to close mine and defer to yours. No need to duplicate effort!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature RequestRequest for new functionalityModule:SamplesIssues when using TensorRT samples under the samples/ directory, including usage with trtexectriagedIssue has been triaged by maintainers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions