You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by Johnson Lu via Apache TVM Discuss <no...@discuss.tvm.ai> on 2021/03/10 08:51:45 UTC

[Apache TVM Discuss] [Questions] Can we generate assembly code that tensor dimensions are not fixed?


Thanks for your suggestion, but I want to generate assembly code directly, then call it in C code, with original one, I can call assembly code by the function call like this: void assembly(int *C,int*A,int *B), and result are correct. 

I try to use te.ver() for the output geometry, like this. 

    M_var = tvm.te.var(name='M_var')

    N_var = tvm.te.var(name='N_var')

    K_var = tvm.te.var(name='K_var')

    # Construct the TVM computation.

    A = tvm.te.placeholder((M_var,K_var), name='A', dtype=tvm_dtype)

    B = tvm.te.placeholder((N_var,K_var), name='B', dtype=tvm_dtype)

    k = tvm.te.reduce_axis((0,K_var), name='k')

    C = tvm.te.compute((N_var, M_var),
        lambda i, j: tvm.te.sum(A[j][k].astype(tvm_output_dtype) * B[i][k].astype(tvm_output_dtype), axis=k),
        name='C')

    s = tvm.te.create_schedule(C.op)
  
    func = tvm.build(s, [A, B, C], \
                    target = target, \
                    target_host = target_host, \
                    name='matmul')

     func.imported_modules[0].save('tvm_matmul.s', 's')
  


And generate assembly code after build function, but I am not sure how to call such assembly code in my C code, how to pass M, N, K value?





---
[Visit Topic](https://discuss.tvm.apache.org/t/can-we-generate-assembly-code-that-tensor-dimensions-are-not-fixed/9001/5) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/adab67348f0023a33a21a0b4bbe9b215526fab572f4064869af78c7f9abf386b).