ml_switcheroo.compiler.backends.rdna¶

RDNA Backend Package.

Contains the backend implementation for synthesizing AMD RDNA assembly from the Logical Graph representation.

Submodules¶

Classes¶

RdnaSynthesizer

Bidirectional transpiler component for RDNA ISA.

RdnaBackend

Compiler Backend implementation for AMD RDNA.

RdnaEmitter

Converts RDNA AST nodes into textual assembly code.

Package Contents¶

class ml_switcheroo.compiler.backends.rdna.RdnaSynthesizer(semantics: ml_switcheroo.semantics.manager.SemanticsManager)[source]¶

Bidirectional transpiler component for RDNA ISA.

semantics¶
allocator¶
macro_registry: Dict[str, Callable]¶
from_graph(graph: ml_switcheroo.compiler.ir.LogicalGraph) → List[ml_switcheroo.compiler.frontends.rdna.nodes.RdnaNode][source]¶

Converts a LogicalGraph into a list of RDNA AST nodes.

to_python(rdna_nodes: List[ml_switcheroo.compiler.frontends.rdna.nodes.RdnaNode]) → libcst.Module[source]¶

Converts RDNA AST nodes into a Python source structure representation.

class ml_switcheroo.compiler.backends.rdna.RdnaBackend(semantics: ml_switcheroo.semantics.manager.SemanticsManager | None = None)[source]¶

Bases: ml_switcheroo.compiler.backend.CompilerBackend

Compiler Backend implementation for AMD RDNA. Orchestrates the synthesis (Graph -> AST) and emission (AST -> Text).

synthesizer¶
emitter¶
target_arch = 'gfx1030'¶
compile(graph: ml_switcheroo.compiler.ir.LogicalGraph) → str[source]¶

Compiles LogicalGraph to RDNA Assembly string.

Parameters:

graph – The intermediate representation.

Returns:

The RDNA code.

Return type:

str

class ml_switcheroo.compiler.backends.rdna.RdnaEmitter[source]¶

Converts RDNA AST nodes into textual assembly code.

emit(nodes: List[ml_switcheroo.compiler.frontends.rdna.nodes.RdnaNode]) → str[source]¶

Generates the RDNA source string from a list of nodes.