Hello all,

while trying to study the DNNL external compiler I came about the differences 
between how the external (DNNL) and the internal (target='c') C codes are being 
generated:
* In the codegen which is triggered with `tvm.build(...,target='c')`, the 
process eventually [creates a 
`CodeGenCHost`](https://github.com/apache/incubator-tvm/blob/d9450f8c9d8338aadf2632bad3aedb0b9416a8ae/src/target/source/codegen_c_host.cc#L305)
 object. The code stream of this object is then forwarded to the 
[CSourceModuleCreate function but only gives it 2 
arguments](https://github.com/apache/incubator-tvm/blob/d9450f8c9d8338aadf2632bad3aedb0b9416a8ae/src/target/source/codegen_c_host.cc#L322)
* In the dnnl external compiler example, the [CodegenDNNL is derived from 
CodegenCBase](https://github.com/apache/incubator-tvm/blob/d8c9bb18907ed57916d94325f47f1c3dcfd34784/src/relay/backend/contrib/dnnl/codegen.cc#L138)
 and then [CSourceModuleCreate constructor is fetched from the registry and 
gives it 4 arguments to 
it](https://github.com/apache/incubator-tvm/blob/d8c9bb18907ed57916d94325f47f1c3dcfd34784/src/relay/backend/contrib/dnnl/codegen.cc#L415)

Q1: Why does it seem to be two different "base" C codegen classes?
* 
[CodeCenC](https://github.com/apache/incubator-tvm/blob/d8c9bb18907ed57916d94325f47f1c3dcfd34784/src/target/source/codegen_c.h#L58)
* 
[CodegenCBase](https://github.com/apache/incubator-tvm/blob/d8c9bb18907ed57916d94325f47f1c3dcfd34784/src/relay/backend/contrib/codegen_c/codegen_c.h#L67)

Q2: In general I have the question of what exactly does the CodegenCHost imply, 
that the CodegenDNLL could not simply derive from it? So in other words, when 
is it wrong to derive an external  compiler from the CodegenCHost?
* Notices that some of the includes in the CodegenDNLL are actually also 
included in the CodegenCHost

Q3: Why is the CsourceModuleCreate in the CodeGenCHost only given 2 arguments?

Thanks





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/codegenchost-and-codegencbase-and-relation-to-internal-and-external-compilers/7933/1)
 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/7609bda6f20ca5cb0a321efbf58bd199c8bb06c7ec1d07827e0e02b7fc5c3dd8).

Reply via email to