Skip to content

JIT: [runtime async] Assertion failed 'isScalableVectorSize(size)' during 'Generate code' #118924

Closed

Description

@jakobbotsch
// Generated by Fuzzlyn v3.3 on 2025-08-20 10:58:52
// Run on Arm64 Linux
// Seed: 1357987998247197787-async,runtimeasync,vectort,vector64,vector128,armadvsimd,armadvsimdarm64,armaes,armarmbase,armarmbasearm64,armcrc32,armcrc32arm64,armdp,armrdm,armrdmarm64,armsha1,armsha256,armsve,armsve2
// Reduced from 80.8 KiB to 0.7 KiB in 00:00:53
// Hits JIT assert for Release with Runtime Async:
// Assertion failed 'isScalableVectorSize(size)' in 'Program:M0()' during 'Generate code' (IL size 98; hash 0xaf50ff37; FullOpts)
// 
//     File: /__w/1/s/src/coreclr/jit/emitarm64sve.cpp Line: 2685
// 
using System.Numerics;
using System.Threading.Tasks;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;

public class Program
{
    public static void Main()
    {
        M0().GetAwaiter().GetResult();
    }

    public static async Task M0()
    {
        for (int lvar0 = -2147483648; lvar0 < -2147483646; lvar0++)
        {
            var vr1 = Vector128.CreateScalar(715424757U).AsVector();
            var vr2 = Vector.Create<uint>(0);
            var vr0 = Sve.Or(vr1, vr2);
            if (1 <= Sve.SaturatingIncrementByActiveElementCount(lvar0, vr0))
            {
                await Task.Yield();
            }
        }
    }
}

Activity

  1. added
    untriaged
    on Aug 20, 2025
  2. added
    area-CodeGen-coreclr
    on Aug 20, 2025
  3. dotnet-policy-service commented on Aug 20, 2025

    @dotnet-policy-service
    Contributor

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

  4. MihuBot commented on Aug 20, 2025

    @MihuBot

    I'm a bot. Here is a possible related and/or duplicate issue (I may be wrong):

  5. added
    arm-sve
    and removed
    untriaged
    on Aug 20, 2025
  6. added this to the 11.0.0 milestone on Aug 20, 2025
  7. self-assigned this
    on Aug 20, 2025
  8. jakobbotsch commented on Aug 21, 2025

    @jakobbotsch
    MemberAuthor

    Attached SPMI collection on fad7576

    E8EAB13B.zip

  9. jakobbotsch commented on Aug 21, 2025

    @jakobbotsch
    MemberAuthor

    This one is similar to #118921 -- we have a TYP_MASK typed STOREIND, created for runtime async because a TYP_MASK local is live across a suspension point:

    Generating: N125 (  3,  2) [000173] -----------                  t173 =    LCL_VAR   ref    V13 rat3          x0 (last use) REG x0
                                                                            ┌──▌  t173   ref    
    Generating: N127 (  5,  5) [000176] -c---------                  t176 = ▌  LEA(b+16) byref  REG NA
    Generating: N129 (  1,  1) [000174] ----------z                  t174 =    LCL_VAR   mask   V09 cse0          p0 (last use) REG p0
                                                                            ┌──▌  t176   byref  
                                                                            ├──▌  t174   mask   
    Generating: N131 (  8,  6) [000177] nA--G------                         ▌  STOREIND  mask   (copy) REG NA
    

    @a74nh @tannergooding what is needed to support TYP_MASK typed STOREIND for arm64?

    I think short term fix may just be to stop CSE from creating mask CSEs across suspension points. But it's possible these mask locals can end up overlapping async calls in other ways than CSE.

  10. a74nh commented on Sep 2, 2025

    @a74nh
    Contributor

    @a74nh @tannergooding what is needed to support TYP_MASK typed STOREIND for arm64?

    I think short term fix may just be to stop CSE from creating mask CSEs across suspension points. But it's possible these mask locals can end up overlapping async calls in other ways than CSE.

    Agreed that if we stop CSE from creating masks, then something else may still trigger this.

    There is a store predicate instruction, so I'm going to have a look see if we can support doing the store (and load). Although there might be an issue as the immediate in the store has to be a multiple of the current vector length

  11. a74nh commented on Sep 2, 2025

    @a74nh
    Contributor

    This doesn't fail for me. Does it need running in a special way? I've copied the code and am running with:

    dotnet build -c release test.csproj
    corerun ./bin/release/net10.0/test.dll
    

    I've tried setting DOTNET_TieredCompilation=0.

    I see that the SVE code gets generated in MoveNext()

  12. jakobbotsch commented on Sep 2, 2025

    @jakobbotsch
    MemberAuthor

    This doesn't fail for me. Does it need running in a special way? I've copied the code and am running with:

    dotnet build -c release test.csproj
    corerun ./bin/release/net10.0/test.dll
    

    I've tried setting DOTNET_TieredCompilation=0.

    I see that the SVE code gets generated in MoveNext()

    You need to build the example above with

        <Features>$(Features);runtime-async=on</Features>
    

    in the csproj, with a new SDK (rc1+). Then you furthermore need to set DOTNET_RuntimeAsync=1 when running the produced assembly.

    Alternatively you can just use the SPMI collection I attached above.

  13. a74nh commented on Sep 2, 2025

    @a74nh
    Contributor

    Alternatively you can just use the SPMI collection I attached above.

    Got it. This gives me the right error now.

  14. locked and limited conversation to collaborators on Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-arm64area-CodeGen-coreclrarm-sveruntime-async

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions