Hi @comaniac,

Thank you very much for the clarification.

So the generated output from 
[test_target_codegen_c_host.py](https://github.com/apache/incubator-tvm/blob/master/tests/python/unittest/test_target_codegen_c_host.py)
 using `target="c"` is from LLVM IR.

```
         mhost = tvm.build(s, [A, B, C], "c", name="fadd")
         print(mhost.get_source()) # added line
```
```
$ python `find . -name test_target_codegen_c_host.py`
#include "tvm/runtime/c_runtime_api.h"
#include "tvm/runtime/c_backend_api.h"
void* __tvm_module_ctx = NULL;
#ifdef __cplusplus
extern "C"
#endif
TVM_DLL int32_t fadd(void* args, void* arg_type_ids, int32_t num_args, void* 
out_ret_value, void* out_ret_tcode, void* resource_handle) {
  void* arg0 = (((TVMValue*)args)[0].v_handle);
  int32_t arg0_code = ((int32_t*)arg_type_ids)[(0)];
  void* arg1 = (((TVMValue*)args)[1].v_handle);
  int32_t arg1_code = ((int32_t*)arg_type_ids)[(1)];
  void* arg2 = (((TVMValue*)args)[2].v_handle);
  int32_t arg2_code = ((int32_t*)arg_type_ids)[(2)];
  void* A = (((DLTensor*)arg0)[0].data);
  void* arg0_shape = (((DLTensor*)arg0)[0].shape);
  void* arg0_strides = (((DLTensor*)arg0)[0].strides);
  int32_t dev_id = (((DLTensor*)arg0)[0].ctx.device_id);
  void* B = (((DLTensor*)arg1)[0].data);
  void* arg1_shape = (((DLTensor*)arg1)[0].shape);
  void* arg1_strides = (((DLTensor*)arg1)[0].strides);
  void* C = (((DLTensor*)arg2)[0].data);
  void* arg2_shape = (((DLTensor*)arg2)[0].shape);
  void* arg2_strides = (((DLTensor*)arg2)[0].strides);
  if (!(arg0_strides == NULL)) {
  }
  if (!(arg1_strides == NULL)) {
  }
  if (!(arg2_strides == NULL)) {
  }
  for (int32_t i0 = 0; i0 < 1024; ++i0) {
    ((float*)C)[(i0)] = (((float*)A)[(i0)] + ((float*)B)[(i0)]);
  }
  return 0;
}
```
 
Thank you.





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/how-can-i-generated-c-code-from-codegen-cc/8002/3)
 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/bb015c5f03fb72eb7e3334fd44a781d10bf3ed679be9fffa53a5e29e32332699).

Reply via email to