crc: avoid VPTERNLOGQ on Hygon in crc32_iscsi_by16_10#403
Open
MaodiMa wants to merge 1 commit intointel:masterfrom
Open
crc: avoid VPTERNLOGQ on Hygon in crc32_iscsi_by16_10#403MaodiMa wants to merge 1 commit intointel:masterfrom
MaodiMa wants to merge 1 commit intointel:masterfrom
Conversation
Disable VPTERNLOGQ based on platform check, as it reduces IPC on Hygon CPUs. Signed-off-by: Maodi Ma <mamaodi@hygon.cn>
pablodelara
reviewed
Mar 31, 2026
| vpclmulqdq zmm1, zmm0, zmm16, 0x10 | ||
| vpclmulqdq zmm0, zmm0, zmm16, 0x01 | ||
| vpternlogq zmm0, zmm1, [arg2+16*0], 0x96 | ||
| TERNARY_XOR zmm0, zmm1, [arg2+16*0] |
Contributor
There was a problem hiding this comment.
it works but it is code intrusive and I think it would be better to do it through macro only
| vpternlogq %1, %2, %3, 0x96 | ||
| %endif | ||
| %endmacro | ||
|
|
Contributor
There was a problem hiding this comment.
what about having a macro like this? this should not need more code changes
%ifdef NO_VPTERNLOGQ
%macro vpternlogq 4
%if %4 == 0x96
vpxorq %1, %1, %2
vpxorq %1, %1, %3
%endif
%endmacro
%endif
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.
Disable VPTERNLOGQ instruction in
crc32_iscsi_by16_10on Hygon CPU.Using VPTERNLOGQ in this case leads to an uarch bottleneck on current Hygon CPU and does not perform ideally. So we would like to use VPXORQ instead. This will leads to ~53.5% speedup according to
make perf:Modification only takes effect on Hygon CPU, based on the result of cpuinfo check.