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

LoongArch64 Support #754

Merged
merged 3 commits into from
Nov 18, 2023
Merged

LoongArch64 Support #754

merged 3 commits into from
Nov 18, 2023

Conversation

maoif
Copy link
Contributor

@maoif maoif commented Nov 14, 2023

This pull request adds support for LoongArch64, which is an ISA similar to RISC-V.
The machine type as returned by (machine-type) is [t]la64le, the internal architecture name is loongarch64.

This PR is basically an adaptation of this old PR toward those
new features like unboxed floating points and vfasl.

@mflatt mflatt self-assigned this Nov 15, 2023
@mflatt
Copy link
Contributor

mflatt commented Nov 16, 2023

This is very nicely done! I built (in a qemu-hosted Arch Linux installation) and ran make test-one with no issues. I would like to test a little more, but this looks ready to go. Assuming it's ok, I would rebase, drop the merge commit, and fix the conflict in configure that I recently introduced before trying to merge the PR.

@maoif
Copy link
Contributor Author

maoif commented Nov 17, 2023

This is very nicely done! I built (in a qemu-hosted Arch Linux installation) and ran make test-one with no issues. I would like to test a little more, but this looks ready to go. Assuming it's ok, I would rebase, drop the merge commit, and fix the conflict in configure that I recently introduced before trying to merge the PR.

Thanks.

BTW, I ran the VM using the image here (in my case only 20.3 and 20.4 can boot) and the EFI file here:

qemu-system-loongarch64 \
          -m 8G -M virt -smp 4 \
          -cpu la464-loongarch-cpu \
          -serial stdio \
          -bios QEMU_EFI_8.1.fd \
          -device virtio-gpu-pci \
          -device nec-usb-xhci,id=xhci,addr=0x1b \
          -device usb-tablet,id=tablet,bus=xhci.0,port=1 \
          -device usb-kbd,id=keyboard,bus=xhci.0,port=2 \
          -net nic -net user \
          -nic user,hostfwd=tcp::33334-:22 \
          -hda Loongnix-20.4.cartoon.mini.loongarch64.cn.qcow2

Initial user:password: loongson:Loongson20

Aside from that, maybe we can add some github actions using this project to automate test for non-x86 architectures.
It doesn't support loongarch now so more work needs to be done.

However, I tried using this project on my local branch a while ago and had some test failures that did not
appear when run on qemu and the test time was several times longer.

@mflatt
Copy link
Contributor

mflatt commented Nov 17, 2023

As an extra check, I built on hardware provided by Loongson at https://portal.cfarm.net/, which is about twice as fast a qemu on my machine, and ran more tests there. I found a failure that happens when running 5_6.ms with cp0=t, which is easiest to see this way:

cd tla64le/mats
../../bin/zuo . 5_6.mo cp0=t
grep compiler-internal 5_6.mo

shows

Expected error in mat vector-cas!: "compiler-internal: cas: no match found for (#{t d9q40fxqwbl62hchjs8tny84i-0} zero #[#{L15c:Triv:immediate jczowy6yjfz400ntojb6av7y0-15c-36} 36 536870921] #[#{L15c:Triv:immediate jczowy6yjfz400ntojb6av7y0-15c-36} 36 16] #[#{L15c:Triv:immediate jczowy6yjfz400ntojb6av7y0-15c-36} 36 24])".
Expected error in mat vector-cas!: "compiler-internal: cas: no match found for (#{t d9q40fxqwbl62hchjs8tny84i-1} zero #[#{L15c:Triv:immediate jczowy6yjfz400ntojb6av7y0-15c-36} 36 8796093022217] #[#{L15c:Triv:immediate jczowy6yjfz400ntojb6av7y0-15c-36} 36 16] #[#{L15c:Triv:immediate jczowy6yjfz400ntojb6av7y0-15c-36} 36 24])".

where the expected errors are

Expected error in mat vector-cas!: "vector-cas!: 67108864 is not a valid index for #(4 5 3)".
Expected error in mat vector-cas!: "vector-cas!: 1099511627776 is not a valid index for #(4 5 3)".

@mflatt
Copy link
Contributor

mflatt commented Nov 17, 2023

Interestingly, but maybe not surprisingly, trv64le fails on the same way with that test+configuration.

@maoif
Copy link
Contributor Author

maoif commented Nov 18, 2023

The "compiler-internal" error is fixed in the new commit.

@mflatt mflatt merged commit 0654a2d into cisco:main Nov 18, 2023
12 of 13 checks passed
@mflatt
Copy link
Contributor

mflatt commented Nov 18, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants