google/ruy

AVX support on Apple MacOS

ebraraktas opened this issue · 1 comments

Hi,

I am using ruy as a dependency of tensorflow. And their new quantized conv2d implementation relies on ruy::TrMul. The issue is that ruy does not activate X86_ENHANCEMENTS on MacOS by default. And when I tried forcing it with -DRUY_FORCE_ENABLE_X86_ENHANCEMENTS, it runs faster, but the output is wrong. A similar result can be observed if I run with RUY_PATHS=0x20 environment variable (suggested by @talumbau in a tensorflow issue).

My computer is MacBook Pro 2018 having Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz (ark page), hence it supports AVX2.

platform.h has a comment about disabling it on Apple, but I cannot access the mentioned comment under b/138922878. My question is that: Is it possible to build tensorflow with AVX instructions enabled for the ruy backend on Apple?

This issue can be closed, because I was wrong about the behavior while using -DRUY_FORCE_ENABLE_X86_ENHANCEMENTS. It allows one to compile ruy on MacOS with AVX enhancements. My mistake was linking with old ruy binary without enhancements and forcing it by using RUY_PATHS.

On the other hand, if it was enabled by default, it would be better.