Thanks for the comments
[quote="comaniac, post:3, topic:7933"]
For Q2, CodegenDNNL does not have to worry about the C host as it only
processes subgraphs.
[/quote]
I looked further into the code and this is what I came up with:
The CodeGenC (which is the base class for the CodeGenCHost) also deals with
subgraphs.
The main difference (AFAIK) between both types of subgraphs is that for DNNL
they are in Relay, while the other are in TIR. This is because they have gone
the Relay -> Topi -> TE -> TIR process, which is the standard lowering process.
BYOC is an alternative way to that. Therefore a BYOC C generator should not be
derived from CodeGenC since it's not in TIR format (it's routines for visiting
nodes expect TIR nodes).
[quote="comaniac, post:3, topic:7933"]
For Q3, CsourceModuleCreate takes 4 arguments while the last two are optional.
[/quote]
Yeah I was aware that the last two were optional, but I was wondering why the
CodeGenCHost doesnt set the other variables. I have a hypothesis, but unsure
how correct it is since it only concerns the third argument `symbol`:
When generating C code with the CodeGenCHost, the process collects all
operators beforehand and then bundles them up in one call to CodeGenCHost. This
means that the `runtime::Module` can have the `''`symbol since it is assumed
that there will not be a second module with that name. In BYOC, and therefore
in the DNNL example, each subgraph is sent to CodegenDNNL separately.
Generating `n` `runtime:Module`s. If all are given the same symbol, the
compiler will throw an error about name collision.
What my previous insight does not respond is:
* Why, in the CodeGenCHost example, is `symbol=''`? How does the runtime know
that the module where all routines are found is called `''` and not any other
string?
* In the BYOC example it is given the Relay composite function name which
was partitioned from the original Relay program. Which makes sense because the
Relay program calls that function and therefore having the same symbol makes it
a simple mapping.
* Based on that logic I would expect it to have the default name `'main'`
---
[Visit
Topic](https://discuss.tvm.apache.org/t/codegenchost-and-codegencbase-and-relation-to-internal-and-external-compilers/7933/4)
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/c22b2f8f1542f408fc5656db6a3ee1b76dfe971c6a1216c269b992b2e127463f).