Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ROW::CopyRangeFrom to be vectorized #15267

Merged
merged 1 commit into from
Jun 22, 2023
Merged

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Apr 29, 2023

By rewriting the first major copy loop in CopyRangeFrom to use
pointers/iterators instead of indices for iteration, the autovectorizer
kicks in end neatly rewrites it as an unrolled SIMD loop. This improves
performance during traditional window resizes by roughly 2x and will
be quite helpful in the future for our more complex reflow resize.

Unfortunately, MSVC unrolls the loop by 4x which is too much for our
purpose, but there's no option to change that. It's still better than
not having any vectorization however, since it kicks in at 32 columns.

It also renames the function to CopyTextFrom be more in line with
the others and to avoid confusion, because it doesn't copy attributes.

Validation Steps Performed

  • Traditional resizing works ✅

@lhecker lhecker added Area-Performance Performance-related issue Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) labels Apr 29, 2023
@lhecker lhecker added this to the Terminal v1.19 milestone Apr 29, 2023
@lhecker lhecker marked this pull request as draft April 29, 2023 15:17
@lhecker lhecker force-pushed the dev/lhecker/vectorize-row branch from 928bcb0 to 2c14ae1 Compare June 8, 2023 21:55
@lhecker lhecker marked this pull request as ready for review June 8, 2023 21:56
Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks!

@carlos-zamora carlos-zamora added the Needs-Second It's a PR that needs another sign-off label Jun 10, 2023
@lhecker
Copy link
Member Author

lhecker commented Jun 22, 2023

I've just rebased it on main due to a large number of conflicts. It requires another approval unfortunately. (cc @DHowett)

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Second It's a PR that needs another sign-off label Jun 22, 2023
@DHowett DHowett changed the title Vectorize ROW::CopyRangeFrom Allow ROW::CopyRangeFrom to be vectorized Jun 22, 2023
@DHowett DHowett merged commit e594d97 into main Jun 22, 2023
@DHowett DHowett deleted the dev/lhecker/vectorize-row branch June 22, 2023 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Area-Performance Performance-related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants