oneDNN icon indicating copy to clipboard operation
oneDNN copied to clipboard

Using benchdnn to test all the different Arm Compute Library primitives

Open diaena opened this issue 5 years ago • 5 comments

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.

  1. Introduce new dnnl_alg_kind_t which I can then use to check at primitive creation stage. This means I would pass something like --alg=ACL_INDIRECT to benchdnn, the convolution driver would create a primitive descriptor with dnnl_acl_convolution_indirect and I can check that at primitive creation and return status::unimplemented from the other two implementations.
  2. Compile-time flags and ifdefs to include/exclude cpu_convolution_list entries. 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!

diaena avatar Mar 31 '21 12:03 diaena

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:

  1. add an option in benchdnn to select an implementation (e.g. --impl=<regexp> ), that would run the first implementation that matches the regexp.
  2. add a input file for benchdnn which would contain the specific test you want to run for each implementation.

Summoning @dzarukin for other ideas.

mgouicem avatar Mar 31 '21 16:03 mgouicem

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 SKIPPED and 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.

dzarukin avatar Apr 01 '21 22:04 dzarukin

Closing as the question is addressed. Feel free to reopen or submit a new one to continue the conversation.

vpirogov avatar Apr 28 '21 20:04 vpirogov

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.

dzarukin avatar Jul 15 '22 00:07 dzarukin

Ah, wonderful news! Thank you for letting me know.

diaena avatar Jul 15 '22 13:07 diaena