Skip to content

Investigate impact of inserted read barriers (.NET 8) #78624

@markples

Description

@markples

Various runtime techniques can make use of read barriers in the code. In this context, we mean some piece of code that executes as part of a read operation and not necessarily the particular kind of memory barrier. Examples include instrumentation and certain kinds of concurrent garbage collection techniques. The concern with read barriers is their impact on throughput since reads are common (and relatively cheap when good cache behavior is achieved). The goal of this work is to measure the impacts of a read barrier in .NET across our available microbenchmarks and real-world code examples. We will implement basic optimizations only to limit the time investment at this point.

Q4 2022

No work

Q1 2023

No work

Remaining 2023

  • JIT inserts calls to a RB helper unconditionally. This enables the following:
    • Codegen benchmarks (“worse than baseline”)
    • Optimized for space (tier 0 / cold code?)
    • Bare minimum from JIT
  • JIT inlines a basic check (whether the RB call is necessary) and calls RB helper. This enables the following:
    • Codegen benchmarks (“baseline”)
    • Space/time comparison with "worse than baseline" - attempt to validate the expected high cost of calls
  • Ensure that RB isn’t blocking other optimizations (e.g., continuing combining two consecutive reads of same location without having the RB code obscure this). Also ensure soundness of optimizations (RBs for two reads can't be combined without also combining reads - similar to not reusing an array length if the array itself is reread from memory).
  • Explore signature of RB helper – what is passed in and returned? What is the register convention?

Unfunded

  • More detailed research into other RB sequences
  • Consider inlining other checks - dependent on particular features that require the RB
  • Complex RB helpers (two reads, array copy, etc.) – use WB for inspiration and/or add these for WBs as well
  • Specialize JIT code within functions to support "burst mode" (e.g., features that can be enabled temporarily at runtime) - idea is to combine checks for multiple RBs into one
  • Specialize whole functions

Metadata

Metadata

Assignees

Labels

User StoryA single user-facing feature. Can be grouped under an epic.area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

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