Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make linux-riscv nativeaot port robust #112736

Open
wants to merge 46 commits into
base: main
Choose a base branch
from

Conversation

am11
Copy link
Member

@am11 am11 commented Feb 20, 2025

Huge thanks to @filipnavara, all smoke tests are passing (except DwarfDump which currently doesn't account for per-architecture stats).

Contributes to #106223. We will run AOT libs tests next.

am11 and others added 30 commits February 15, 2025 22:28
Co-authored-by: Filip Navara <filip.navara@gmail.com>
@risc-vv
Copy link

risc-vv commented Feb 21, 2025

RISC-V Release-CLR-VF2: 9461 / 9537 (99.20%)
=======================
      passed: 9461
      failed: 59
     skipped: 106
      killed: 17
------------------------
  TOTAL libs: 9643
 TOTAL tests: 9643
   REAL time: 2h 5min 49s 598ms
=======================

Release-CLR-VF2.md, Release-CLR-VF2.xml, testclr_output.tar.gz

Build information and commands

GIT: a9a6a47a813606a208d1d860f8027475d2a18065
CI: a8426a46d8575dfcb3b5fec0d7d0b7a7c118d690
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

RISC-V Release-FX-VF2: 633247 / 669869 (94.53%)
=======================
      passed: 633247
      failed: 131
     skipped: 1479
      killed: 36491
------------------------
  TOTAL libs: 258
 TOTAL tests: 671348
   REAL time: 2h 45min 47s 514ms
=======================

Release-FX-VF2.md, Release-FX-VF2.xml, testfx_output.tar.gz

Build information and commands

GIT: a9a6a47a813606a208d1d860f8027475d2a18065
CI: a8426a46d8575dfcb3b5fec0d7d0b7a7c118d690
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

RISC-V Release-CLR-QEMU: 9461 / 9537 (99.20%)
=======================
      passed: 9461
      failed: 59
     skipped: 106
      killed: 17
------------------------
  TOTAL libs: 9643
 TOTAL tests: 9643
   REAL time: 2h 46min 10s 910ms
=======================

Release-CLR-QEMU.md, Release-CLR-QEMU.xml, testclr_output.tar.gz

Build information and commands

GIT: a9a6a47a813606a208d1d860f8027475d2a18065
CI: a8426a46d8575dfcb3b5fec0d7d0b7a7c118d690
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

RISC-V Release-FX-QEMU: 657661 / 687860 (95.61%)
=======================
      passed: 657661
      failed: 327
     skipped: 1453
      killed: 29872
------------------------
  TOTAL libs: 258
 TOTAL tests: 689313
   REAL time: 2h 26min 38s 847ms
=======================

Release-FX-QEMU.md, Release-FX-QEMU.xml, testfx_output.tar.gz

Build information and commands

GIT: a9a6a47a813606a208d1d860f8027475d2a18065
CI: a8426a46d8575dfcb3b5fec0d7d0b7a7c118d690
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

@risc-vv
Copy link

risc-vv commented Feb 21, 2025

RISC-V Release-CLR-VF2: 9461 / 9537 (99.20%)
=======================
      passed: 9461
      failed: 59
     skipped: 106
      killed: 17
------------------------
  TOTAL libs: 9643
 TOTAL tests: 9643
   REAL time: 2h 9min 27s 369ms
=======================

Release-CLR-VF2.md, Release-CLR-VF2.xml, testclr_output.tar.gz

Build information and commands

GIT: 7be7b764494542d81ee117b5d883573d3a7147dd
CI: a8426a46d8575dfcb3b5fec0d7d0b7a7c118d690
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

RISC-V Release-CLR-QEMU: 9461 / 9537 (99.20%)
=======================
      passed: 9461
      failed: 59
     skipped: 106
      killed: 17
------------------------
  TOTAL libs: 9643
 TOTAL tests: 9643
   REAL time: 2h 45min 16s 728ms
=======================

Release-CLR-QEMU.md, Release-CLR-QEMU.xml, testclr_output.tar.gz

Build information and commands

GIT: 7be7b764494542d81ee117b5d883573d3a7147dd
CI: a8426a46d8575dfcb3b5fec0d7d0b7a7c118d690
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

RISC-V Release-FX-VF2: 626100 / 666185 (93.98%)
=======================
      passed: 626100
      failed: 142
     skipped: 1479
      killed: 39943
------------------------
  TOTAL libs: 258
 TOTAL tests: 667664
   REAL time: 2h 40min 54s 990ms
=======================

Release-FX-VF2.md, Release-FX-VF2.xml, testfx_output.tar.gz

Build information and commands

GIT: 7be7b764494542d81ee117b5d883573d3a7147dd
CI: a8426a46d8575dfcb3b5fec0d7d0b7a7c118d690
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

Comment on lines 76 to 77
encoder.EmitADDI(encoder.TargetRegister.Arg3, encoder.TargetRegister.Arg0, -NonGCStaticsNode.GetClassConstructorContextSize(factory.Target));
encoder.EmitLD(encoder.TargetRegister.Arg2, encoder.TargetRegister.Arg3, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
encoder.EmitADDI(encoder.TargetRegister.Arg3, encoder.TargetRegister.Arg0, -NonGCStaticsNode.GetClassConstructorContextSize(factory.Target));
encoder.EmitLD(encoder.TargetRegister.Arg2, encoder.TargetRegister.Arg3, 0);
encoder.EmitLD(encoder.TargetRegister.Arg2, encoder.TargetRegister.Arg0, -NonGCStaticsNode.GetClassConstructorContextSize(factory.Target));

ld can take the same offset, saving one instruction. The address in a3 doesn't look to be read from elsewhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a3 is used on line 82 (to second arg of void EmitMOV(Register regDst, Register regSrc)).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you're right. The EmitMOV could turn into EmitADDI with the same offset, though:) Doesn't matter much either way.

@am11
Copy link
Member Author

am11 commented Feb 21, 2025

I applied latest suggestions and running into sigabort. I haven't debugged it but pushed the patch to a separate branch: am11/runtime@feature/nativeaot/riscv64-port...feature/nativeaot/riscv64-port2

@tomeksowi, can we do it so in this round we focus on correctness and use follow-up PR for further optimizations? This PR is only achieving the next milestone "it passes smoke tests", it's not the final one in the series. We still have ways to go; libs testing (AOT mode), different configuration testing (e.g. release build, workstation vs. server GC etc.).

@tomeksowi
Copy link
Contributor

@tomeksowi, can we do it so in this round we focus on correctness and use follow-up PR for further optimizations?

Agreed.

@filipnavara
Copy link
Member

I applied latest suggestions and running into sigabort.

I get a crash even with the currently applied changes in this PR:

#4  0x0000002aaaea1be2 in RaiseFailFastException (arg1=0x0, arg2=0x0, arg3=1) at /home/ubuntu/runtime/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp:97
#5  0x0000002aaae1c164 in RhpFallbackFailFast () at /home/ubuntu/runtime/src/coreclr/nativeaot/Runtime/EHHelpers.cpp:570
#6  0x0000002aab1a3cc4 in S_P_CoreLib_Internal_Runtime_CompilerHelpers_StartupCodeHelpers__CreateTypeManagers (osModule=<optimized out>, pModuleHeaders=<optimized out>, count=<optimized out>, pClasslibFunctions=<optimized out>, nClasslibFunctions=<optimized out>)
    at /home/ubuntu/runtime/src/coreclr/nativeaot/Common/src/Internal/Runtime/CompilerHelpers/StartupCodeHelpers.cs:115
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

I did a full rebuild of everything to rule out any outdated binaries.

@filipnavara
Copy link
Member

I probably caused that one myself, sorry. Seems like I forgot to save a file in VS Code :-/

@risc-vv
Copy link

risc-vv commented Feb 21, 2025

RISC-V Release-CLR-VF2: 9461 / 9537 (99.20%)
=======================
      passed: 9461
      failed: 59
     skipped: 106
      killed: 17
------------------------
  TOTAL libs: 9643
 TOTAL tests: 9643
   REAL time: 2h 10min 55s 33ms
=======================

Release-CLR-VF2.md, Release-CLR-VF2.xml, testclr_output.tar.gz

Build information and commands

GIT: de257a37b04ada9a8bb14aacaedb575ce85f2682
CI: a8426a46d8575dfcb3b5fec0d7d0b7a7c118d690
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

@am11
Copy link
Member Author

am11 commented Feb 21, 2025

I probably caused that one myself, sorry. Seems like I forgot to save a file in VS Code :-/

No worries, it happened to me as well (especially when web version of VS Code saves automatically while desktop version requires Command+S 🙂).

Do you see anything additional we missed in am11/runtime@feature/nativeaot/riscv64-port...feature/nativeaot/riscv64-port2 (possibly in StackFrameIterator.cpp) which maybe causing the sigabrt?

@filipnavara
Copy link
Member

Do you see anything additional we missed in am11/runtime@feature/nativeaot/riscv64-port...feature/nativeaot/riscv64-port2 (possibly in StackFrameIterator.cpp) which maybe causing the sigabrt?

Yes. #112736 (comment)

@filipnavara
Copy link
Member

filipnavara commented Feb 21, 2025

@am11 I pushed changes addressing all the feedback save for #112736 (comment). Tested on device.

@risc-vv
Copy link

risc-vv commented Feb 21, 2025

2fd845a is being scheduled for building and testing

GIT: 2fd845ad9515d7e1c5d4723580b2a97eba7388f0
REPO: dotnet/runtime
BRANCH: main

@risc-vv
Copy link

risc-vv commented Feb 21, 2025

RISC-V Release-CLR-VF2: 9461 / 9537 (99.20%)
=======================
      passed: 9461
      failed: 59
     skipped: 106
      killed: 17
------------------------
  TOTAL libs: 9643
 TOTAL tests: 9643
   REAL time: 2h 10min 40s 100ms
=======================

Release-CLR-VF2.md, Release-CLR-VF2.xml, testclr_output.tar.gz

Build information and commands

GIT: 21fc86a4b63aaf511fb5fbd6d7301655e597e3c8
CI: a8426a46d8575dfcb3b5fec0d7d0b7a7c118d690
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

RISC-V Release-FX-QEMU: 627597 / 655412 (95.76%)
=======================
      passed: 627597
      failed: 328
     skipped: 1462
      killed: 27487
------------------------
  TOTAL libs: 258
 TOTAL tests: 656874
   REAL time: 2h 26min 46s 569ms
=======================

Release-FX-QEMU.md, Release-FX-QEMU.xml, testfx_output.tar.gz

Build information and commands

GIT: 21fc86a4b63aaf511fb5fbd6d7301655e597e3c8
CI: a8426a46d8575dfcb3b5fec0d7d0b7a7c118d690
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

RISC-V Release-FX-VF2: 622743 / 658502 (94.57%)
=======================
      passed: 622743
      failed: 144
     skipped: 1406
      killed: 35615
------------------------
  TOTAL libs: 258
 TOTAL tests: 659908
   REAL time: 2h 40min 23s 602ms
=======================

Release-FX-VF2.md, Release-FX-VF2.xml, testfx_output.tar.gz

Build information and commands

GIT: 21fc86a4b63aaf511fb5fbd6d7301655e597e3c8
CI: a8426a46d8575dfcb3b5fec0d7d0b7a7c118d690
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

RISC-V Release-CLR-QEMU: 9461 / 9537 (99.20%)
=======================
      passed: 9461
      failed: 59
     skipped: 106
      killed: 17
------------------------
  TOTAL libs: 9643
 TOTAL tests: 9643
   REAL time: 2h 45min 52s 616ms
=======================

Release-CLR-QEMU.md, Release-CLR-QEMU.xml, testclr_output.tar.gz

Build information and commands

GIT: 21fc86a4b63aaf511fb5fbd6d7301655e597e3c8
CI: a8426a46d8575dfcb3b5fec0d7d0b7a7c118d690
REPO: dotnet/runtime
BRANCH: main
CONFIG: Release
LIB_CONFIG: Release

@am11
Copy link
Member Author

am11 commented Feb 21, 2025

Thank you! Tested after a clean build, haven't found any issue. 👍

@risc-vv
Copy link

risc-vv commented Feb 21, 2025

0acb29d is being scheduled for building and testing

GIT: 0acb29dc604205cde6d41e60efcc1b8170764933
REPO: dotnet/runtime
BRANCH: main

Release-build FAILED

buildinfo.json
Cloning into '/godata/pipelines/Release-build/runtime'...
fatal: unable to access 'https://github.com/dotnet/runtime/': Failed to connect to github.com port 443 after 135561 ms: Couldn't connect to server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-riscv Related to the RISC-V architecture area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants