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

Enable RVV GEMM/IGEMM 7 x m4 in operator config #6411

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bhbruce
Copy link
Contributor

@bhbruce bhbruce commented May 14, 2024

This PR aims to enable RVV GEMM/IGEMM/X32-PACKW in GEMM config.
It leads to enabling RVV implementation in operator API.

@bhbruce
Copy link
Contributor Author

bhbruce commented May 14, 2024

@alankelly @fbarchard Could you help to review it?
Also, I would like to ask about what's the appropriate way to enable RVV-only nr2 selection logic in following files.

src/operators/convolution-nhwc.c
1653:  const struct xnn_gemm_config* gemm_nr2_config = xnn_init_f32_gemm_nr2_config();
src/operators/dynamic-fully-connected-nc.c
215:  const struct xnn_gemm_config* gemm_nr2_config = xnn_init_f32_gemm_nr2_config();
src/operators/fully-connected-nc.c
754:  const struct xnn_gemm_config* gemm_nr2_config = xnn_init_f32_gemm_nr2_config();
src/operators/deconvolution-nhwc.c
898:  const struct xnn_gemm_config* gemm_nr2_config = xnn_init_f32_gemm_nr2_config();

The current logic determines to use nr2_config(half nr) if gemm_config->nr > output_channels.
For the RISC-V vector, I would like to specialize in either

gemm_nr2_config->nr <= output_channels
or
gemm_config->nr / 2 <= output_channels

However, there is no arch-specifc definition macro used in src/operators/.

@fbarchard
Copy link
Contributor

nr 2 is an MRx2 GEMM - 2 floats wide.
On SSE and NEON that normally use 4 floats per vector it allows a faster GEMM.
But it is optional... any gemm can output NC of less than a full vector, and on RVV is shouldnt make a difference.

@bhbruce bhbruce force-pushed the rv-gemm-config branch 2 times, most recently from efccdbd to 9804699 Compare May 22, 2024 05:48
Signed-off-by: Bruce Lai <bruce.lai@sifive.com>
Signed-off-by: Bruce Lai <bruce.lai@sifive.com>
Signed-off-by: Bruce Lai <bruce.lai@sifive.com>
@bhbruce
Copy link
Contributor Author

bhbruce commented May 23, 2024

Hi @fbarchard @alankelly
Could you help to merge this PR?

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.

None yet

2 participants