@areusch and I had long discussion yesterday offline, and he helped me 
understand the concern from the UX perspective: If we fold executor into 
target, then it's more difficult to separate the config coming from two 
parties, where one party impl the codegen and the other impl the executor.

On the other hand, my concern is the fragmentation of APIs. It has been a huge 
problem in the recent 1-2 years, and we do have alternatives not to do so.

Here is my proposal:

- Part 1. Add Exector/Runtime fields to TargetNode:

```
class TargetNode {
  ...
  Executor executor;
  Runtime runtime;
};

class Executor {
  FromJSON();
  AsJSON();
};

class Runtime {
  FromJSON();
  AsJSON();
};
```

- Part 2. Add a helper API to merge Target, Executor and Runtime

```
Target MergeTarget(Target target_without_executor_runtime, Executor executor, 
Runtime runtime);
```

- Part 3. Allow separate specification of target, target_host, executor, 
runtime in TVMC, and internally use the proposed API in Part 2 to merge, 
validate and normalize them into a single Target object

```
tvmc --target "llvm" --executor "..." --runtime "..."
```

- Part 4. For heterogeneous case, annotate the target onto each 
PrimFunc/RelayFunc to specify the target/runtime/executor

```
@tvm.script.ir_module
class Module:

   @T.func
   def tir_func():
     T.func_attrs({"target": JSON-Repr-of-Target-Obj}) # with runtime&executor 
included
     ...

   @R.func
   def relay_func():
     T.func_attrs({"target": JSON-Repr-of-Target-Obj}) # with runtime&executor 
included
     ...

```





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/pre-rfc-compilation-configuration-representation/11372/32)
 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/69ecb26051e749ac91f3e6e2299eb2cb080b9e9e2996b8d2ea4ede093cdeb737).

Reply via email to