runtime icon indicating copy to clipboard operation
runtime copied to clipboard

[RyuJIT/ARM32] Lack of GTF_IND_UNALIGNED support

Open hqueue opened this issue 9 years ago • 10 comments

It is reported that there is no support for GTF_IND_UNALIGNED yet in ryujit/arm32 at https://github.com/dotnet/coreclr/pull/11224#issuecomment-297797614.

category:correctness theme:alignment skill-level:intermediate cost:medium

hqueue avatar Apr 28 '17 03:04 hqueue

Any news? @BruceForstall if not, could you assign this issue to me?

BredPet avatar Jan 16 '18 15:01 BredPet

@BredPet Are you looking at this?

BruceForstall avatar Feb 13 '18 00:02 BruceForstall

@BruceForstall @Buyduck is currently working on this.

BredPet avatar Feb 13 '18 08:02 BredPet

@Buyduck Any progress?

BruceForstall avatar Mar 08 '18 21:03 BruceForstall

@BruceForstall sorry, for delay, I was busy with other tasks, but now I am on :S Could you help me a little bit? At first, I can't get '.unaligned' prefix in IL, when I compiling C# code. Even if decompiled UseUnalignedDouble.il from tests and compiled it to IL again - I got no '.unaligned' prefix. At second, as far as I could understand legacy JIT takes into account GTF_IND_UNALIGNED flag only for floats and doubles and RYUJIT already has support of GTF_IND_UNALIGNED for floats and doubles. Why don't we take into account GTF_IND_UNALIGNED for other types or I understand something wrong?

Buyduck avatar Mar 23 '18 09:03 Buyduck

At first, I can't get '.unaligned' prefix in IL, when I compiling C# code.

The C# compiler doesn't generate this prefix, there's no C# construct that needs it. You can use Unsafe.ReadUnaligned/WriteUnaligned methods if you don't want to write IL tests.

mikedn avatar Mar 23 '18 10:03 mikedn

Does anyone know what problem this causes? ARM hardware should already handle 2- and 4-byte misaligned integer loads and stores. There are some odd cases with weird types of memory (normally not user-mode) and specialized instructions like LDM/STM, but the common cases "just work." Unless someone has a real-world repro case where this is going to cause a problem, I'm inclined to push this out of 2.1.

RussKeldorph avatar Mar 28 '18 12:03 RussKeldorph

There are a few uses of Read/WriteUnaligned in the framework but all seem to use integers so if I understand correctly they should already work fine. For example: https://github.com/dotnet/coreclr/blob/master/src/mscorlib/shared/System/Marvin.cs There are also a few uses that involve Vector<T> but they're under if (Vector.IsHardwareAccelerated) so they won't run on ARM32 currently.

mikedn avatar Mar 28 '18 12:03 mikedn

RyuJIT doesn't use LDM/STM or LDRD/STRD at all or at least in situations where they could fault due to misalignment, so I'm pushing this out. I'm keeping it open because I think it may deserve a deeper analysis of whether there are any interesting cases to handle here--either for performance or correctness.

RussKeldorph avatar Mar 28 '18 20:03 RussKeldorph

There is no activity on this from past almost 4 years. Please reopen it with adequate data if we want to address it.

kunalspathak avatar Dec 23 '22 03:12 kunalspathak