Skip to content

Enable AVX512 Additional 16 SIMD Registers, with accessors instead of macros - #81818

Closed
BruceForstall wants to merge 34 commits into
dotnet:mainfrom
BruceForstall:anthonycanino_avx512-upper-regs-with-reg-accessors
Closed

Enable AVX512 Additional 16 SIMD Registers, with accessors instead of macros#81818
BruceForstall wants to merge 34 commits into
dotnet:mainfrom
BruceForstall:anthonycanino_avx512-upper-regs-with-reg-accessors

Conversation

@BruceForstall

Copy link
Copy Markdown
Contributor

This is #79544 with one additional change.

anthonycaninoand others added 30 commits January 17, 2023 10:16
This allows for more registers to be encoded in the register allocator.
Commit includes refactoring code to use `const instrDesc *` instead of `instruction`
so information about when EVEX is needed (due to high SIMD registers) is
available to the emitter.
Commit constrains certain hw intrinsics and gentree nodes to use
lower SIMD registers even if upper SIMD registers are available due
to limitations of EVEX encoding for certain instructions.
For example, SSE `Reciprocal` lowers to `rcpps` which does not have an
EVEX encoding form, hence, we cannot allow that hw intrincis node to use
a high SIMD register.
These intrinsics are marked with `HW_Flag_NoEvexSemantics`. Other such
intructions related to masking (typically marked with
`HW_Flag_ReturnsPerElementMask`) also have similar issues (though they
can be replaced with the EVEX k registers and associated masking when
implemented).
In addition, the callee/calleer save registers have also been adjusted
to properly handle the presence and absence of AVX512 upper simd
registers at runtime.
Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
anthonycaninoand others added 4 commits February 3, 2023 10:43
This reverts commit 91cf3db.
Convert from macros to accessor functions for
RBM_ALLFLOAT, RBM_FLT_CALLEE_TRASH, CNT_CALLEE_TRASH_FLOAT.
Convert LSRA use of ACTUAL_REG_COUNT to AVAILABLE_REG_COUNT,
and create an accessor for that value for AMD64 as well.
@ghostghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 8, 2023
@ghost

ghost commented Feb 8, 2023

Copy link
Copy Markdown

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak
See info in area-owners.md if you want to be subscribed.

Issue Details

This is #79544 with one additional change.

Author:BruceForstall
Assignees:BruceForstall
Labels:

area-CodeGen-coreclr

Milestone:-

#if defined(TARGET_AMD64)
regMaskTP get_RBM_ALLFLOAT() const
{
return compiler->rbmAllFloat;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not compiler->get_RBM_ALLFLOAT() and likewise for other methods in individual classes?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way is fine; they're equivalent. Your suggestion is slightly better encapsulation. However, I'd like to do an experiment to see how much TP could be gained by making a local copy of these fields -- probably a minimal effect.

@kunalspathak

Copy link
Copy Markdown
Contributor

Approach seems reasonable and hoping it won't affect the TP.

@BruceForstall

Copy link
Copy Markdown
ContributorAuthor

TP looks equivalent to the baseline:

ASM diffs generated on Windows x64

linux arm64

Diffs are based on 1,462,192 contexts (402,179 MinOpts, 1,060,013 FullOpts).

MISSED contexts: 717 (0.05%)

No diffs found.

Details

Context information

CollectionDiffed contextsMinOptsFullOptsMissed, baseMissed, diff
benchmarks.run.linux.arm64.checked.mch39,5645,75333,81125 (0.06%)25 (0.06%)
coreclr_tests.run.linux.arm64.checked.mch632,264382,626249,63850 (0.01%)50 (0.01%)
libraries.crossgen2.linux.arm64.checked.mch176,56213176,5498 (0.00%)8 (0.00%)
libraries.pmi.linux.arm64.checked.mch259,8624,808255,054181 (0.07%)181 (0.07%)
libraries_tests.pmi.linux.arm64.checked.mch353,9408,979344,961453 (0.13%)453 (0.13%)
1,462,192402,1791,060,013717 (0.05%)717 (0.05%)

osx arm64

Diffs are based on 1,361,376 contexts (398,828 MinOpts, 962,548 FullOpts).

MISSED contexts: 626 (0.05%)

No diffs found.

Details

Context information

CollectionDiffed contextsMinOptsFullOptsMissed, baseMissed, diff
benchmarks.run.osx.arm64.checked.mch27,2441,33025,91423 (0.08%)23 (0.08%)
coreclr_tests.run.osx.arm64.checked.mch589,939384,164205,77544 (0.01%)44 (0.01%)
libraries.crossgen2.osx.arm64.checked.mch202,97715202,96215 (0.01%)15 (0.01%)
libraries.pmi.osx.arm64.checked.mch278,5285,063273,465188 (0.07%)188 (0.07%)
libraries_tests.pmi.osx.arm64.checked.mch262,6888,256254,432356 (0.14%)356 (0.14%)
1,361,376398,828962,548626 (0.05%)626 (0.05%)

linux x64

Diffs are based on 1,356,324 contexts (348,118 MinOpts, 1,008,206 FullOpts).

MISSED contexts: 763 (0.06%)

No diffs found.

Details

Context information

CollectionDiffed contextsMinOptsFullOptsMissed, baseMissed, diff
benchmarks.run.linux.x64.checked.mch38,5275,23033,29727 (0.07%)27 (0.07%)
coreclr_tests.run.linux.x64.checked.mch541,480327,642213,83849 (0.01%)49 (0.01%)
libraries.crossgen2.linux.x64.checked.mch142,90513142,8924 (0.00%)4 (0.00%)
libraries.pmi.linux.x64.checked.mch259,8644,809255,055189 (0.07%)189 (0.07%)
libraries_tests.pmi.linux.x64.checked.mch373,54810,424363,124494 (0.13%)494 (0.13%)
1,356,324348,1181,008,206763 (0.06%)763 (0.06%)

windows arm64

Diffs are based on 1,468,342 contexts (400,661 MinOpts, 1,067,681 FullOpts).

MISSED contexts: 736 (0.05%)

No diffs found.

Details

Context information

CollectionDiffed contextsMinOptsFullOptsMissed, baseMissed, diff
benchmarks.run.windows.arm64.checked.mch30,2101,32428,88622 (0.07%)22 (0.07%)
coreclr_tests.run.windows.arm64.checked.mch595,685384,999210,68642 (0.01%)42 (0.01%)
libraries.crossgen2.windows.arm64.checked.mch215,57115215,55612 (0.01%)12 (0.01%)
libraries.pmi.windows.arm64.checked.mch269,7474,959264,788182 (0.07%)182 (0.07%)
libraries_tests.pmi.windows.arm64.checked.mch357,1299,364347,765478 (0.13%)478 (0.13%)
1,468,342400,6611,067,681736 (0.05%)736 (0.05%)

windows x64

Diffs are based on 1,564,142 contexts (446,611 MinOpts, 1,117,531 FullOpts).

MISSED contexts: 959 (0.06%)

No diffs found.

Details

Context information

CollectionDiffed contextsMinOptsFullOptsMissed, baseMissed, diff
aspnet.run.windows.x64.checked.mch137,37180,27257,09931 (0.02%)31 (0.02%)
aspnet_block.run.windows.x64.checked.mch33,66820,18113,4872 (0.01%)2 (0.01%)
benchmarks.run.windows.x64.checked.mch27,0231,32825,69529 (0.11%)29 (0.11%)
coreclr_tests.run.windows.x64.checked.mch520,551330,386190,16549 (0.01%)49 (0.01%)
libraries.crossgen2.windows.x64.checked.mch213,77215213,75746 (0.02%)46 (0.02%)
libraries.pmi.windows.x64.checked.mch271,8364,960266,876225 (0.08%)225 (0.08%)
libraries_tests.pmi.windows.x64.checked.mch359,9219,469350,452577 (0.16%)577 (0.16%)
1,564,142446,6111,117,531959 (0.06%)959 (0.06%)

#Throughput impact on Windows x64

The following shows the impact on throughput in terms of number of instructions executed inside the JIT. Negative percentages/lower numbers are better.

linux arm64

No significant throughput differences found

Details

All contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
benchmarks.run.linux.arm64.checked.mch70,241,779,36570,241,942,566+0.00%
coreclr_tests.run.linux.arm64.checked.mch1,147,308,428,3961,147,308,176,762-0.00%
libraries.crossgen2.linux.arm64.checked.mch117,551,674,016117,551,797,939+0.00%
libraries.pmi.linux.arm64.checked.mch239,441,711,456239,441,891,372+0.00%
libraries_tests.pmi.linux.arm64.checked.mch546,098,207,645546,098,259,965+0.00%

MinOpts contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
benchmarks.run.linux.arm64.checked.mch1,193,926,9391,193,926,933-0.00%
coreclr_tests.run.linux.arm64.checked.mch478,903,085,270478,902,550,139-0.00%
libraries.crossgen2.linux.arm64.checked.mch1,713,9181,713,9180.00%
libraries.pmi.linux.arm64.checked.mch1,792,682,4991,792,682,339-0.00%
libraries_tests.pmi.linux.arm64.checked.mch12,994,393,75812,994,385,379-0.00%

FullOpts contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
benchmarks.run.linux.arm64.checked.mch69,047,852,42669,048,015,633+0.00%
coreclr_tests.run.linux.arm64.checked.mch668,405,343,126668,405,626,623+0.00%
libraries.crossgen2.linux.arm64.checked.mch117,549,960,098117,550,084,021+0.00%
libraries.pmi.linux.arm64.checked.mch237,649,028,957237,649,209,033+0.00%
libraries_tests.pmi.linux.arm64.checked.mch533,103,813,887533,103,874,586+0.00%

osx arm64

No significant throughput differences found

Details

All contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
benchmarks.run.osx.arm64.checked.mch49,083,877,66049,084,071,774+0.00%
coreclr_tests.run.osx.arm64.checked.mch1,064,336,437,7861,064,336,295,877-0.00%
libraries.crossgen2.osx.arm64.checked.mch134,069,111,408134,069,361,235+0.00%
libraries.pmi.osx.arm64.checked.mch248,422,161,035248,422,416,927+0.00%
libraries_tests.pmi.osx.arm64.checked.mch390,173,552,940390,173,497,718-0.00%

MinOpts contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
benchmarks.run.osx.arm64.checked.mch648,199,069648,199,094+0.00%
coreclr_tests.run.osx.arm64.checked.mch478,933,235,138478,932,456,866-0.00%
libraries.crossgen2.osx.arm64.checked.mch2,149,5842,149,5840.00%
libraries.pmi.osx.arm64.checked.mch1,854,638,1371,854,636,376-0.00%
libraries_tests.pmi.osx.arm64.checked.mch7,372,035,7727,372,027,382-0.00%

FullOpts contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
benchmarks.run.osx.arm64.checked.mch48,435,678,59148,435,872,680+0.00%
coreclr_tests.run.osx.arm64.checked.mch585,403,202,648585,403,839,011+0.00%
libraries.crossgen2.osx.arm64.checked.mch134,066,961,824134,067,211,651+0.00%
libraries.pmi.osx.arm64.checked.mch246,567,522,898246,567,780,551+0.00%
libraries_tests.pmi.osx.arm64.checked.mch382,801,517,168382,801,470,336-0.00%

linux x64

Overall (+0.29% to +0.47%)
CollectionPDIFF
benchmarks.run.linux.x64.checked.mch+0.36%
coreclr_tests.run.linux.x64.checked.mch+0.29%
libraries.crossgen2.linux.x64.checked.mch+0.47%
libraries.pmi.linux.x64.checked.mch+0.41%
libraries_tests.pmi.linux.x64.checked.mch+0.33%
MinOpts (+0.31% to +0.71%)
CollectionPDIFF
benchmarks.run.linux.x64.checked.mch+0.57%
coreclr_tests.run.linux.x64.checked.mch+0.33%
libraries.crossgen2.linux.x64.checked.mch+0.71%
libraries.pmi.linux.x64.checked.mch+0.47%
libraries_tests.pmi.linux.x64.checked.mch+0.31%
FullOpts (+0.27% to +0.47%)
CollectionPDIFF
benchmarks.run.linux.x64.checked.mch+0.35%
coreclr_tests.run.linux.x64.checked.mch+0.27%
libraries.crossgen2.linux.x64.checked.mch+0.47%
libraries.pmi.linux.x64.checked.mch+0.41%
libraries_tests.pmi.linux.x64.checked.mch+0.34%
Details

All contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
benchmarks.run.linux.x64.checked.mch68,135,546,46668,379,028,140+0.36%
coreclr_tests.run.linux.x64.checked.mch882,495,624,591885,069,447,568+0.29%
libraries.crossgen2.linux.x64.checked.mch83,466,954,70083,857,666,751+0.47%
libraries.pmi.linux.x64.checked.mch222,676,329,016223,598,524,442+0.41%
libraries_tests.pmi.linux.x64.checked.mch522,052,368,783523,801,146,084+0.33%

MinOpts contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
benchmarks.run.linux.x64.checked.mch921,268,645926,494,892+0.57%
coreclr_tests.run.linux.x64.checked.mch383,864,984,221385,113,245,736+0.33%
libraries.crossgen2.linux.x64.checked.mch1,469,7001,480,108+0.71%
libraries.pmi.linux.x64.checked.mch1,435,315,7221,442,085,835+0.47%
libraries_tests.pmi.linux.x64.checked.mch11,111,188,44011,145,441,772+0.31%

FullOpts contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
benchmarks.run.linux.x64.checked.mch67,214,277,82167,452,533,248+0.35%
coreclr_tests.run.linux.x64.checked.mch498,630,640,370499,956,201,832+0.27%
libraries.crossgen2.linux.x64.checked.mch83,465,485,00083,856,186,643+0.47%
libraries.pmi.linux.x64.checked.mch221,241,013,294222,156,438,607+0.41%
libraries_tests.pmi.linux.x64.checked.mch510,941,180,343512,655,704,312+0.34%

windows arm64

No significant throughput differences found

Details

All contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
benchmarks.run.windows.arm64.checked.mch54,625,739,77754,625,876,473+0.00%
coreclr_tests.run.windows.arm64.checked.mch1,070,801,693,1931,070,801,607,603-0.00%
libraries.crossgen2.windows.arm64.checked.mch144,660,196,843144,660,353,305+0.00%
libraries.pmi.windows.arm64.checked.mch251,783,794,117251,784,105,628+0.00%
libraries_tests.pmi.windows.arm64.checked.mch552,053,831,373552,053,922,837+0.00%

MinOpts contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
benchmarks.run.windows.arm64.checked.mch620,272,673620,272,653-0.00%
coreclr_tests.run.windows.arm64.checked.mch480,159,066,522480,158,434,797-0.00%
libraries.crossgen2.windows.arm64.checked.mch2,156,1912,156,1910.00%
libraries.pmi.windows.arm64.checked.mch1,897,501,2321,897,503,852+0.00%
libraries_tests.pmi.windows.arm64.checked.mch12,293,528,44812,293,505,555-0.00%

FullOpts contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
benchmarks.run.windows.arm64.checked.mch54,005,467,10454,005,603,820+0.00%
coreclr_tests.run.windows.arm64.checked.mch590,642,626,671590,643,172,806+0.00%
libraries.crossgen2.windows.arm64.checked.mch144,658,040,652144,658,197,114+0.00%
libraries.pmi.windows.arm64.checked.mch249,886,292,885249,886,601,776+0.00%
libraries_tests.pmi.windows.arm64.checked.mch539,760,302,925539,760,417,282+0.00%

windows x64

Overall (+0.26% to +0.43%)
CollectionPDIFF
aspnet.run.windows.x64.checked.mch+0.40%
aspnet_block.run.windows.x64.checked.mch+0.41%
benchmarks.run.windows.x64.checked.mch+0.37%
coreclr_tests.run.windows.x64.checked.mch+0.26%
libraries.crossgen2.windows.x64.checked.mch+0.43%
libraries.pmi.windows.x64.checked.mch+0.38%
libraries_tests.pmi.windows.x64.checked.mch+0.31%
MinOpts (+0.27% to +0.65%)
CollectionPDIFF
aspnet.run.windows.x64.checked.mch+0.43%
aspnet_block.run.windows.x64.checked.mch+0.39%
benchmarks.run.windows.x64.checked.mch+0.41%
coreclr_tests.run.windows.x64.checked.mch+0.29%
libraries.crossgen2.windows.x64.checked.mch+0.65%
libraries.pmi.windows.x64.checked.mch+0.44%
libraries_tests.pmi.windows.x64.checked.mch+0.27%
FullOpts (+0.23% to +0.43%)
CollectionPDIFF
aspnet.run.windows.x64.checked.mch+0.39%
aspnet_block.run.windows.x64.checked.mch+0.42%
benchmarks.run.windows.x64.checked.mch+0.37%
coreclr_tests.run.windows.x64.checked.mch+0.23%
libraries.crossgen2.windows.x64.checked.mch+0.43%
libraries.pmi.windows.x64.checked.mch+0.38%
libraries_tests.pmi.windows.x64.checked.mch+0.31%
Details

All contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
aspnet.run.windows.x64.checked.mch129,966,537,466130,489,466,100+0.40%
aspnet_block.run.windows.x64.checked.mch29,593,256,92829,714,188,323+0.41%
benchmarks.run.windows.x64.checked.mch36,403,707,50536,537,225,274+0.37%
coreclr_tests.run.windows.x64.checked.mch834,129,922,769836,306,735,426+0.26%
libraries.crossgen2.windows.x64.checked.mch125,404,474,681125,939,377,883+0.43%
libraries.pmi.windows.x64.checked.mch234,065,984,026234,966,452,358+0.38%
libraries_tests.pmi.windows.x64.checked.mch505,444,666,254507,013,785,527+0.31%

MinOpts contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
aspnet.run.windows.x64.checked.mch27,025,661,07127,142,522,855+0.43%
aspnet_block.run.windows.x64.checked.mch7,885,027,9417,915,784,656+0.39%
benchmarks.run.windows.x64.checked.mch481,233,685483,205,624+0.41%
coreclr_tests.run.windows.x64.checked.mch378,542,257,127379,654,270,164+0.29%
libraries.crossgen2.windows.x64.checked.mch1,731,9271,743,192+0.65%
libraries.pmi.windows.x64.checked.mch1,456,977,8261,463,368,396+0.44%
libraries_tests.pmi.windows.x64.checked.mch9,864,046,7119,890,751,588+0.27%

FullOpts contexts:

CollectionBase # instructionsDiff # instructionsPDIFF
aspnet.run.windows.x64.checked.mch102,940,876,395103,346,943,245+0.39%
aspnet_block.run.windows.x64.checked.mch21,708,228,98721,798,403,667+0.42%
benchmarks.run.windows.x64.checked.mch35,922,473,82036,054,019,650+0.37%
coreclr_tests.run.windows.x64.checked.mch455,587,665,642456,652,465,262+0.23%
libraries.crossgen2.windows.x64.checked.mch125,402,742,754125,937,634,691+0.43%
libraries.pmi.windows.x64.checked.mch232,609,006,200233,503,083,962+0.38%
libraries_tests.pmi.windows.x64.checked.mch495,580,619,543497,123,033,939+0.31%

@BruceForstall

Copy link
Copy Markdown
ContributorAuthor

All failures look known or infra

@BruceForstall

Copy link
Copy Markdown
ContributorAuthor

This change was merged into #79544

@BruceForstall
BruceForstall deleted the anthonycanino_avx512-upper-regs-with-reg-accessors branch February 8, 2023 18:56
@ghostghost locked as resolved and limited conversation to collaborators Mar 10, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@BruceForstall@kunalspathak@anthonycanino