Target Architecture Options

Description

The target architecture options specify the target platform for the current PTO program.

Different targets may differ in supported types, layout combinations, operation constraints, and generated results. Therefore, specify the target architecture explicitly during compilation.

  • --pto-arch=a3|a5

The default value of this option is a3. If it is not explicitly specified, ptoas compiles with a3.

The target architecture is specified by the --pto-arch command-line option of ptoas. You do not need to declare the target device information again through module attributes in the module of the PTO program.

Default Recommendations

If a program explicitly targets a specific architecture, it is recommended to always specify --pto-arch explicitly to avoid inconsistent results caused by changes to the default value.

When to Adjust

You are advised to pay attention to this parameter in the following scenarios:

  • The same .pto file needs to be verified for different targets.
  • An operation or type combination is available on one target but unavailable on another.
  • You need to compare compilation results under different targets.

Observable Effects

After switching the target architecture, users may observe the following:

  • Some programs pass on one target but report errors on another.
  • The accepted range of certain layouts or type combinations differs.
  • The generated results contain target-dependent differences.

Common Usage

ptoas input.pto --pto-arch=a3 -o output.cpp
ptoas input.pto --pto-arch=a5 -o output.cpp

Troubleshooting

If the same input behaves inconsistently on different targets, troubleshoot in the following order:

  1. Confirm whether --pto-arch is set correctly.
  2. Check whether the program uses target-related types, layouts, or operation combinations.
  3. Compare the compilation results and error messages under the two targets.