Uh oh!
There was an error while loading. Please reload this page.
Enable AVX-512 for block unrollings (both copying and zeroing) - #85389
Conversation
ghost
commented
Apr 26, 2023
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsCloses #83798 This PR enables AVX-512 for various unrollings using Examples: structMyStruct{longa,b,c,d,e,f,g,h;}// CopyingMyStructStructCopy(MyStructs){returns;}// ZeroingvoidStackallocZeroing(){byte*ptr=stackallocbyte[300];Consume(ptr);}old codegen: ; Method Tests:StructCopy(Tests+MyStruct):Tests+MyStruct:thisvzeroupper vmovdqu ymm0, ymmword ptr [r8] vmovdqu ymmword ptr [rdx],ymm0 vmovdqu ymm0, ymmword ptr [r8+20H] vmovdqu ymmword ptr [rdx+20H],ymm0movrax,rdxvzeroupperret; Total bytes of code: 30; Method Tests:StackallocZeroing():thispushrbpsubrsp,48learbp,[rsp+20H]movrax,0xD1FFAB1Emov qword ptr [rbp],raxtest dword ptr [rsp],espsubrsp,304learcx,[rsp+20H]mov qword ptr [rbp+08H],rcxxoredx,edxmovr8d,304call CORINFO_HELP_MEMSETmovrcx, qword ptr [rbp+08H]call[Tests:Consume(ulong)]movrcx,0xD1FFAB1Ecmp qword ptr [rbp],rcxje SHORT G_M16409_IG03call CORINFO_HELP_FAIL_FASTnoplearsp,[rbp+10H]poprbpret; Total bytes of code: 94new codegen: ; Method Tests:StructCopy(Tests+MyStruct):Tests+MyStruct:thisvzerouppervmovdqu32zmm0, zmmword ptr [r8]vmovdqu32 zmmword ptr [rdx],zmm0movrax,rdxvzeroupperret; Total bytes of code: 22; Method Tests:StackallocZeroing():thispushrbpsubrsp,48vzeroupperlearbp,[rsp+20H]movrax,0xD1FFAB1Emov qword ptr [rbp+08H],raxtest dword ptr [rsp],espsubrsp,304learcx,[rsp+20H] vxorps zmm0,zmm0vmovdqu32 zmmword ptr [rcx],zmm0vmovdqu32 zmmword ptr [rcx+40H],zmm0vmovdqu32 zmmword ptr [rcx+80H],zmm0vmovdqu32 zmmword ptr [rcx+C0H],zmm0vmovdqu32 zmmword ptr [rcx+F0H],zmm0call[Tests:Consume(ulong)]movrcx,0xD1FFAB1Ecmp qword ptr [rbp+08H],rcxje SHORT G_M16409_IG03call CORINFO_HELP_FAIL_FASTnoplearsp,[rbp+10H]poprbpret; Total bytes of code: 119
|
EgorBo
commented
Apr 26, 2023
/azp list |
This comment was marked as resolved.
This comment was marked as resolved.
EgorBo
commented
Apr 26, 2023
/azp run runtime-coreclr outerloop, runtime-coreclr jitstress-isas-x86 |
|
Azure Pipelines successfully started running 2 pipeline(s). |
EgorBo
commented
Apr 26, 2023
Diffs |
EgorBo
commented
Apr 26, 2023
@tannergooding@BruceForstall @dotnet/avx512-contrib PTAL, I didn't enable it for non-zeroing init (e.g. |
EgorBo
commented
Apr 26, 2023
Failures are mostly #85403 |
EgorBo
commented
Apr 27, 2023
benchmark: [Benchmark]publicvoidTest(){varptr=stackalloclong[42];Consume(ptr);}[MethodImpl(MethodImplOptions.NoInlining)]staticvoidConsume(void*ptr){}}
|
Closes#83798
This PR enables AVX-512 for various unrollings using
GT_BLK- it can bestackalloczeroing, struct copy/initialization,Unsafe.InitBloc/Unsafe.BlockCopycalls, etc.Examples:
Codegen diff: https://www.diffchecker.com/cxc6UYLf/ (this PR is on the right)
As the result, it increases ranges where we previously used to fallback to
memcpy/memsetcalls.Benchmark:
Ryzen 7950x, avx512, win-x64