pytorch / pytorch/executorch

Option to build without the standard library

Open
#4,561 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module: build/install module: runtime triaged
Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

🚀 The feature, motivation and pitch

ExecuTorch is intended for use in edge devices, even embedded systems. In these use cases it is required to reduce the size of the executable, and ExecuTorch are proud of the core library to be only few dozes of Kb. I think it will be very useful to be able compile without the standard CPP library.

The library already give a great flexibility for custom allocators, and I don't think there is some critical code that must have std.
From my attempt of compiling the lib without std I saw some use of std errors, clocks (which maybe I can override by providing another implementation for the platform/ headers), allocations in MemoryAllocator (maybe we can solve it with a cmake flag), and exceptions (rarely used, saw in some backends loading code).

I wrote Rust bindings for the library, and one of the features I would like to offer is exactly that, to compile without the std lib. In Rust you just add #![no_std] to the crate, in CPP you should do -nostdlib.

Alternatives

No response

Additional context

No response

RFC (Optional)

No response

cc @JacobSzwejbka @dbort @GregoryComer

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by auditing the standard-library uses identified in the issue, including the platform/ headers, MemoryAllocator, CMake configuration, clocks, and exceptions in backend loading code. Map which components must change to support a no-standard-library build, then define a build and test path that verifies the core library compiles without the C++ standard library.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, rust
Domain
build-system, embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.