Skip to content

Fix complex scalar pointers in strided batched GEMM - #6086

Open
Arthur031221 wants to merge 1 commit into
OpenMathLib:developfrom
Arthur031221:fix-complex-batch-scalars
Open

Arthur031221 wants to merge 1 commit into
OpenMathLib:developfrom
Arthur031221:fix-complex-batch-scalars

Conversation

@Arthur031221

Copy link
Copy Markdown
Contributor

Callers of cblas_cgemm_batch_strided and cblas_zgemm_batch_strided can receive incorrect matrix values when using complex alpha and beta. The strided batch interface stores the address of each local scalar pointer in blas_arg_t, so the GEMM kernel reads pointer bytes as the complex value. Pass the scalar pointers for complex builds and retain the scalar addresses for real builds.

The added single and double precision tests use fixed 1x1 matrices. They expect -14 + 24i from (2 + 3i)(1 + 2i)(3 + 4i) + (4 - i)(5 + 6i). Both tests failed before the fix and passed after it. Restoring the original source made both fail again.

Tested with make -j3 tests NO_LAPACK=1 NOFORTRAN=1 USE_THREAD=0: 137 core tests and 1,479 extension tests passed, with zero failures. This host has no Fortran compiler, so the LAPACK suite was not run.

This branch has not been deployed

No deployments
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.

1 participant