Skip to content

Comments

Add SBGEMV and SHGEMV routines to RISC-V#5481

Merged
martin-frbg merged 7 commits intoOpenMathLib:developfrom
ChipKerchner:vectorSBGEMV
Oct 7, 2025
Merged

Add SBGEMV and SHGEMV routines to RISC-V#5481
martin-frbg merged 7 commits intoOpenMathLib:developfrom
ChipKerchner:vectorSBGEMV

Conversation

@ChipKerchner
Copy link
Contributor

Add SBGEMV and SHGEMV routines to RISC-V - up to 32X faster.

@ChipKerchner
Copy link
Contributor Author

ChipKerchner commented Oct 3, 2025

Can't tie in SHGEMV since there is no support in the system as of yet.

#5480

@martin-frbg
Copy link
Collaborator

can probably tie that into interface/sbgemv.c and copy driver/level2/sbgemv_thread.c, then needs adding to common_s.h , common_level2.h , cblas.h , common_interface.h , common_param.h (two times there - once for single target and once for dynamic_arch) , kernel/setparam-ref.c plus exports/gensymbol and the (c)makefile additions.
I'll see if I can prepare a companion PR sometime tomorrow

@martin-frbg
Copy link
Collaborator

almost done but stuck on a prototype mismatch that doesn't immediately make sense. I'll try to get back to it tomorrow night

@martin-frbg
Copy link
Collaborator

prototype mismatch is a direct consequence of the kernel function signature being wrong - no support for parameter "beta", and an extraneous "buffer" argument ? (Please compare the CNAME line in generic/gemv_n.c or the x86_64 sbgemv_n.c )

@ChipKerchner
Copy link
Contributor Author

ChipKerchner commented Oct 6, 2025

I think that RISC-V used the same GEMV kernel function signature as ARM did - without beta and with extra buffer parameter.

@Mousius
Copy link
Contributor

Mousius commented Oct 6, 2025

I think the older variants use the buffer and do beta separately, newer ones seem to be doing beta updates as part of the kernel:

@ChipKerchner
Copy link
Contributor Author

ChipKerchner commented Oct 6, 2025

Is the kernel function signature different for GEMV vs SBGEMV?

The original GEMV (FP32/FP64) for RISC-V seems to use the non-beta format.

@Mousius
Copy link
Contributor

Mousius commented Oct 6, 2025

Is the kernel function signature different for GEMV vs SBGEMV?

The original GEMV (FP32/FP64) for RISC-V seems to use the non-beta format.

Yip, those are the two kernel signatures I linked to 😸 BGEMV also uses the SBGEMV signature.

@martin-frbg
Copy link
Collaborator

Yes, for some "historic" reason the kernel interface for SBGEMV is different from SGEMV. Not entirely sure whose "fault" it was, probably the Intel folks were first - arguably the "beta and no buffer" version has a clear majority now, so it is probably easier to consolidate on that.
(@Mousius guess it would make sense to rename "your" generic/gemv(_n/_t).c to bgemv or sbgemv too, as a generic kernel for S/DGEMV already lives in kernel/arm like half of the generics do - another old oddity)

@ChipKerchner
Copy link
Contributor Author

@martin-frbg Ok, I changed the signature of SBGEMV for RISCV to the appropriate one.

@martin-frbg
Copy link
Collaborator

Thank you - I was on it but got interrupted by the chimney sweep :)

@martin-frbg martin-frbg added this to the 0.3.31 milestone Oct 7, 2025
@martin-frbg martin-frbg merged commit 064751e into OpenMathLib:develop Oct 7, 2025
79 of 88 checks passed
@ChipKerchner
Copy link
Contributor Author

#5279

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.

3 participants