Skip to content

Unroll small loops over Vector<T> elements #6891

@JosephTremoulet

Description

@JosephTremoulet

This is mentioned briefly in #6742, but I'm splitting it out into its own issue to make tracking easier.

Since Vector.Count is not a constant at source level, any (non-intrinsic) aggregation/searching over Vector elements is very likely to be written as a loop using a symbolic index. The codegen for symbolic indexing uses a copy through memory to fetch the element. Since Vector.Count is a constant at JIT time, and is typically small, and the codegen for fixed-offset indexing extracts the elements from the registers without the copy through memory, these loops are excellent candidates for full unroll. This has been seen e.g. in aspnet/KestrelHttpServer#1138

Metadata

Metadata

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsoptimization

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions