Skip to content

Print mps

print_mps

print_to_mps(prog: ModuleOp, output: IO[str]) -> None

Lower an MLIR module to the proprietary Air Intermediate Representation (AIR).

This function emits the AIR bitcode required to target Apple GPUs directly, bypassing the Metal Shading Language source generation step.

Parameters:

Name Type Description Default
prog ModuleOp

The MLIR ModuleOp to be lowered.

required
output IO[str]

The IO stream (e.g., stdout or a file) to write the generated bitcode to.

required

Returns:

Type Description
None

None. The output is written directly to the provided stream.

Source code in xdsl/backend/mps/print_mps.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
def print_to_mps(prog: ModuleOp, output: IO[str]) -> None:
    """
    Lower an MLIR module to the proprietary Air Intermediate Representation (AIR).

    This function emits the AIR bitcode required to target Apple GPUs directly,
    bypassing the Metal Shading Language source generation step.

    Args:
        prog: The MLIR ModuleOp to be lowered.
        output: The IO stream (e.g., stdout or a file) to write the generated bitcode to.

    Returns:
        None. The output is written directly to the provided stream.
    """
    raise NotImplementedError("MPS backend not yet implemented")