目录

Runtime Platform Abstraction Layer (PAL)

The ExecuTorch Platform Abstraction Layer (PAL) provides a way for execution environments to override operations like:

  • Getting the current time.

  • Printing a log statement.

  • Panicking the process/system.

The PAL function declarations are in executorch/runtime/platform/platform.h.

Overriding the default PAL

The default PAL implementation is in executorch/runtime/platform/target/Posix.cpp. It uses std::chrono::steady_clock for the time, prints log messages to stderr, and makes other default assumptions.

But, if they don’t work for your system, you can override the default PAL by:

No build system changes necessary. The default PAL functions are weak symbols, so providing your own strong-symbol definition will override them at link time.

Minimal PAL

If you run into build problems because your system doesn’t support the functions called by Posix.cpp, you can instead use the no-op minimal PAL at executorch/runtime/platform/target/Minimal.cpp by building with the buck2 flag -c executorch.pal_default=minimal. This will avoid calling fprintf(), std::chrono::steady_clock, and anything else that Posix.cpp uses. But since the Minimal.cpp et_pal_*() functions are no-ops, you will need to override all of them.

文档

访问 PyTorch 的全面开发人员文档

查看文档

教程

获取面向初学者和高级开发人员的深入教程

查看教程

资源

查找开发资源并解答您的问题

查看资源