-
Notifications
You must be signed in to change notification settings - Fork 322
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
Implement runtime dispatch on riscv64 #838
Comments
The CPU/emulator running the test likely doesn't support V extension 1.0 yet, but we are building with flags that allow the compiler to assume that the CPU does support it. Would anyone like to send a patch to targets.cc (analogous to the AT_HWCAP there), to check whether the V extension is supported? Independently of that, I can help fix the warnings from your build log, thanks for sharing it. |
This may take a bit of back-n-forth as Debian does not offer riscv64 porterbox: So I kindly requested on debian-riscv mailing list to do it for me: will update the progress here. |
PiperOrigin-RevId: 459513304
Sounds good, thanks! |
PiperOrigin-RevId: 459513304
PiperOrigin-RevId: 459513304
PiperOrigin-RevId: 459698464
I was granted access to the following hardware (*), it seems that the instructions is not supported:
(*)
For reference:
|
That's right, we'd have to see v in the list of isa extensions. I see mention of Sifive bullet from 2020, whereas the V spec was ratified only a few months ago. We're testing using Spike or QEMU. |
Just for reference, current debian patch is: |
Nice, I think the bit we want to test is 1 << ('v' - 'a'). |
Lower-case ? Anyway I'll integrate the patch as-is in next upload. |
@jan-wassenberg could you comment on my patch see above. it seems I am missing something:
thje above seems to puts v-extensions in shared logic: |
Yes indeed, you could also write 'V' - 'A' (it is the same). For the patch, we want to also do what was done for Arm (commit). This is a bit harder to see because the patch also included other required fixes, but the key parts we haven't yet added are:
Actually I see in the LLVM headers that RVV currently has the same issue as NEON/SVE: they do not yet support runtime dispatch. An issue has been filed and discussions are ongoing at least for Arm. It's possible that GCC already supports this for RVV like they do for NEON/SVE. If so, you would see in its riscv_vector.h some target attribute in the function definitions, and that is what we want to define HWY_TARGET_STR to. |
I cannot find a file clang seems to offer it: But as you guessed the include file is messed up:
|
Right, silly me... In any case I do not see this integrated upstream: where did you come up with the value ? should we report an issue in linux upstream ( |
Nice, thanks for filing the LLVM issue. |
For HWY_TARGET_STR, this comment suggests that arch=rv64gcv1p0 might be exactly what we want. |
Current WIP in Debian is at: |
|
RDCYCLE used to be in the base ISA but was demoted to an extension which is not yet ratified. Although it will be required for RVA20 profile, at least one board does not support it. We use the compiler macro for checking whether the extension was passed as an march flag. Because this macro is likely not yet defined, this effectively disables RDCYCLE for now. Revisit after the extension has been ratified. PiperOrigin-RevId: 471489968
Thanks for making us aware. This situation is regrettable: an important feature (cycle counter or even timer) has been demoted from the base spec (where it was when I last checked) to an extension, which is not yet ratified. I fail to see how it makes sense to ship a board without something as basic as a timer (nor how this was considered 'optional' in the spec), but both seem to have happened. We will disable it for now and fall back to |
RDCYCLE used to be in the base ISA but was demoted to an extension which is not yet ratified. Although it will be required for RVA20 profile, at least one board does not support it. We use the compiler macro for checking whether the extension was passed as an march flag. Because this macro is likely not yet defined, this effectively disables RDCYCLE for now. Revisit after the extension has been ratified. PiperOrigin-RevId: 471489968
wait, what ? SIGILL is produced on the same actual physical board. I fail to understand why an instruction would suddenly fail to execute depending on the running linux kernel. |
Here is a good looking example: https://github.com/randombit/botan/blob/master/src/lib/utils/os_utils.cpp#L694 I believe we are not ignoring the signal (SIG_IGN), nor are we restarting the offending instruction, because we'd siglongjmp out of trouble. Does that seem reasonable? |
Looks pretty impressive indeed ! So that would solve the first issue, the remaining one is that highway + RVV imply compiling all the sources code with the |
:) Right. I've commented on and subscribed to the issue you filed about that, fingers crossed it will happen soon. Once it does, we can do the SIGILL and then runtime dispatch is ready to go. |
It will not work on processors that lack the V extension until runtime dispatch is implemented: google/highway#838
It will not work on processors that lack the V extension until runtime dispatch is implemented: google/highway#838
|
Use new upstream proposed flag to turn off RVV: google/highway#838
Use new upstream proposed flag to turn off RVV: google/highway#838
PiperOrigin-RevId: 623382838
PiperOrigin-RevId: 623382838
PiperOrigin-RevId: 623382838
PiperOrigin-RevId: 623382838
PiperOrigin-RevId: 623382838
PiperOrigin-RevId: 623586183
PiperOrigin-RevId: 623608015
PiperOrigin-RevId: 623608015
PiperOrigin-RevId: 623615521
PiperOrigin-RevId: 623714267
PiperOrigin-RevId: 623714267
PiperOrigin-RevId: 623714267
PiperOrigin-RevId: 624839569
Hooray, this is at long last done :D |
This is a ticket to track progress on runtime dispatch for riscv64 (followup to issue #818).
For now, unit tests are failing, see Debian/riscv64 buildd:
The text was updated successfully, but these errors were encountered: