Using benchdnn to test all the different Arm Compute Library primitives
Hello! I am planning to add an AARCH64_ACL-specific testing suite that would run automatically when building on Aarch64 with ACL enabled.
For that I would like to use benchdnn to test all of the ACL primitives we have integrated in oneDNN. In other words, I want to run a benchdnn problem with all three convolution implementations. Of course, this is not currently possible because of how oneDNN works fundamentally in that it chooses the best implementation for you and you cannot explicitly select a particular implementation.
I have two ideas (in order or preference) and I need to get your thoughts before I proceed.
- Introduce new
dnnl_alg_kind_twhich I can then use to check at primitive creation stage. This means I would pass something like--alg=ACL_INDIRECTto benchdnn, the convolution driver would create a primitive descriptor withdnnl_acl_convolution_indirectand I can check that at primitive creation and returnstatus::unimplementedfrom the other two implementations. - Compile-time flags and ifdefs to include/exclude
cpu_convolution_listentries. This is a way of testing one problem with all convolutions but it's not a solution for an extended ACL-specific testing suite I could upstream.
So I suppose what I'm asking is, would idea no. 1 be an acceptable change to oneDNN? Am I missing/misunderstanding something?
Thanks!
Hi @diaena , you could actually rely on primitive desc iterator and check each eligible implementation for their name (using the query_impl_info function in benchdnn).
So the suggestion here would be to:
- add an option in benchdnn to select an implementation (e.g.
--impl=<regexp>), that would run the first implementation that matches the regexp. - add a input file for benchdnn which would contain the specific test you want to run for each implementation.
Summoning @dzarukin for other ideas.
Hi @diaena, this is an interesting request, and actually we already tried to implement something like that but both attempts failed (don't remember why exactly).
The best thing I would suggest to look at is to change existing skip-impl option mechanism:
Current behavior:
- When impl with such name is picked up, mark the test case as
SKIPPEDand continue.
It's used to remove reference implementations to be validated in long list to save some time. This helps especially where we know for sure will be many reference and/or plain gemm (which is not always fast) implementation hits.
Proposed behavior:
- When impl with such name is picked up, iterate over the list and try the next one.
This way it allows to actually skip implementations and fall back further through implementation list rather then just to skip the run. This behavior will be actually consisted with previous since if mark reference to skip (this impl should be always last in the list) then list is ended and we mark the problem skipped since the last implementation to pick up was skipped. Same should work with a list of implementations to skip. If all of last implementations were skipped, we skip the run. This should ACL library to create its own test file, mark jit-ted implementations skipped there and get ACL running.
If this inspires and you are willing to write a PoC, I would suggest either to isolate the logic of iterating in a separate (templated) function and call it from each init_pd directly or try to consolidate the logic in init_prim(...) but I will cost a bit more since the whole init_pd call should be repeated.
If this inspires and you are fine that our team will cover it, let's keep this item as a FR and ask @vpirogov to prioritize it depending on urgency and need. Hope it helps, thank you.
Closing as the question is addressed. Feel free to reopen or submit a new one to continue the conversation.
Hi @diaena, kindly wanted to let you know that now the behavior of --skip-impl follows the initial desire. It uses primitive_desc_iterator and will proceed to the next implementation in the list if the requested one was matched. In case you have own testing system and want to test ACL implementation, you may update input files to skip all implementations up to desired. Documentation for benchdnn was updated to reflect that behavior. Thank you.
Ah, wonderful news! Thank you for letting me know.