Closed
Description
Per blog What’s new in TensorFlow Lite there's supposed to be developed an optimized matrix multiplication library (ruy).
How to check if this (ruy) optimized library is enabled during a build (compilation) from the source or how to check or make sure it's either enabled or disabled?
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
Saduf2019 commentedon May 25, 2020
@peter197321
Please refer to this link link1 and let us know if this helps.
peter197321 commentedon May 26, 2020
Unfortunately, it does not really help much :( I am looking for a way to check if the lib has been compiled with "ruy" option (a version of ruy) and want to check if this option has been applied (enabled) during a build process. I guess this requires to build particularly library with option
-frecord-gcc-switches
I applied
readelf -a
to binary file used where I found some versions infosnippet :
So what either would see if ruy used or other methods to check with?
What if I use a python - which library to check?
anyway - I'll investigate more :)
talumbau commentedon May 27, 2020
Hi,
Hopefully I can help you but I just want to make sure I understand the case you are interested in. Please add additional clarification if my answers below don't help. My understanding is that you are concerned with enabling/detecting enablement of Ruy in (at least) one of the following scenarios:
Answer: with a bazel build, add the command line flag
--define=tflite_with_ruy=true
to the bazel build command. This is already the default for ARM builds, but it does no harm to add it. For Makefile-based builds, ensure that-DTFLITE_WITH_RUY
is added to CXXFLAGS, as shown here:tensorflow/tensorflow/lite/tools/make/Makefile
Line 184 in 5802195
You have a TFLite binary from somewhere and wish to inspect it to see if Ruy is enabled without executing the binary.
Answer: there's no supported way to do this, but one could imagine a few ideas.
You have the TF Lite library linked to your application and you wish to, at run time, determine if Ruy is being used for matrix multiplication.
Answer: there is also no supported way to check here, i.e. a flag of some kind, but you can always compile with
-DRUY_PROFILER
and then run your program to make sure you get Ruy for the expected GEMM operations. The output at the end of program execution will tell you which GEMMs were done with Ruy (with size info) as well as what Ruy path was selected and how much time was spent on various parts of the GEMM operation.Does that help?
peter197321 commentedon Jun 1, 2020
Thank you.
Is it apply for the Cross-compile build of TensorFlow Lite for ARM64 board?