Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix][Strategy] Fix arm_cpu int8 conv2d strategy for dotprod and i8mm targets #15711

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

Anndrey24
Copy link
Contributor

Whenever both dotprod and i8mm were available together on a target (e.g. "llvm --device=arm_cpu --mtriple=aarch64-linux-gnu -mattr=+v8.2a,+dotprod,+i8mm"), the native int8 conv2d implementation corresponding to the +dotprod attribute would be selected, but the compute definition of the conv2d operation would be constructed for the +i8mm attribute and its related interleaved schedule instead.
The reason for this was a different order of conditional statements being used in 2 separate files:

  • arm_cpu.py: When selecting the conv2d implementation, the program first checked for dotprod support. If present, it chose the native schedule
  • conv2d_gemm.py: when constructing the compute definition, i8mm support is checked first, then dotprod

To fix this, I modified the int8 conv2d strategy to prioritize i8mm over dotprod when both are available too. I also added new test cases to cover this situation.

cc @ekalda @lhutton1 @leandron @neildhickey

… i8mm targets

Whenever both dotprod and i8mm were available together on a target (e.g. `"llvm --device=arm_cpu --mtriple=aarch64-linux-gnu -mattr=+v8.2a,+dotprod,+i8mm"`), the native int8 conv2d implementation corresponding to the `+dotprod` attribute would be selected, but the compute definition of the conv2d operation would be constructed for the `+i8mm` attribute and its related interleaved schedule instead. The reason for this was a different order of conditional statements being used in 2 separate files:
 - `arm_cpu.py`: When selecting the conv2d implementation, the program first checked for `dotprod` support. If present, it chose the native schedule
 - `conv2d_gemm.py`: when constructing the compute definition, `i8mm` support is checked first, then `dotprod`
To fix this, I modified the int8 conv2d strategy to prioritize `i8mm` over `dotprod` when both are available too.
Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Anndrey24, LGTM!

@lhutton1 lhutton1 merged commit f719151 into apache:main Sep 11, 2023
@Anndrey24 Anndrey24 deleted the conv2d-strategy branch November 8, 2023 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants