예제 #1
0
    def tir_packed_call() -> None:
        A = T.var("handle")
        B = T.var("handle")
        C = T.var("handle")

        # body
        tvm_value_2 = T.var("handle")
        tvm_value_1 = T.var("handle")
        tvm_value_0 = T.var("handle")
        with T.let(tvm_value_2, T.tvm_stack_alloca("array", 1,
                                                   dtype="handle")):
            with T.let(tvm_value_1,
                       T.tvm_stack_alloca("array", 1, dtype="handle")):
                with T.let(tvm_value_0,
                           T.tvm_stack_alloca("array", 1, dtype="handle")):
                    T.evaluate(
                        T.tvm_struct_set(tvm_value_0, 0, 1, A, dtype="handle"))
                    T.evaluate(
                        T.tvm_struct_set(tvm_value_1, 0, 1, B, dtype="handle"))
                    T.evaluate(
                        T.tvm_struct_set(tvm_value_2, 0, 1, C, dtype="handle"))
                    T.evaluate(
                        T.tvm_call_cpacked(
                            "tvm_test_cpacked",
                            tvm_value_0,
                            tvm_value_1,
                            tvm_value_2,
                            dtype="int32",
                        ))
예제 #2
0
 def tir_packed_call() -> None:
     A = T.var("handle")
     B = T.var("handle")
     C = T.var("handle")
     # body
     T.evaluate(
         T.tvm_call_cpacked(
             "tvm_test_cpacked",
             A,
             B,
             C,
             dtype="int32",
         ))
    def tir_packed_call() -> None:
        A = T.var("handle")
        B = T.var("handle")
        C = T.var("handle")
        device_context = T.var("handle")

        # body
        T.evaluate(
            T.tvm_call_cpacked(
                "tvm_test_cpacked",
                T.tvm_stack_make_array(
                    A,
                    T.tvm_stack_make_shape(1, dtype="handle"),
                    T.reinterpret(T.uint64(0), dtype="handle"),
                    T.uint32(1),
                    T.cast(0, dtype="float32"),
                    0,
                    dtype="handle",
                ),
                T.tvm_stack_make_array(
                    B,
                    T.tvm_stack_make_shape(1, dtype="handle"),
                    T.reinterpret(T.uint64(0), dtype="handle"),
                    T.uint32(1),
                    T.cast(0, dtype="float32"),
                    0,
                    dtype="handle",
                ),
                T.tvm_stack_make_array(
                    C,
                    T.tvm_stack_make_shape(1, dtype="handle"),
                    T.reinterpret(T.uint64(0), dtype="handle"),
                    T.uint32(1),
                    T.cast(0, dtype="float32"),
                    0,
                    dtype="handle",
                ),
                device_context,
                dtype="int32",
            ))