Skip to content

Sync riscv64/loongarch64 interp impl with arm64 - #137337

Merged
jkotas merged 3 commits into
dotnet:mainfrom
am11:feature/interperter/sync-rv64-la64
Nov 14, 2026
Merged

jkotas merged 3 commits into
dotnet:mainfrom
am11:feature/interperter/sync-rv64-la64

Conversation

@am11

@am11 am11 commented Nov 11, 2026

Copy link
Copy Markdown
Member

With these changes, riscv64 machine passes interpreter tests with mode 1, 2 and 3.

@am11 am11 added arch-loongarch64 arch-riscv Related to the RISC-V architecture labels Nov 11, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Nov 11, 2026
@am11
am11 temporarily deployed to copilot-pat-pool November 11, 2026 10:03 — with GitHub Actions Inactive
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@am11

am11 commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

@shushanhf, FYI, I have only tested on riscv64 machine. To test on LA64 machine, follow Building Tests with Bootstrapping with -tree:JIT/Directed -tree:JIT/interpreter -tree:Interop -tree:async, then on the target run each test with the JIT and under interpreter modes 1 and 3:

B=$(pwd)/artifacts/tests/coreclr/linux.loongarch64.Debug
export CORE_ROOT=$B/Tests/Core_Root DOTNET_TieredCompilation=0

for mode in jit 1 3; do
  for t in $(find $B/JIT $B/Interop $B/async -name '*.sh' | sort); do
    out=$(dirname $t)/out-mode$mode.txt
    (
      cd $(dirname $t)
      # test scripts skip themselves whenever DOTNET_InterpMode is set, even to 0
      if [ $mode = jit ]; then unset DOTNET_InterpMode; else export DOTNET_InterpMode=$mode; fi
      timeout 3600 bash $t > $out 2>&1 < /dev/null
    )
    if grep -q 'END EXECUTION - PASSED' $out; then r=PASS
    elif grep -q 'SKIPPING EXECUTION' $out; then r=SKIP
    else r=FAIL; fi
    echo "$r mode=$mode ${t#$B/}"
  done
done | tee interp-results.txt

Everything is expected to pass; Interop/COM/ComWrappers skips under the interpreter.

@am11

am11 commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

2afa39f was needed for cDAC tests (PR upcoming for RV64/LA64) along with microsoft/clrmd#1527.

@shushanhf

Copy link
Copy Markdown
Contributor

Thanks very much!
I will test it now.

@shushanhf

Copy link
Copy Markdown
Contributor

@shushanhf, FYI, I have only tested on riscv64 machine. To test on LA64 machine, follow Building Tests with Bootstrapping with -tree:JIT/Directed -tree:JIT/interpreter -tree:Interop -tree:async, then on the target run each test with the JIT and under interpreter modes 1 and 3:

B=$(pwd)/artifacts/tests/coreclr/linux.loongarch64.Debug
export CORE_ROOT=$B/Tests/Core_Root DOTNET_TieredCompilation=0

for mode in jit 1 3; do
for t in $(find $B/JIT $B/Interop $B/async -name '*.sh' | sort); do
out=$(dirname $t)/out-mode$mode.txt
(
cd $(dirname $t)
# test scripts skip themselves whenever DOTNET_InterpMode is set, even to 0
if [ $mode = jit ]; then unset DOTNET_InterpMode; else export DOTNET_InterpMode=$mode; fi
timeout 3600 bash $t > $out 2>&1 < /dev/null
)
if grep -q 'END EXECUTION - PASSED' $out; then r=PASS
elif grep -q 'SKIPPING EXECUTION' $out; then r=SKIP
else r=FAIL; fi
echo "$r mode=$mode ${t#$B/}"
done
done | tee interp-results.txt
Everything is expected to pass; Interop/COM/ComWrappers skips under the interpreter.

Passed on LA64.

test_LA64_result.log

@am11

am11 commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

Thanks for testing! :)

@janvorli janvorli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thank you!

@am11

am11 commented Nov 14, 2026

Copy link
Copy Markdown
Member Author

linux_musl-x64 failure is unrelated infra issue Value cannot be null. (Parameter 'ContainerId').

@jkotas

jkotas commented Nov 14, 2026

Copy link
Copy Markdown
Member

/ba-g Intermittent mcr.microsoft.com availability issues

@jkotas
jkotas merged commit 719b32d into dotnet:main Nov 14, 2026
99 of 101 checks passed
@am11
am11 deleted the feature/interperter/sync-rv64-la64 branch November 14, 2026 16:31
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 19, 2026
max-charlamb pushed a commit that referenced this pull request Nov 22, 2026
…37365)

Brings the riscv64/loongarch64 cDAC on par with arm64 and fixes
interpreter stack walking found while running the cDAC stress tests
(`DOTNET_CdacStress=0x101`/`0x201`) on riscv64 hardware.

riscv64/loongarch64:
- `RISCV64Context` was missing `R0`, so every GPR and `Pc` was read 8
bytes off the native `CONTEXT` (all GCREFS stress runs failed).
- Implement RISC-V/LoongArch64 FP struct classification
(`TryGetFpStructInRegistersClassification` in RuntimeTypeSystem,
mirroring `MethodTable::GetFpStructInRegistersInfo`) instead of throwing
`NotImplementedException` from the calling convention.
- Set the first-arg register to the next `InterpreterFrame` in
`InlinedCallFrame` handling, null unwind info check in the unwinders,
and SP register numbers in `ClrDataFrame`.

Interpreter (all architectures):
- Decode interpreted code with the interpreter GC info encoding, with
frame-relative slots and skipping slots in an active callee's frame.
- Report `InterpreterFrame`'s continuation (new `Continuation` data
descriptor field).
- Recognize interpreted funclets (handler/filter ranges of EH clauses)
and compute interpreted caller contexts like
`VirtualUnwindInterpreterCallFrame`, so funclet parents and unwound
frames are skipped as in the runtime.

With these, all cDAC stress debuggees pass on riscv64 in both JIT and
`DOTNET_Interpreter=*` modes, and the cDAC dump tests pass on riscv64
dumps.

Depends on microsoft/clrmd#1527 (for dump tests
on riscv64/loongarch64) and
#137337 (for interpreter on
riscv64/loongarch64).

---------

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-loongarch64 arch-riscv Related to the RISC-V architecture area-CodeGen-Interpreter-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.

4 participants