support extern func define in aicore#6
Merged
ChaoWao merged 1 commit intohw-native-sys:mainfrom Jan 28, 2026
Merged
Conversation
94b7082 to
1a93f69
Compare
1a93f69 to
d352caa
Compare
This was referenced Apr 14, 2026
ChaoWao
added a commit
to ChaoWao/simpler-fork
that referenced
this pull request
Apr 15, 2026
Removes the fixed DIST_TASK_WINDOW_SIZE slot pool and the per-slot array
DistWorker used to carry. At L3 the slot state lives entirely in the
parent process's heap -- never crossed into child workers -- so the ring
index L2 uses to address shmem descriptors buys us nothing here. Only
the heap needs a pre-sized region for MAP_SHARED fork inheritance.
- DistRing:
- init() drops window_size; takes only (heap_bytes, timeout_ms).
- alloc() returns a monotonic task id; no back-pressure on slot count,
only on heap space.
- Owns the slot state pool as std::deque<std::unique_ptr<SlotState>>.
push_back never invalidates existing pointers, so slot_state(id)
returns a pointer that stays valid for the slot's lifetime without
holding the mutex past the lookup.
- released_ and slot_heap_end_ become std::vector<>, grown via
push_back on alloc, indexed directly by task id.
- advance_last_alive_locked no longer needs to undo the released bit
(entries aren't recycled within a run; reset_to_empty clears them
all at drain).
- New reset_to_empty(): drops all slot state and zeroes counters.
DistOrchestrator::drain() calls it right after active_tasks_ hits 0
so each Worker.run() starts from task id 0 with bounded memory.
- DistOrchestrator::init drops slots/num_slots params. slot_state(id)
delegates to ring.slot_state(id) with a nullptr->throw guard.
- DistScheduler::Config drops slots/num_slots; takes DistRing* and reads
slot state via ring->slot_state(id) at every access site.
- DistWorker drops the std::unique_ptr<SlotState[]> member; slot state
is now entirely in allocator_. DistWorker::init() is a straight
passthrough to allocator_/orchestrator_/scheduler_.
- dist_types.h: remove DIST_TASK_WINDOW_SIZE constant.
Tests:
- test_dist_ring rewritten: drop window_size tests, add
SlotAllocGrowsPastLegacyWindow (2048 allocs past the old 128 cap),
SlotStateIsPointerStable (push_back doesn't invalidate refs),
ResetToEmptyRequiresAllReleased, ResetToEmptyResetsCounters.
- test_dist_orchestrator / test_dist_scheduler fixtures drop the
std::unique_ptr<SlotState[]> member and access via a local S(id)
helper that calls ring.slot_state(id).
Docs:
- orchestrator.md section 5 rewritten to describe the three resources
DistRing now owns (task id, heap, slot state) and the end-of-run
reset contract.
- roadmap.md Dispatch internals bullet updated.
Plan (local, gitignored): PR-I moved to "in review"; Allowed Exception
hw-native-sys#6 kept (explains why L3 doesn't need a shmem slot ring).
No user-visible behaviour change: heap_ring_size still configurable via
Worker ctor, OUTPUT auto-alloc / WaW tag semantics unchanged, back-
pressure timeout still throws std::runtime_error on heap exhaustion.
3 tasks
ChaoWao
added a commit
that referenced
this pull request
Apr 15, 2026
Removes the fixed DIST_TASK_WINDOW_SIZE slot pool and the per-slot array
DistWorker used to carry. At L3 the slot state lives entirely in the
parent process's heap -- never crossed into child workers -- so the ring
index L2 uses to address shmem descriptors buys us nothing here. Only
the heap needs a pre-sized region for MAP_SHARED fork inheritance.
- DistRing:
- init() drops window_size; takes only (heap_bytes, timeout_ms).
- alloc() returns a monotonic task id; no back-pressure on slot count,
only on heap space.
- Owns the slot state pool as std::deque<std::unique_ptr<SlotState>>.
push_back never invalidates existing pointers, so slot_state(id)
returns a pointer that stays valid for the slot's lifetime without
holding the mutex past the lookup.
- released_ and slot_heap_end_ become std::vector<>, grown via
push_back on alloc, indexed directly by task id.
- advance_last_alive_locked no longer needs to undo the released bit
(entries aren't recycled within a run; reset_to_empty clears them
all at drain).
- New reset_to_empty(): drops all slot state and zeroes counters.
DistOrchestrator::drain() calls it right after active_tasks_ hits 0
so each Worker.run() starts from task id 0 with bounded memory.
- DistOrchestrator::init drops slots/num_slots params. slot_state(id)
delegates to ring.slot_state(id) with a nullptr->throw guard.
- DistScheduler::Config drops slots/num_slots; takes DistRing* and reads
slot state via ring->slot_state(id) at every access site.
- DistWorker drops the std::unique_ptr<SlotState[]> member; slot state
is now entirely in allocator_. DistWorker::init() is a straight
passthrough to allocator_/orchestrator_/scheduler_.
- dist_types.h: remove DIST_TASK_WINDOW_SIZE constant.
Tests:
- test_dist_ring rewritten: drop window_size tests, add
SlotAllocGrowsPastLegacyWindow (2048 allocs past the old 128 cap),
SlotStateIsPointerStable (push_back doesn't invalidate refs),
ResetToEmptyRequiresAllReleased, ResetToEmptyResetsCounters.
- test_dist_orchestrator / test_dist_scheduler fixtures drop the
std::unique_ptr<SlotState[]> member and access via a local S(id)
helper that calls ring.slot_state(id).
Docs:
- orchestrator.md section 5 rewritten to describe the three resources
DistRing now owns (task id, heap, slot state) and the end-of-run
reset contract.
- roadmap.md Dispatch internals bullet updated.
Plan (local, gitignored): PR-I moved to "in review"; Allowed Exception
#6 kept (explains why L3 doesn't need a shmem slot ring).
No user-visible behaviour change: heap_ring_size still configurable via
Worker ctor, OUTPUT auto-alloc / WaW tag semantics unchanged, back-
pressure timeout still throws std::runtime_error on heap exhaustion.
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.
No description provided.