AiterAsmKernel: add init-time sanity checks for .co registration#3127
Open
alexioslyrakis-amd wants to merge 1 commit intomainfrom
Open
AiterAsmKernel: add init-time sanity checks for .co registration#3127alexioslyrakis-amd wants to merge 1 commit intomainfrom
alexioslyrakis-amd wants to merge 1 commit intomainfrom
Conversation
Two checks added to AiterAsmKernelFast::init(), both running once per kernel variant at construction time (not on the launch hot path): 1. validate_hsaco_lds(): scans the raw .co ELF blob for group_segment_fixed_size via msgpack decode and compares against the device LDS limit (hipDeviceGetAttribute). Gives an actionable error before __hipRegisterFatBinary is called, e.g. on gfx942 (MI300X) the 64 KB limit would reject a .co built for gfx950 (MI355X, ~160 KB). 2. Registration probe: __hipRegisterFunction returns void, so a hipGetFuncBySymbol probe is used to detect silent rejection by the runtime (LDS limit exceeded, arch mismatch, corrupted binary, etc.).
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
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
validate_hsaco_lds()toAiterAsmKernelFast::init(): scans the raw.coELF blob forgroup_segment_fixed_sizevia msgpack decode and checks it against the device LDS limit (hipDeviceGetAttribute). Fires before registration, giving an actionable error instead of a silent null fromhipGetFuncBySymbol.init(): since__hipRegisterFunctionreturnsvoid, ahipGetFuncBySymbolprobe detects silent rejection by the runtime (LDS limit exceeded, arch mismatch, corrupted binary, etc.).launch_kernel()hot path.Motivation
On gfx942 (MI300X) the LDS limit is 64 KB. A
.cobuilt targeting gfx950 (MI355X, ~160 KB LDS) would be silently rejected at registration,hipGetFuncBySymbolwould return null, andhipModuleLaunchKernelwould emit only a generichipErrorIllegalStatewith no indication of the root cause.Test plan
.codeclaringgroup_segment_fixed_size > 65536on gfx942 — expect clear error fromvalidate_hsaco_lds()at init.coon gfx942 — expect no error, kernel executes normally