Ensure that JIT and other IL compilers preserve order of data dependent memory accesses #79764
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
memory model
issues associated with memory model
Priority:3
Work that is nice to have
Milestone
Re: #75790 (comment)
There is a concern about compiler optimization honoring ordering of data-dependent reads (and writes to object fields to a lesser degree). We expect that from the hardware (for writes we insert fences if needed). The question was whether compiler itself may violate such ordering in some optimizations and whether it is costly to prevent that if it does. I think the concern was mostly about reads as writing has obvious sideeffects, which limits what optimizations can do.
Preliminary conclusion was that compiler honors data dependency because the internal representations are tree-based, but it needs to be confirmed.
If that is the case we need to make it more intentional that compilers avoid invalid optimizations in the future.
If compiler actually violate the order and fixing is not feasible, we may consider adjusting the documentation.
This also applies to Mono LLVM-based codegen.
The text was updated successfully, but these errors were encountered: