Skip to content

Ensure inlining in cryptographic functions #4591

@GSPP

Description

@GSPP

As discussed in this comment the inliner currently does not inline some performance critical code in the SHA512 algorithm. I'll reproduce the picture here:

sha512

RotateRight seems like a clear inlining candidate. The sigma* functions less clear but would be beneficial.

Since this is extremely performance critical code I think [MethodImpl(MethodImplOptions.AggressiveInlining)] should be applied as a fix.

I'll also quote an idea to improve the inliner heuristics:

Maybe the heuristics can be tweaked. Just throwing the idea out there: Increase inlining probability when the candidate has no control flow (for some practical definition of control flow). Also increase it if there is at least one constant argument. Also increase it if there is no memory access.

Update: Also increase of there are no allocations, no exception handling and no exceptions raised.

category:cq
theme:inlining
skill-level:expert
cost:large

Metadata

Metadata

Assignees

No one assigned

    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/additionsoptimizationtenet-performancePerformance related issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions