Skip to content

LoongArch: LSX/LASX usage in CoreCLR #113354

Open
@driver1998

Description

@driver1998

I am trying to port CoreCLR to the 2K0300 SoC, a LoongArch SoC with no LSX/LASX support.

From what I can see, SIMD JIT codegen is guarded behind FEATURE_SIMD and is not enabled by default, so that's fine.

But context switching code in PAL uses LASX xvld/xvsd instruction to load/save floating point/vector registers without any checks.

See:

xvld $xr0, $a0, CONTEXT_FPU_OFFSET + 0

This breaks on 2K0300, and I think also the 2K1000 / 2K2000 chips that do have LSX but no LASX.

I partially reverted the change (d74b524) and got a ImageSharp / dotnet-iot sample running on the 2K0300. Will still need to figure out a cleaner way to do it, like checking LSX/LASX support in runtime and use the correct instructions in each senario.

Activity

ghost added
needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
on Mar 11, 2025
changed the title [-]LoongArch LSX/LASX usage in CoreCLR[/-] [+]LoongArch: LSX/LASX usage in CoreCLR[/+] on Mar 11, 2025
added
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
and removed
needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
on Mar 11, 2025
dotnet-policy-service

dotnet-policy-service commented on Mar 11, 2025

@dotnet-policy-service
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

driver1998

driver1998 commented on Mar 11, 2025

@driver1998
Author
shushanhf

shushanhf commented on Mar 11, 2025

@shushanhf
Contributor

See:

xvld $xr0, $a0, CONTEXT_FPU_OFFSET + 0

Thanks, we will check it.

added and removed
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
on Mar 11, 2025
xen0n

xen0n commented on Mar 11, 2025

@xen0n

Yeah, CPU capabilities should be checked upfront by means of HWCAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      LoongArch: LSX/LASX usage in CoreCLR · Issue #113354 · dotnet/runtime