Skip to content

LoongArch64: improve max/min index kernels and cscal - #6267

Open
HecaiYuan wants to merge 4 commits into
OpenMathLib:developfrom
HecaiYuan:develop
Open

HecaiYuan wants to merge 4 commits into
OpenMathLib:developfrom
HecaiYuan:develop

Conversation

@HecaiYuan

Copy link
Copy Markdown
Contributor

Simplify LoongArch64 index-search kernels and optimize complex scaling kernels.

The LSX/LASX isamax/isamin, idamax/idamin, icamax/icamin and izamax/izamin kernels have been reworked: replace the old fully-unrolled inner loop with per-lane index tracking with a unified seed-then-loop block reduction scheme, supporting both unit-stride and strided paths.

We reduce a full vector block at once (|Re| + |Im| for complex variants), then only rescan the winning block to get the index of the first extremum.

Simplify the LSX and LASX isamax/isamin/idamax/idamin kernels: use a
single seed-then-loop structure for both the unit-stride and strided
cases, and locate the index by rescanning only the winning vector
block. This removes the duplicated unrolled code and the per-lane
index bookkeeping of the old kernels.
Same rework as the real isamax/isamin kernels, applied to the
absolute-value variants (isamax/isamin, idamax/idamin): one shared
structure for unit-stride and strided input, block reduction followed
by a rescan of the winning block for the exact first matching index.
Same rework as the other index search kernels, applied to the complex
variants (icamax/icamin, izamax/izamin): the |Re| + |Im| magnitudes of
a whole vector block are reduced at once, and only the winning block is
rescanned to get the index of the first occurrence.

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