Skip to content

[Comgr][hotswap] Add raise_failure + RaiseContext + register file#2551

Open
tgymnich wants to merge 1 commit into
users/tgymnich/hotswap-pr-05-2from
users/tgymnich/hotswap-pr-06-wave-projection
Open

[Comgr][hotswap] Add raise_failure + RaiseContext + register file#2551
tgymnich wants to merge 1 commit into
users/tgymnich/hotswap-pr-05-2from
users/tgymnich/hotswap-pr-06-wave-projection

Conversation

@tgymnich
Copy link
Copy Markdown

@tgymnich tgymnich commented May 15, 2026

Foundation infrastructure consumed by every per-format handler:

  • raise_failure.{h,cpp} — RaiseFailure value type with structured
    Reason, Mnemonic, Format, Detail, etc. fields plus typed
    factories (unsupportedOpcode, unsupportedShape, bailReason,
    ...). Carries the diagnostic data the kerneldex coverage runner
    bucketizes on.
  • raise_context.{h,cpp} — RaiseContext is the per-kernel mutable
    state every handler reads and writes: LLVMContext / Module / IR
    builder, decoded inst stream, register file, kernarg layout,
    user-SGPR layout, ISA profile, wave projection, lane-active mask
    cache, the pending failure for read-path errors, etc.
  • reg_file.{h,cpp} — AllocaRegFile models the AMDGPU SGPR/VGPR/AGPR
    register files as an alloca-per-physical-reg promoted to SSA by
    Phase 6 mem2reg. readReg{32,64,Vec} / writeReg{32,64,Vec}
    handle the bitcasts handlers don't want to repeat.
  • kernarg_layout.{h,cpp} — KernargLayout builds the byref placeholder
    type the lifted IR's first parameter takes. Mirrors the source
    kernel's MsgPack-derived offset/size layout.
  • user_sgpr_layout.{h,cpp} — UserSgprLayout::tryFromKernelMeta
    derives the source SGPR ABI (workgroup id / private segment buffer
    / kernarg ptr / kernarg-preload SGPRs) from the kernel descriptor.
  • handlers.h — forward declarations for every handleXXX entry
    point. Concrete handler files come in subsequent commits.

@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-06-wave-projection branch from 93fa2cd to a827d06 Compare May 15, 2026 12:30
@tgymnich tgymnich marked this pull request as ready for review May 15, 2026 12:33
@tgymnich tgymnich requested review from chinmaydd and lamb-j as code owners May 15, 2026 12:33
@tgymnich tgymnich requested review from ftynse and martin-luecke May 15, 2026 12:34
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-05-raise-context branch from a006842 to fbda441 Compare May 15, 2026 13:06
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-06-wave-projection branch from a827d06 to 19af066 Compare May 15, 2026 13:06
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-05-raise-context branch from fbda441 to dcbd299 Compare May 15, 2026 15:28
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-06-wave-projection branch from 19af066 to 0f28b23 Compare May 15, 2026 15:28
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-05-raise-context branch from dcbd299 to a3e1f92 Compare May 15, 2026 16:07
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-06-wave-projection branch from 0f28b23 to 426a1be Compare May 15, 2026 16:07
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-05-raise-context branch from a3e1f92 to b30be20 Compare May 15, 2026 16:18
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-06-wave-projection branch from 426a1be to 268cdab Compare May 15, 2026 16:19
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-05-raise-context branch from b30be20 to d303c65 Compare May 15, 2026 18:55
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-06-wave-projection branch from 268cdab to 9369d97 Compare May 15, 2026 18:55
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-05-raise-context branch from d303c65 to b8a59da Compare May 15, 2026 20:46
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-06-wave-projection branch 2 times, most recently from 3473ede to 3d7dfce Compare May 18, 2026 14:38
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-05-raise-context branch from b8a59da to 716a86f Compare May 18, 2026 14:38
@tgymnich tgymnich changed the title [Comgr][hotswap] Add wave projection + setpc analysis + abi/sync docs [Comgr][hotswap] Add raise_failure + RaiseContext + register file May 18, 2026
Foundation infrastructure consumed by every per-format handler:

  * raise_failure.{h,cpp} — `RaiseFailure` value type with structured
    `Reason`, `Mnemonic`, `Format`, `Detail`, etc. fields plus typed
    factories (`unsupportedOpcode`, `unsupportedShape`, `bailReason`,
    ...). Carries the diagnostic data the kerneldex coverage runner
    bucketizes on.
  * raise_context.{h,cpp} — `RaiseContext` is the per-kernel mutable
    state every handler reads and writes: LLVMContext / Module / IR
    builder, decoded inst stream, register file, kernarg layout,
    user-SGPR layout, ISA profile, wave projection, lane-active mask
    cache, the pending failure for read-path errors, etc.
  * reg_file.{h,cpp} — `AllocaRegFile` models the AMDGPU SGPR/VGPR/AGPR
    register files as an alloca-per-physical-reg promoted to SSA by
    Phase 6 mem2reg. `readReg{32,64,Vec}` / `writeReg{32,64,Vec}`
    handle the bitcasts handlers don't want to repeat.
  * kernarg_layout.{h,cpp} — `KernargLayout` builds the byref placeholder
    type the lifted IR's first parameter takes. Mirrors the source
    kernel's MsgPack-derived offset/size layout.
  * user_sgpr_layout.{h,cpp} — `UserSgprLayout::tryFromKernelMeta`
    derives the source SGPR ABI (workgroup id / private segment buffer
    / kernarg ptr / kernarg-preload SGPRs) from the kernel descriptor.
  * handlers.h — forward declarations for every `handleXXX` entry
    point. Concrete handler files come in subsequent commits.

Co-Authored-By: Tim Gymnich <tim@gymni.ch>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Alex Zinenko <git@ozinenko.com>
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-05-raise-context branch from 716a86f to bb73f44 Compare May 18, 2026 14:48
@tgymnich tgymnich changed the base branch from users/tgymnich/hotswap-pr-05-raise-context to users/tgymnich/hotswap-pr-05-2 May 18, 2026 14:59
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-06-wave-projection branch from 3d7dfce to e404635 Compare May 18, 2026 15:00
@chinmaydd chinmaydd added comgr Related to Code Object Manager hotswap Related to the Comgr Hotswap feature labels May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comgr Related to Code Object Manager hotswap Related to the Comgr Hotswap feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants