brintos

brintos / llvm-project-archived public Read only

0
0
Text · 711 B · 26d84fd Raw
26 lines · python
1# RUN: %python %s pybind11 | FileCheck %s2# RUN: %python %s nanobind | FileCheck %s3 4import sys5from mlir_standalone.ir import *6 7if sys.argv[1] == "pybind11":8    from mlir_standalone.dialects import standalone_pybind11 as standalone_d9elif sys.argv[1] == "nanobind":10    from mlir_standalone.dialects import standalone_nanobind as standalone_d11else:12    raise ValueError("Expected either pybind11 or nanobind as arguments")13 14 15with Context():16    standalone_d.register_dialects()17    module = Module.parse(18        """19    %0 = arith.constant 2 : i3220    %1 = standalone.foo %0 : i3221    """22    )23    # CHECK: %[[C:.*]] = arith.constant 2 : i3224    # CHECK: standalone.foo %[[C]] : i3225    print(str(module))26