RISC-V: Add TRSM RVV Kernels for ZVL Targets#5895
Merged
Merged
Conversation
Contributor
Author
|
Why did the pipeline finish so quickly this time? |
Collaborator
|
There was no backlog of other PR runs, so none stayed queued for ages, I think ? Perhaps the internal retries in our friend the C910V job should be removed too, as there's nothing to be learned from them (and I haven't been able to |
Contributor
Author
|
After watching bsd-aarch64 crawl for ages, I am starting to understand why you were thinking about removing this job. It really does test one’s patience. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use ZVL-specific TRSM RVV kernels instead of reusing the x280 legacy path:
RN/RTare the most natural RVV paths because they update contiguous rows ofC.Skeeps RVV for all four cases because the measured gains are stable.D/C LN/LTandZ LN/LT/RNremain generic because forced RVV provided little, negative, or inconsistent benefit.Risk of Direct x280 Reuse
Directly changing
STRSM/DTRSM/CTRSM/ZTRSMKERNEL_{LN,LT,RN,RT}totrsm_kernel_*_rvv_v1.c, while also enabling the existing x280TRSMCOPY*_rvv_v1.c/ZTRSMCOPY*_rvv_v1.ccopy overrides, was tested and found to be incorrect.This corresponds to
Right/Upper/NoTrans/NonUnitwith a smallm=7, n=8case. After fixing only the right-side tail handling, the failure moved to the left-side path:This corresponds to
Left/Upper/Trans/NonUnit. The root cause is not a single numerical error. The x280 kernels use RVV instructions, but they are still tied to the x280 block sizes, copy/packed layout, and GEMM unroll settings. These assumptions differ for the ZVL targets, so direct reuse of x280 breaks correctness. The same layout and block-size constraints also apply to the complex paths that dispatch throughGEMM_KERNEL_L/R.Build Configuration
make TARGET=RISCV64_ZVL256B BINARY=64 ARCH=riscv64 \ CC=gcc HOSTCC=gcc NOFORTRAN=1 NO_LAPACK=1 NUM_THREADS=8 clean make -j8 TARGET=RISCV64_ZVL256B BINARY=64 ARCH=riscv64 \ CC=gcc HOSTCC=gcc NOFORTRAN=1 NO_LAPACK=1 NUM_THREADS=8 sharedmake -j8 TARGET=RISCV64_ZVL256B BINARY=64 ARCH=riscv64 \ CC=gcc HOSTCC=gcc NOFORTRAN=1 NO_LAPACK=1 NUM_THREADS=8 shared make -C benchmark -j8 TARGET=RISCV64_ZVL256B BINARY=64 ARCH=riscv64 \ CC=gcc HOSTCC=gcc NOFORTRAN=1 NO_LAPACK=1 NUM_THREADS=8 \ strsm.goto dtrsm.goto ctrsm.goto ztrsm.gotoCorrectness
Additional standalone correctness coverage:
strsm,dtrsm,ctrsm,ztrsmLeft,RightUpper,LowerNoTrans,Trans; complex:NoTrans,Trans,ConjTransUnit,NonUnitPassed:
zvl_trsm_check: all 1872 cases passedPerformance
The benchmark uses
.gotoprograms generated from OpenBLASbenchmark/trsm.c, fixed to:OPENBLAS_NUM_THREADS=1 OPENBLAS_SIDE={L|R} OPENBLAS_UPLO=U OPENBLAS_TRANS={N|T} OPENBLAS_DIAG=NSizes and loop counts:
End-to-end TRSM time includes triangular block solves, local updates, GEMM updates, packing, and call overhead.
trsm_kernel_*_rvv.cmainly optimizes the small triangular block solve and local updates, so even small cases are diluted by work outside the TRSM kernel. As size grows, the GEMM-update share usually increases, making the dilution more visible.Test hardware:
Spacemit X60. Results are inMFlops; higher is better.