Add: [2B] declare HBG kernel resource capacity - #2172
Draft
TaoZQY wants to merge 1 commit into
Draft
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
TaoZQY
force-pushed
the
codex/hbg-pr-2b
branch
from
September 9, 2026 09:14
641500c to
6062aaa
Compare
This was referenced Sep 9, 2026
TaoZQY
force-pushed
the
codex/hbg-pr-2b
branch
from
September 9, 2026 11:41
6062aaa to
219f2d3
Compare
This was referenced Sep 9, 2026
TaoZQY
force-pushed
the
codex/hbg-pr-2b
branch
from
September 10, 2026 08:48
219f2d3 to
7523052
Compare
TaoZQY
force-pushed
the
codex/hbg-pr-2b
branch
from
September 11, 2026 12:06
7523052 to
250313e
Compare
TaoZQY
force-pushed
the
codex/hbg-pr-2b
branch
from
September 11, 2026 12:23
250313e to
f182ec8
Compare
Rebase the HBG declaration work on the current K1, shared 2A contract, and revised H1 host-build boundary. Derive graph requirements from H1 measurements without device side effects, reject incompatible runtime layouts, and repack per-region maxima into one aligned context-slot capacity. Keep HBG-specific capacity and stream admission under common/host_build_graph while leaving architecture-only sizing in each runtime maker. Declare the dedicated non-hidden AICPU stream and hidden AICore stream as distinct from the borrowed caller stream. Co-authored-by: sunkaixuan2018 <baiyi@mail.ustc.edu.cn> Co-authored-by: Leaf-Salix <2503954024@qq.com>
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.
The HBG kernel path needs graph-dependent capacity before a context can allocate and freeze its execution slot. This revision rebases 2B on the current K1 lifecycle, the shared 2A contract, and the revised H1 Host-build boundary, then derives resource requirements directly from the completed
GraphBuild.What changed
GraphResourceRequirementsrecords H1's measured GM heap, compact runtime image, Graph Definition block, and the A5 scheduler upper bound. The query performs no device allocation, address binding, or H2D, and leaves its output unchanged on failure.RuntimeLayoutKeymakes compatibility explicit across architecture, layout ABI, task capacity, and copied-arena boundaries. Equal byte totals cannot make incompatible A2/A3, A5, or task-window layouts share a slot.GraphCapacityPlantakes the maximum of each independent region, then rebuilds one aligned runtime-slot layout. It does not treat the largest prepacked total as sufficient and does not represent committed HBM.src/common/host_build_graph/; generic worker validation remains aligned with 2A. Only architecture-specific requirement generation stays in the A2/A3 and A5runtime_maker.cppfiles.bind_kernel_streamsrequires those two streams and the borrowed caller stream to be non-null and pairwise distinct.upload_for_program_mode. Kernel launch must consume a slot allocated and frozen during context prepare; this PR does not add launch-time allocation, blob transport, or restore fallback.The resulting flow is: H1 Host build and validation → read-only requirements snapshot → combine all allowed workload snapshots into one capacity plan → a later context-prepare stage allocates/fixes the slot → each eager/captured invocation restores its own H2 blob into that slot and executes. ACLGraph replay reuses the captured blob and never repeats Host build.
Validation
task-submiton an architecture-verified device.Dependency and review scope
Draft 2B. The PR still targets
mainand contains exactly one cumulative commit so it remains buildable while prerequisites are open. That commit carries the current K1 implementation from #2064, the current shared 2A contract from #2177, the revised H1 from #2171, and this HBG 2B layer. Their human authors are retained as co-authors.Review the 2B-specific files first:
src/common/host_build_graph/kernel_resource_plan.hsrc/common/host_build_graph/kernel_pipeline_contract.hsimpler::hbg::get_graph_resource_requirementsin both HBG runtime makerstests/ut/cpp/common/test_hbg_host_graph_build.cppActual stable-slot ownership, H2 blob serialization/transport, per-replay restore, and launch-time capacity enforcement remain in their later stages; 2B only supplies the complete declaration and admission inputs they must consume.