Skip to content

Optimize vectorized sorting - reduce code size, improve speed for large heaps#40613

Merged
PeterSolMS merged 4 commits intodotnet:masterfrom
PeterSolMS:vxsort-opt
Aug 13, 2020
Merged

Optimize vectorized sorting - reduce code size, improve speed for large heaps#40613
PeterSolMS merged 4 commits intodotnet:masterfrom
PeterSolMS:vxsort-opt

Conversation

@PeterSolMS
Copy link
Copy Markdown
Contributor

There are two optimizations in this PR:

  • reduction of code size in the bitonic sorters: by limiting the amount of inlining in this code, we can reduce overall code size in coreclr.dll by about 180 kB.

  • dynamic packing: during sorting, we can switch to 32-bit sorting as soon as the address range in a partition is less 32 GB. This will only have an impact on large heaps or machines with many processors, because we already have a similar, but static optimization where we use 32-bit sorting if the overall address range in the ephemeral region is less than 32 GB. So this additional optimization will give improvements if the overall address range is greater than 32 GB initially, but becomes less during the sort. In this case, we get about a 1.6x improvement in sorting speed.

cc: @damageboy

@ghost
Copy link
Copy Markdown

ghost commented Aug 10, 2020

Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.

#include <immintrin.h>
//#include <stdexcept>
//#include <limits>
#include <assert.h>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

any reason to keep these 2 lines?

- remove commented out #include lines
- remove unreferenced template specializations for float, double, uint32_t and uint64_t

Mitigated trap with our implementation of numeric_limits - make it so we get a compile error when an instantiation of numeric_limits is referenced that is not specialized.
@PeterSolMS PeterSolMS merged commit 2fd135f into dotnet:master Aug 13, 2020
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
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.

4 participants