Automatic Memory Planning

Description

Automatic memory planning is part of the ptoas compilation process and is intended to reduce the burden of manually specifying local addresses: the compiler allocates local offsets based on the address space, size, alignment, and usage interval of tiles, and reuses storage without changing program semantics.

When using automatic memory planning, you can focus primarily on tile semantics without explicitly specifying all local addresses.

Automatic memory planning is controlled by --enable-plan-memory, which is enabled by default and cannot be disabled in the current version: the compilation process plans addresses for pto.alloc_tile without explicit addresses.

  • --enable-plan-memory Master switch for automatic memory planning. Currently, it must be enabled and cannot be disabled.

  • --plan-memory-order-by-size Disabled by default. It affects only the planning order within the same address space: when disabled, tiles are planned in their declaration order (the order in which pto.alloc_tile appears in the source program); when enabled, ptoas prioritizes planning larger local buffers within the same address space, and then applies the basic memory reuse strategy.

Default Recommendations

If you need to verify program semantics first, you can use the default automatic memory planning method.

Observable Effects

With automatic memory planning, you can typically:

  • Reduce explicit local address configuration.
  • Simplify the input program.
  • Reduce the complexity of address configuration during the example and feature verification phases.

Troubleshooting

If address-related behavior does not meet expectations, you are advised to:

  1. Check the current automatic memory planning parameters.