# TVM relay does not use avx for model compilation

**URL:** <https://discuss.tvm.apache.org/t/tvm-relay-does-not-use-avx-for-model-compilation/2267>\
**Category:** Questions\
**Created:** [April 17, 2019, 8:43pm UTC](https://discuss.tvm.apache.org/t/tvm-relay-does-not-use-avx-for-model-compilation/2267 "2019-04-17T20:43:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![apivovarov](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/apivovarov/32/206_2.png) [@apivovarov](https://discuss.tvm.apache.org/u/apivovarov)\
**Post date:** [April 17, 2019, 8:43pm UTC](https://discuss.tvm.apache.org/t/tvm-relay-does-not-use-avx-for-model-compilation/2267/1 "2019-04-17T20:43:12Z")

</div>

I tried to compile and run resnet50\_v2 model with relay with avx512 on i7 cpu which only supports avx2.

```auto
frontend = 'relay'
model_name = 'resnet50_v2'
target = 'llvm -mcpu=skylake-avx512'

```

If I tried March 31st TVM version (commit `eb1ed1164ec0a56649d9a5fadcd1f7fdde8e6aa3`) then `model.run()` fails as expected with `Illegal instruction (core dumped)`

But if I try April 17th version (`12257ddd2d2ee3a9bd58b7f92c4a66d9cca4fa45`) then it works.  
Performance is similar to llvm without any flags

I guess the latest TVM relay does not use avx2 or avx512 for model compilation at all.

I also tried the same test with `nnvm` frontend - model.run() fails for both April 17th and March 31st tvm versions. So, the issue with avx exists only in relay but not in nnvm.

---

<div class="post-metadata">

**Author:** ![eqy](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/eqy/32/766_2.png) [@eqy](https://discuss.tvm.apache.org/u/eqy)\
**Post date:** [April 17, 2019, 8:43pm UTC](https://discuss.tvm.apache.org/t/tvm-relay-does-not-use-avx-for-model-compilation/2267/2 "2019-04-17T20:43:50Z")

</div>

similar issue reported at [X86 target performance regression](https://discuss.tvm.ai/t/x86-target-performance-regression/2266)

---

<div class="post-metadata">

**Author:** ![apivovarov](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/apivovarov/32/206_2.png) [@apivovarov](https://discuss.tvm.apache.org/u/apivovarov)\
**Post date:** [April 17, 2019, 9:51pm UTC](https://discuss.tvm.apache.org/t/tvm-relay-does-not-use-avx-for-model-compilation/2267/3 "2019-04-17T21:51:27Z")

</div>

@eqy @merrymercy @kevinthesun @tqchen Do you suspect any commit(s) btw Mar 31 - Apr 16 in this relay/avx issue? Or we need to to binary search…
