Skip to content

[Sync] Correct inter-core sync lowering semantics for A3/A5#258

Open
TaoTao-real wants to merge 1 commit intozhangstevenunity:mainfrom
TaoTao-real:codex/intercore-sync-ir-support
Open

[Sync] Correct inter-core sync lowering semantics for A3/A5#258
TaoTao-real wants to merge 1 commit intozhangstevenunity:mainfrom
TaoTao-real:codex/intercore-sync-ir-support

Conversation

@TaoTao-real
Copy link
Contributor

@TaoTao-real TaoTao-real commented Mar 13, 2026

Summary

This PR only contains inter-core sync support changes:

  • Keep IR shape unchanged: pto.sync.set/pto.sync.wait
  • Align lowering semantics with ISA differences:
    • A3
      • sync.set -> ffts_cross_core_sync(pipe, getFFTSMsg(FFTS_MODE_VAL, event_id))
      • sync.wait -> wait_flag_dev(event_id)
    • A5
      • sync.set -> set_intra_block(pipe, event_id)
      • sync.wait -> wait_intra_block(pipe, event_id)
  • Add shared lowering utility for inter-core sync call selection/argument assembly in PTOToEmitC
  • Add pto.set_ffts EmitC lowering to set_ffts_base_addr(...)
  • Add A3 compile-time hard check: using inter-core sync ops without pto.set_ffts in the same function now fails
  • Add Python helper wrappers: sync_set, sync_wait, set_ffts
  • Add Python regression samples:
    • test_intercore_sync_a3.py
    • test_intercore_sync_a5.py
    • test_intercore_sync_a3_missing_setffts.py
  • Extend runop.sh with arch-aware routing + structural assertions for the new samples

Scope guard

Diff vs main contains only 6 files:

  • lib/PTO/Transforms/PTOToEmitC.cpp
  • python/pto/dialects/pto.py
  • test/samples/runop.sh
  • test/samples/Sync/test_intercore_sync_a3.py
  • test/samples/Sync/test_intercore_sync_a5.py
  • test/samples/Sync/test_intercore_sync_a3_missing_setffts.py

Validation

Local validation passed:

  • ninja -C build ptoas install
  • bash test/samples/runop.sh -t Sync (A3 default)
  • PTOAS_FLAGS='--pto-arch=a5 --enable-insert-sync' bash test/samples/runop.sh -t Sync

Both A3/A5 new regression assertions are hit as expected, and the A3 missing-set_ffts case is XFAIL with the expected diagnostic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant