Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Support Lower to reserve internal register(s) different from targetReg. - #7285

Merged
sivarv merged 1 commit into
dotnet:masterfrom
sivarv:internalReg
Sep 22, 2016
Merged

sivarv merged 1 commit into
dotnet:masterfrom
sivarv:internalReg

Conversation

@sivarv

@sivarv sivarv commented Sep 21, 2016 •

Copy link
Copy Markdown

There are quite a few cases in codegen that need internal registers (float or int). In some cases, lower/codegen need an internal register(s) to be different from target reg. To achieve it lower/codegen reserve two internal registers. The reason is that internal register uses end before the target reg gets defined and hence there is no guarantee that a single internal register requested is different from target reg. Reserving more registers than required in some cases lead to wasting a register.

These code changes are meant to allow lower/codegen to specify if it needs a register different from target reg while reserving internal registers. This is achieved by making Use position of internal register to interfere with Def of target Reg by marking Use position as isDelayRegFree=true.

I have made the Lower/Codegen side changes for xarch. It turns out most of the reg savings are in SIMD codegen paths. I am going to open a git issue for doing lower/codegen side changes for arm64.

Asm Diffs:
Fx assemblies show no diff as expected.
CqPerf - Ray tracer and one method of SharpChess got impacted. Overall 10 bytes of size win.
SIMD tests - some code size wins and some losses due to additional moves that materialized due to register allocation changing. Overall a minor 21 bytes of code size loss across all SIMD tests.

Perf Execution numbers:
Raytracer - improved by 3% (Before: 5911 After: 5717)
SharpChess - execution number within noise and remained the same.

@sivarv

sivarv commented Sep 21, 2016

Copy link
Copy Markdown
Author

@dotnet-bot test Windows_NT jitstress2
@dotnet-bot test Windows_NT jitstressregs1
@dotnet-bot test Windows_NT jitstressregs2
@dotnet-bot test Windows_NT jitstressregs3
@dotnet-bot test Windows_NT jitstressregs4
@dotnet-bot test Windows_NT jitstressregs8
@dotnet-bot test Windows_NT jitstressregs0x10
@dotnet-bot test Windows_NT jitstressregs0x80
@dotnet-bot test Ubuntu jitstress2
@dotnet-bot test Ubuntu jitstressregs1
@dotnet-bot test Ubuntu jitstressregs2
@dotnet-bot test Ubuntu jitstressregs3
@dotnet-bot test Ubuntu jitstressregs4
@dotnet-bot test Ubuntu jitstressregs8
@dotnet-bot test Ubuntu jitstressregs0x10
@dotnet-bot test Ubuntu jitstressregs0x80

@sivarv

sivarv commented Sep 21, 2016

Copy link
Copy Markdown
Author

@dotnet-bot test Windows_NT corefx_baseline
@dotnet-bot test Ubuntu corefx_baseline

@sivarv

sivarv commented Sep 21, 2016

Copy link
Copy Markdown
Author

@RussKeldorph @jashook @adiaaida - For the last 2-3 weeks whenever I invoked Window_NT/Ubuntu corefx_baseline job, it is failing in build stage itself. Is it broken and a known thing?

@michellemcdaniel

Copy link
Copy Markdown

@mmitche Do you know anything about the corefx_baseline jobs?

@sivarv

sivarv commented Sep 21, 2016

Copy link
Copy Markdown
Author

@CarolEidt - Please review this.
CC @dotnet/jit-contrib

@mmitche

mmitche commented Sep 21, 2016

Copy link
Copy Markdown
Member

@adiaaida nope

@sivarv sivarv changed the title [WIP] Support Lower to reserve internal register(s) different from targetReg. Support Lower to reserve internal register(s) different from targetReg. Sep 21, 2016
Comment thread src/jit/nodeinfo.h Outdated
isTgtPref = false;
regOptional = false;
definesAnyRegisters = false;
internalRegDifferentFromTarget = false;

@CarolEidt CarolEidt Sep 21, 2016 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: it might be good to name this isInternalRegDelayFree to highlight its similarity (in both requirement, i.e. that it differ from the target, an in implementation. #Resolved

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done.


In reply to: 79938339 [](ancestors = 79938339)

Comment thread src/jit/lowerxarch.cpp Outdated
}
else
{
// Here we don't need internal reg to be different from targetReg.

@CarolEidt CarolEidt Sep 21, 2016 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: It seems odd to mention this here, since that's the default case. If you feel it is necessary to mention it, I would say "Here we simply need a normal internal register, which must be different from any of the operand's registers, but may be the same as targetReg" #Resolved

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done.


In reply to: 79939132 [](ancestors = 79939132)

Comment thread src/jit/lowerxarch.cpp Outdated
// Non-const No 2 (regCnt and tmpReg for subtracting from sp)
//
// Note: Here we don't need internal register to be different from targetReg
// rather, require it to be different from operand's reg.

@CarolEidt CarolEidt Sep 21, 2016 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please put a "." after "targetReg" and capitalize "Rather". And you might say "Rather, we simply need it to be different from the operand's reg, as usual." #Resolved

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed.


In reply to: 79939432 [](ancestors = 79939432)

Comment thread src/jit/lowerxarch.cpp Outdated
// const and >=PageSize No 2
// Non-const Yes 0
// Non-const No 2
// (x86:tmpREg for sutracting from esp)

@CarolEidt CarolEidt Sep 21, 2016 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

typo: tmpReg #Resolved

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed.


In reply to: 79939533 [](ancestors = 79939533)

@CarolEidt

Copy link
Copy Markdown

:shipit:

@michellemcdaniel

Copy link
Copy Markdown

@dotnet-bot test Windows_NT formatting please
@dotnet-bot test Ubuntu formatting please

@sivarv

sivarv commented Sep 21, 2016

Copy link
Copy Markdown
Author

Formatting changes that @adiaaida checked-in caused caused a conflict in lsra.cpp. Pushed new changes after the merge.

@RussKeldorph

Copy link
Copy Markdown

I'll take a look at the corefx jobs. They've never been completely green, but failures have crept in recently.

@sivarv

sivarv commented Sep 21, 2016

Copy link
Copy Markdown
Author

@erozenfeld, @adiaaida - formatting tool is complaining about ssabuilder.cpp which my PR hasn't touched. Changes to this file were checked-in by @erozenfeld.

@michellemcdaniel

Copy link
Copy Markdown

@sivarv Yep. I have a PR out for that.

@michellemcdaniel

Copy link
Copy Markdown

@dotnet-bot test Windows_NT x64 Formatting please
@dotnet-bot test Ubuntu x64 Formatting please

@sivarv
sivarv merged commit d599d61 into dotnet:master Sep 22, 2016
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
 Support Lower to reserve internal register(s) different from targetReg.

Commit migrated from dotnet/coreclr@d599d61
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants