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
CodeGenCHostobject. The code stream of this object is then forwarded to the CSourceModuleCreate function but only gives it 2 arguments
- In the dnnl external compiler example, the CodegenDNNL is derived from CodegenCBase and then CSourceModuleCreate constructor is fetched from the registry and gives it 4 arguments to it
Q1: Why does it seem to be two different “base” C codegen classes?
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?