# Can TVM split work into different layers, and assign layers into different cores?

**URL:** <https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161>\
**Category:** Uncategorized\
**Created:** [September 28, 2021, 9:16pm UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161 "2021-09-28T21:16:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![popojames](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@popojames](https://discuss.tvm.apache.org/u/popojames)\
**Post date:** [September 28, 2021, 9:16pm UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/1 "2021-09-28T21:16:22Z")

</div>

Hello community,

I am using Hikey 970 with 4 big and 4 little CPU to do inference now. (I am only using CPU to do inference only). My question is can TVM split work into different layers, and assign layers into different cores to do inference?

For instance, for 4 layers neural network, assigning the first 2 layers into 3 Big cores, the third layer into another big core, and the last layer into 4 small). I am wondering if TVM supports such layer-level splitting settings as shown below? [![image](https://discuss.tvm.apache.org/uploads/default/original/2X/8/899f68dae37757730fd87803375848568d244897.png)](https://user-images.githubusercontent.com/70759685/130843032-a5623ff7-4f14-42b9-91d5-06dee18c18a2.png)

I think I might need to modify with this file: [tvm/src/runtime/threading\_backend.cc](https://github.com/apache/tvm/blob/main/src/runtime/threading_backend.cc#L200) and I have gone through posts like [Number of threads used during auto-tunning](https://discuss.tvm.apache.org/t/number-of-threads-used-during-auto-tunning/570/2), but can anyone provide more details?

Any advice or related post are welcomed! Thanks community in advance 🙂

---

<div class="post-metadata">

**Author:** ![masahi](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/masahi/32/74_2.png) [@masahi](https://discuss.tvm.apache.org/u/masahi)\
**Post date:** [September 29, 2021, 2:48am UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/2 "2021-09-29T02:48:49Z")

</div>

There is an on-going work to bring pipeline parallelism to TVM. That seems closest to what you described. See [https://github.com/apache/tvm-rfcs/pull/14](https://github.com/apache/tvm-rfcs/pull/14)

cc @hjiang @comaniac

---

<div class="post-metadata">

**Author:** ![popojames](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@popojames](https://discuss.tvm.apache.org/u/popojames)\
**Post date:** [September 29, 2021, 3:01am UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/3 "2021-09-29T03:01:48Z")

</div>

> [@masahi](#):
>
> [[RFC] Pipeline Executor by huajsj · Pull Request #14 · apache/tvm-rfcs · GitHub](https://github.com/apache/tvm-rfcs/pull/14)

@masahi Awesome! I will definitely take a look at that. Thanks for your reply.

---

<div class="post-metadata">

**Author:** ![popojames](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@popojames](https://discuss.tvm.apache.org/u/popojames)\
**Post date:** [October 1, 2021, 12:03pm UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/4 "2021-10-01T12:03:52Z")

</div>

Hello @masahi@hjiang.

I have tried to build TVM with [hjiang’s TVM main repo](https://github.com/huajsj/tvm). I found and followed [this page: [WIP][Runtime]Pipeline Executor For Compute graph pipeline #7892](https://github.com/apache/tvm/pull/7892/files?authenticity_token=DjlYG0mRnfZgkFYORR2wLPQs%2BN7gQETeV5UPNDvghcQ62YigAKY41Tc%2Fs8piIt5djQxP2Q25QjrNBCLeRTFwcg%3D%3D&file-filters%5B%5D=) to understand how “pipeline” works. I was able to pass the test\_pipeline\_executor.py in the current apache tvm version (file: tvm/tests/python/relay/test\_pipeline\_executor.py)

 ![image](https://discuss.tvm.apache.org/uploads/default/original/2X/b/bdb764f16c2e8870a717b5ba3ee1eb19b81051af.png)

However, since it is still working in progress, may I kindly ask is there any example code to reproduce [the example of the pipeline work](https://discuss.tvm.apache.org/t/rfc-compute-graph-pipeline-with-new-subgraph-executor/9839) as follow?

 ![image](https://discuss.tvm.apache.org/uploads/default/original/2X/8/8d90f6fafedd1afb328613377b82720ddb361952.jpeg)

Thanks for your reading and kindly in advance. 🙂

---

<div class="post-metadata">

**Author:** ![areusch](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/areusch/32/2118_2.png) [@areusch](https://discuss.tvm.apache.org/u/areusch)\
**Post date:** [October 1, 2021, 6:55pm UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/5 "2021-10-01T18:55:02Z")

</div>

@popojames we are also working on modeling multi-core systems in the core compiler and pushing this into the AOT executor (see “TargetDevice” RFC forthcoming sometime soon) by leveraging the Device API (and are implementing in parallel a [C Device API](https://discuss.tvm.apache.org/t/pre-rfc-c-device-api/10874) to ensure this approach functions across both bare metal and linux systems).

---

<div class="post-metadata">

**Author:** ![hjiang](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/hjiang/32/1632_2.png) [@hjiang](https://discuss.tvm.apache.org/u/hjiang)\
**Post date:** [October 2, 2021, 1:45am UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/6 "2021-10-02T01:45:57Z")

</div>

@popojames, #7892 is a legacy PR, currently we use a serial of small PR to upstreaming our work like #8702, #9108, we recommend you wait until all upstream done, because the API of pipeline executor may change and we may can not maintain #7892 for bug fix, but at same time if you like to try , #7892 is also a work patch, you can follow the logic in test\_pipeline\_executor.py to try network split and pipeline.

---

<div class="post-metadata">

**Author:** ![popojames](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@popojames](https://discuss.tvm.apache.org/u/popojames)\
**Post date:** [October 15, 2021, 1:31pm UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/7 "2021-10-15T13:31:51Z")

</div>

Hello, @hjiang Thanks for open-sourcing your file “test\_pipeline\_executor.py”, it really helpful for me.

Now I am able to split the network into subgraphs. In my case, I split the entire BERT into 3 subgraphs, and trying to assign 3 subgraphs into different CPU clusters. (For instance: subgraph 0 using 2 big cores, subgraph 1 using 2 big cores, subgraph 2 using 4 small cores.)

However, I still have some questions.

1. In your compute effect example, you assign subgraph 1 to a specific CPU (e.g. A53 CPU 0-2). Can you explain how do you set the thread affinity and only use 2 of 4 cores?

 ![image](https://discuss.tvm.apache.org/uploads/default/original/2X/0/0bf7553c9fc33e7b3d7527d94e391fc4c47faefa.jpeg)

1. When I calling target\_list = tvm.testing.enabled\_targets()

> <https://github.com/huajsj/tvm/blob/47c5cc24dc01248b0c1b7ea76cb3ff2806445888/tests/python/relay/test_pipeline_executor.py#L336>

It will show out the following errors:

> Check failed: (err\_code == CL\_SUCCESS) is false: OpenCL Error, code=-6: CL\_OUT\_OF\_HOST\_MEMORY

 ![image](https://discuss.tvm.apache.org/uploads/default/original/2X/a/a68735aca423730584922b1508cf67357ae5a9cd.png)

I am guessing is it possible to get rid of this line and set my target\_list as [2 big cores, 2 big cores, 4 small cores], which will corresponding [CPU 4-5, CPU 6-7, CPU 0-3] in Hikey 970 board?

Thanks again for your inspiration and explanation! It helps a lot!

cc @masahi@comaniac

---

<div class="post-metadata">

**Author:** ![hjiang](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/hjiang/32/1632_2.png) [@hjiang](https://discuss.tvm.apache.org/u/hjiang)\
**Post date:** [October 18, 2021, 10:58pm UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/8 "2021-10-18T22:58:35Z")

</div>

@popojames , we have a separate patch to support control flow and data flow cpu affinity setting, #7982 not included this part logic, please stay tune, we would submit related patch soon.

---

<div class="post-metadata">

**Author:** ![popojames](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@popojames](https://discuss.tvm.apache.org/u/popojames)\
**Post date:** [October 19, 2021, 7:37pm UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/9 "2021-10-19T19:37:30Z")

</div>

Hello @hjiang

Thanks very much for your update. I will keep following up on your update. May I ask some questions regarding pipeline executer?

1. Can I check if the aforementioned example (subgraph 0 using 2 big cores, subgraph 1 using 2 big cores, subgraph 2 using 4 small cores.) can be implemented by using the future patch?

2. Do you have a roadmap of when will it be available?

=================================================================

[update: Oct 19, 16:45 pm EST After re-building [GitHub - huajsj/tvm: Open deep learning compiler stack for cpu, gpu and specialized accelerators](https://github.com/huajsj/tvm) instead of main TVM, I was able to run it!]

1. I tried to apply your recent commit. May I ask are you able to run **test\_pipeline\_executor.py** correctly without any error? I run this file but it shows TVMError: do not support key mod\_indx. ![image](https://discuss.tvm.apache.org/uploads/default/original/2X/a/a334b945d2ff212f8b1a728248c846430f6d0dcb.png)

More info about what I did:

A. I updated the “tvm/python/tvm/contrib/pipeline\_executor.py” which contains build\_pipeline and create functions, and its PipelineModule class has “run” function to do benchmarking.

B. Modify the cc and h file.

Should I re-build TVM from scratch to run the benchmark? Or is there any way I can apply this change without rebuilding it?

=================================================================

Thanks for your help in advance.

---

<div class="post-metadata">

**Author:** ![hjiang](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/hjiang/32/1632_2.png) [@hjiang](https://discuss.tvm.apache.org/u/hjiang)\
**Post date:** [October 20, 2021, 6:14pm UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/10 "2021-10-20T18:14:42Z")

</div>

@popojames

> 1. Can I check if the aforementioned example (subgraph 0 using 2 big cores, subgraph 1 using 2 big cores, subgraph 2 using 4 small cores.) can be implemented by using the future patch?

##### Yes, TVM can support this example after all of our pipeline executor patches are merged into upstream, we have similar use case like your example and that already supported by our internal build.

> 1. Do you have a roadmap of when will it be available?

##### Current plan is to submit all pipeline executor patches include the affinity patch by mid of Nov.

> 1. I tried to apply your recent commit. May I ask are you able to run **test\_pipeline\_executor.py** correctly without any error? I run this file but it shows TVMError: do not support key mod\_indx.

##### like your update mentioned, rebuild can fix this issue.

---

<div class="post-metadata">

**Author:** ![max1996](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@max1996](https://discuss.tvm.apache.org/u/max1996)\
**Post date:** [November 1, 2021, 8:31am UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/11 "2021-11-01T08:31:00Z")

</div>

hi, I am also very interested in your work and have a couple of questions:

Do you support heterogeneous executions using CPUs and GPUs in combination? Are necessary layout transformations added automatically?

How will the mapping of layers and subgraphs to targets take place? Will it be done manually by the user?

---

<div class="post-metadata">

**Author:** ![popojames](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@popojames](https://discuss.tvm.apache.org/u/popojames)\
**Post date:** [November 2, 2021, 4:21am UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/12 "2021-11-02T04:21:50Z")

</div>

> [@max1996](#):
>
> hi, I am also very interested in your work and have a couple of questions:
> 
> Do you support heterogeneous executions using CPUs and GPUs in combination? Are necessary layout transformations added automatically?
> 
> How will the mapping of layers and subgraphs to targets take place? Will it be done manually by the user?

Now I am only focusing on using CPU, and I did manually setting such CPU affinity for now.

---

<div class="post-metadata">

**Author:** ![Xuyuanjia2014](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/xuyuanjia2014/32/3413_2.png) [@Xuyuanjia2014](https://discuss.tvm.apache.org/u/Xuyuanjia2014)\
**Post date:** [December 13, 2021, 9:36am UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/13 "2021-12-13T09:36:39Z")

</div>

Hi, I see your example picture that each subgraph may use heterogeneous resources (FPGA+ A53 CPU 3), and I have two questions:

1. Does that mean CPU or GPU or FPGA runs the same subgraph with different input tensors (input pictures), is this called horizontal partition?

2. CPU to GPU(FGPA) may have very different speedup ratios, how to deal with this imbalance? Are this partition common used in SoC/edge-cloud collaboration scenario?

---

<div class="post-metadata">

**Author:** ![hjiang](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/hjiang/32/1632_2.png) [@hjiang](https://discuss.tvm.apache.org/u/hjiang)\
**Post date:** [December 13, 2021, 6:51pm UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/14 "2021-12-13T18:51:55Z")

</div>

@Xuyuanjia2014

> 1. Does that mean CPU or GPU or FPGA runs the same subgraph with different input tensors (input pictures), is this called horizontal partition?

Different heterogenous cores run different subgraph, the first subgraph use the input tensor as data, following subgraphs use the output tensor of previous subgraph as input data.

graph splitting reduced the network deep, call that as horizontal partition is make sense.

> 1. CPU to GPU(FGPA) may have very different speedup ratios, how to deal with this imbalance and automatically generate best practice subgraph splitting? Are this partition common used in SoC/edge-cloud collaboration scenario?

we have an automatically splitting module(in developing) which will generate a list of loading balance subgraph.

about the use case, this solution can be used at SOC edge device as well as edge-cloud collaboration scenario.

---

<div class="post-metadata">

**Author:** ![Xuyuanjia2014](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/xuyuanjia2014/32/3413_2.png) [@Xuyuanjia2014](https://discuss.tvm.apache.org/u/Xuyuanjia2014)\
**Post date:** [December 14, 2021, 7:16am UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/15 "2021-12-14T07:16:49Z")

</div>

Ths. That helps a lot.

---

<div class="post-metadata">

**Author:** ![popojames](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@popojames](https://discuss.tvm.apache.org/u/popojames)\
**Post date:** [December 17, 2021, 2:41am UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/16 "2021-12-17T02:41:58Z")

</div>

Hello @hjiang

I have made some modifications based on your code and added CPU affinity setting into my function, but it seems to have some problems. I am looking for your advice.

According to the following previous posts,

1. [Use all cores in a big.LITTLE architecture - #5 by FrozenGene](https://discuss.tvm.apache.org/t/use-all-cores-in-a-big-little-architecture/8474/5)

> [@Use all cores in a big.LITTLE architecture](https://discuss.tvm.apache.org/t/use-all-cores-in-a-big-little-architecture/8474/5):
>
> ```auto
> config_threadpool = remote.get_function('runtime.config_threadpool')
> # affinity_mode: kBig = 1, kLittle = -1. kDefault = 0. pass 1 or -1 to control the cores
> config_threadpool(affinity_mode, num_threads)
> 
> ```

1. [Setting the CPU affinity and number of cores locally without RPC Remote - #4 by popojames](https://discuss.tvm.apache.org/t/setting-the-cpu-affinity-and-number-of-cores-locally-without-rpc-remote/11306/4)

> [@Setting the CPU affinity and number of cores locally without RPC Remote](https://discuss.tvm.apache.org/t/setting-the-cpu-affinity-and-number-of-cores-locally-without-rpc-remote/11306/4):
>
> This problem is fixed by myslef. I was able to set it locally without RPC Remote. [image] What I did is very similar with the aforementioned setting: hooks c++ into python In my python/runtime/module.py, I add “conf\_set” function inside, [image] to set the configuration, I can direct use this command just like we did in remote.get\_function config\_threadpool = module.module.config\_set(remote.get\_function('runtime.config\_threadpool')

Now I am using **config\_threadpool of each subgraph** to enable the CPU setting. In another word

1. Splitting the network into N subgraphs (Using your pipeline\_graph function)
2. Then I add config\_threadpool for each subgraphs
3. Then I assign CPU affinity to each subgraphs by config\_threadpool\_numofsubgraph(affinity\_mode, num\_threads)

For example, If I split into two sub-graphs wanna set first graph → 4 small cores and second graph -\>4 big cores, I will use config\_threadpool\_0(-1, 4) and config\_threadpool\_1(1, 4) But it seems like those setting are not behave as I expect.

I am wondering how did you implement CPU affinity setting? Is it possible to share your code regarding how you set the cpu affinity even if it’s not fully ready to merge into main TVM?

---

<div class="post-metadata">

**Author:** ![hjiang](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/hjiang/32/1632_2.png) [@hjiang](https://discuss.tvm.apache.org/u/hjiang)\
**Post date:** [December 20, 2021, 1:13am UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/17 "2021-12-20T01:13:41Z")

</div>

@popojames , please wait couple days, I plan to submit the affinity PR soon.

---

<div class="post-metadata">

**Author:** ![hjiang](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/hjiang/32/1632_2.png) [@hjiang](https://discuss.tvm.apache.org/u/hjiang)\
**Post date:** [December 24, 2021, 1:32am UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/18 "2021-12-24T01:32:09Z")

</div>

@popojames , the cpu affinity PR already submit [https://github.com/apache/tvm/pull/9802](https://github.com/apache/tvm/pull/9802), please reference the example in “threading\_backend\_test.cc” for the cpu affinity setting logic.

---

<div class="post-metadata">

**Author:** ![popojames](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@popojames](https://discuss.tvm.apache.org/u/popojames)\
**Post date:** [December 30, 2021, 10:19pm UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/19 "2021-12-30T22:19:14Z")

</div>

Hello @hjiang,

Thanks very much for sharing your implementation.

First of all, I wanna double-check if I wanna re-build a new TVM environment, should I go with this GitHub branch: [GitHub - huajsj/tvm at threadaffinity](https://github.com/huajsj/tvm/tree/threadaffinity)?

* * *

Regarding your reply: as you explained in [[Runtime][ThreadPool]Refactor affinity function and support CPU affinity list setting. by huajsj · Pull Request #9802 · apache/tvm · GitHub](https://github.com/apache/tvm/pull/9802), you introduced “kSpecify” and “tvm::runtime::threading ::Configure” to specify the CPU list for the CPU affinity. For this, I have some general questions.

1. In this setting, I wanna double-check if I wanna use the “kSpecify” mode, is it similar to the original setting as shown below (i.e, calling config\_threadpool) but with CPU affinity mode = -2 and adding parameters “cpus” and “exclude\_worker0”?

> [@Use all cores in a big.LITTLE architecture](https://discuss.tvm.apache.org/t/use-all-cores-in-a-big-little-architecture/8474/5):
>
> ```auto
> config_threadpool = remote.get_function('runtime.config_threadpool')
> # affinity_mode: kBig = 1, kLittle = -1. kDefault = 0. pass 1 or -1 to control the cores
> config_threadpool(affinity_mode, num_threads)
> 
> ```

1. For the example that I mentioned above, if I wanna split the network into two sub-graphs, then set the first graph → 4 small cores, second graph -\>4 big cores. (1) Should I set “cpus” =[4,4]? (2) How exactly to set the small & big CPU affinity order?

2. I do not fully understand how to implement this instruction:

3. Is it possible to share any example code for this CPU affinity setting? I think one simple example like a hand-made multilayer perceptron with CPU splitting would be really helpful for me and other users to understand the whole process.

Thanks again for your great help. Happy new year 🙂

---

<div class="post-metadata">

**Author:** ![hjiang](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/hjiang/32/1632_2.png) [@hjiang](https://discuss.tvm.apache.org/u/hjiang)\
**Post date:** [January 4, 2022, 6:42pm UTC](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161/20 "2022-01-04T18:42:09Z")

</div>

@popojames

`First of all, I wanna double-check if I wanna re-build a new TVM environment, should I go with this GitHub branch: https://github.com/huajsj/tvm/tree/threadaffinity?`

yes, rebuild is necessary to use the said cpu affinity feature,

`In this setting, I wanna double-check if I wanna use the “kSpecify” mode, is it similar to the original setting as shown below (i.e, calling config_threadpool) but with CPU affinity mode = -2 and adding parameters “cpus” and “exclude_worker0”?`

user need to use “Configure” function like "tvm::runtime::threading ::Configure(tvm::runtime::threading::ThreadGroup::kSpecify, 0, cpus, concurrency\_config);"to do the cpu affinity settings.

`For the example that I mentioned above, if I wanna split the network into two sub-graphs, then set the first graph → 4 small cores, second graph ->4 big cores. (1) Should I set “cpus” =[4,4]? (2) How exactly to set the small & big CPU affinity order?`

the 4 small cpu should like {0,1,2,3} the 4 big cpu should like {4, 5, 6, 7}

`How exactly to launch multi-threads if I call tvm backend in python to run the benchmark?`

tvm::runtime::threading ::Configure is a c++ function, you only can call it in c++ library, after split compute graph into 2 sub-graph, you should run each sub-graph with specify runtime in different thread and call the said function.

`Is it possible to share any example code for this CPU affinity setting? I think one simple example like a hand-made multilayer perceptron with CPU splitting would be really helpful for me and other users to understand the whole process.`

[tests/cpp/threading\_backend\_test.cc](https://github.com/apache/tvm/pull/9802/files#diff-2ab7a1ceac1f4c62fb7f15e33d7779a1bbbe0ae496b1b607027fc9e5ce025a75)::TVMBackendAffinityConfigure is the example.

Happy new year 🙂

[Next page](https://discuss.tvm.apache.org/t/can-tvm-split-work-into-different-layers-and-assign-layers-into-different-cores/11161.md?page=2)
