Skip to content

[Comgr][hotswap] Add AMDGPU MC state setup#2439

Draft
tgymnich wants to merge 1 commit into
users/tgymnich/hotswap-pr-02-code-object-metadatafrom
users/tgymnich/hotswap-pr-03-mc-state
Draft

[Comgr][hotswap] Add AMDGPU MC state setup#2439
tgymnich wants to merge 1 commit into
users/tgymnich/hotswap-pr-02-code-object-metadatafrom
users/tgymnich/hotswap-pr-03-mc-state

Conversation

@tgymnich
Copy link
Copy Markdown

@tgymnich tgymnich commented May 7, 2026

Adds mc_state.{hpp,cpp} providing initMCState — a one-call setup of the LLVM MC stack (Target, Triple, MCInstrInfo, MCRegisterInfo, MCAsmInfo, MCSubtargetInfo, MCContext, MCDisassembler, MCInstPrinter) keyed off an AMDGPU ISA name.

The MC stack is consumed by the disassembler and per-handler raiser code that lands in subsequent commits. Includes the
InlineSrcMgr-on-MCContext defensive init that prevents the SIG6 Either SourceMgr should be available UNREACHABLE abort, with a gtest regression fence.

CMakeLists gains the LLVM build-tree requirement, the AMDGPU target-private include paths (SIDefines.h, AMDGPUBaseInfo.h, the TableGen-generated AMDGPUGen*.inc files), and the LLVM MC + AMDGPU library link surface.

@tgymnich tgymnich requested review from chinmaydd and lamb-j as code owners May 7, 2026 16:28
@tgymnich
Copy link
Copy Markdown
Author

tgymnich commented May 7, 2026

@chinmaydd chinmaydd added comgr Related to Code Object Manager hotswap Related to the Comgr Hotswap feature labels May 7, 2026
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-02-code-object-metadata branch from d1a05c9 to 8be9478 Compare May 8, 2026 10:17
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-03-mc-state branch from e8a1fa9 to 9183737 Compare May 8, 2026 10:18
@tgymnich tgymnich marked this pull request as draft May 8, 2026 21:26
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-02-code-object-metadata branch from 8be9478 to 6ab4011 Compare May 11, 2026 11:41
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-03-mc-state branch from 9183737 to 6122d14 Compare May 11, 2026 11:41
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-02-code-object-metadata branch from 6ab4011 to dd6bb68 Compare May 11, 2026 12:32
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-03-mc-state branch from 6122d14 to e1822d4 Compare May 11, 2026 12:32
@tgymnich tgymnich marked this pull request as ready for review May 11, 2026 12:40
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-02-code-object-metadata branch from dd6bb68 to 94e24d0 Compare May 11, 2026 12:42
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-03-mc-state branch from e1822d4 to b9c85a5 Compare May 11, 2026 12:42
@tgymnich tgymnich marked this pull request as draft May 11, 2026 15:19
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-02-code-object-metadata branch 3 times, most recently from 2b8bfde to 70e5099 Compare May 11, 2026 20:21
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-03-mc-state branch from b9c85a5 to dade881 Compare May 11, 2026 20:22
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-02-code-object-metadata branch from 70e5099 to 73d63ce Compare May 11, 2026 20:48
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-03-mc-state branch from dade881 to c1170b2 Compare May 11, 2026 20:48
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-02-code-object-metadata branch from 73d63ce to 4314144 Compare May 11, 2026 21:26
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-03-mc-state branch from c1170b2 to e5d271e Compare May 11, 2026 21:26
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-02-code-object-metadata branch from 4314144 to 7fde156 Compare May 11, 2026 21:58
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-03-mc-state branch from e5d271e to d7718e4 Compare May 11, 2026 21:58
`CanonicalOp` is the architecture-neutral instruction identity the raiser
dispatches on. Each value names a logical operation; many MC opcode
variants (different encodings, target generations) collapse onto a
single `CanonicalOp` via the opcode-canonicalisation table that lands in
the next commit.

This commit ships only the `Unknown` terminal — the dispatch surface is
empty until the per-format handler patches add the values they consume.
That keeps the enum scoped to what the in-tree raiser actually
recognises and avoids front-loading a dictionary of opcodes for handlers
that have not landed yet.

`amdgpu_formats.h` re-exposes the AMDGPU target-private `SIInstrFlags`
and operand-type enums under a stable header name so the rest of the
raiser does not depend on AMDGPU build-tree paths directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-02-code-object-metadata branch from 7fde156 to 2c6f5a2 Compare May 11, 2026 22:34
@tgymnich tgymnich force-pushed the users/tgymnich/hotswap-pr-03-mc-state branch from d7718e4 to d1342e6 Compare May 11, 2026 22:34
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.

3 participants