Auto Sync Options
Description
The Auto Sync option reduces the burden of manually inserting synchronization operations.
It mainly affects how synchronization-related behaviors are handled in the compilation output.
Related Parameters
ptoas provides two Auto Sync options, both disabled by default:
| Option | Default Value | Description | Prerequisite |
|---|---|---|---|
--enable-insert-sync | Disabled | Enables regular Auto Sync insertion. | None |
--enable-inject-barrier-all-sync | Disabled | Inserts pto.barrier PIPE_ALL before memory-effecting pipe operations to satisfy synchronization in a more conservative manner. | None |
Two Options Are Mutually Exclusive
Only one of the two options can be enabled at a time. If both are specified, ptoas reports an error and terminates early during compilation, rather than falling back to either synchronization strategy.
Default Recommendation
When both options are disabled, ptoas does not perform any auto sync insertion, and the sync relationships are entirely expressed explicitly by the program. If you want to quickly run through common scenarios first, it is recommended to try the following first:
--enable-insert-syncWhen to Adjust
Adjust the auto sync options in the following scenarios:
- You do not want to manually write synchronization at the beginning.
- You suspect that the issue is related to insufficient synchronization.
- You need to troubleshoot in a more conservative way.
Observable Effects
After switching the sync mode, users typically observe the following:
- Sync-related errors behave differently.
- Some programs pass in one mode but behave differently in another.
- A more conservative mode is better suited for confirming whether an issue is related to sync.
Common Usage
ptoas input.pto --enable-insert-sync -o output.cppptoas input.pto --enable-inject-barrier-all-sync -o output.cppTroubleshooting
If you suspect that the issue is related to synchronization, it is recommended that you:
- First try regular auto sync.
- If the issue persists, switch to the more conservative mode.
- Then check again whether the producer-consumer relationships in the program are clearly expressed.