Skip to content

GetCurrentProcessorId may cause non-deterministic asm diffs #71723

Open
@aromaa

Description

@aromaa

When running tools like jit-diff to compare the generated assembly its important that the JIT is able to output deterministic results. However, the current implementation of the GetCurrentProcessorId on CoreCLR checks for s_isProcessorNumberReallyFast which is assigned based on the return value of a ProcessorNumberSpeedCheck method.

Due to how the returned value is determined, it may cause fluctuation on which underlying implementation is used even on same machine. Because the GetCurrentProcessorId is inlined, its not as obvious what caused the codegen changes.

It was attempted to fix this using reflection in dotnet/jitutils#255 but was reverted in dotnet/jitutils#272 due to using reflection hole in the init-only static variables. The fix would require changes in framework code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions