Add: unit tests for PTO2 scheduler core data structures and hot-paths#643
Open
chenshengxin2026 wants to merge 1 commit intohw-native-sys:mainfrom
Open
Add: unit tests for PTO2 scheduler core data structures and hot-paths#643chenshengxin2026 wants to merge 1 commit intohw-native-sys:mainfrom
chenshengxin2026 wants to merge 1 commit intohw-native-sys:mainfrom
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
2 tasks
96750e9 to
c5a1c8f
Compare
5c8138d to
bda9279
Compare
bda9279 to
bde9a7b
Compare
The PTO2 A2A3 scheduler relies on several tightly coupled data structures (task allocator, dep-list pool, fanin pool, SPSC queue, tensor map) and hot-path functions (wire_task, on_mixed_task_complete, on_task_release, advance_ring_pointers) that previously had no unit test coverage. Bugs in these paths — off-by-one in wrap-around, stale fanin references, lost dependency edges — surface only under specific task-graph topologies and are extremely hard to diagnose at the system-test level. This change adds per-component tests that exercise: - task_allocator: heap bump, wrap-around guard, flow-control window - task_state: slot lifecycle through src API, profiling CAS semantics - dep_list_pool / fanin_pool: ring allocation, overflow, tail advance - spsc_queue: cached-index SPSC correctness, wrap, capacity semantics - tensormap: hash distribution, overlap detection, lookup saturation - wiring: end-to-end wire → complete → release → advance cycle These tests also serve as executable documentation of design contracts (e.g. heap_available reports max-not-sum, LIFO dispatch for cache locality, relaxed size() as a hint) that would otherwise exist only as implicit assumptions in the source.
bde9a7b to
db248fd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The core data structures (task allocator, dep-list pool, fanin pool, SPSC queue, tensor map) and scheduling hot-paths (wire_task, on_mixed_task_complete, on_task_release, advance_ring_pointers) in the PTO2 A2A3 scheduler previously had no unit test coverage. Bugs in these paths — off-by-one in wrap-around, stale fanin references, lost dependency edges — only surface under specific task-graph topologies and are extremely hard to diagnose at the system-test level.
This PR adds per-component unit tests:
These tests also serve as executable documentation of design contracts (e.g. heap_available reports max-not-sum, LIFO dispatch for cache locality, relaxed size() as a hint only).
Test plan
cmake -B tests/ut/cpp/build -S tests/ut/cpp && cmake --build tests/ut/cpp/build -j$(nproc)ctest --test-dir tests/ut/cpp/build -L no_hardware --output-on-failure