whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

issue #470 - working 32-bit ARM

Open clach04 opened this issue 2 years ago • 8 comments

clach04 avatar Feb 09 '23 03:02 clach04

Fixes Illegal instruction at runtime.

NOTE not tested on Raspberry. Only on Armbian with OdroixXU4.

Tested with neon fpu flag. Also had success with:

  • -mfpu=neon-fp16
  • -mfpu=neon-vfpv3

clach04 avatar Feb 09 '23 03:02 clach04

We need a way to detect 32-bit ARM in the Makefile and choose the respective flags

That's what this PR does, the original code did not do this. Can you clarify in case I'm missing something?

clach04 avatar Mar 10 '23 14:03 clach04

My Raspberry Pi 4 reports armv7l, but I can use -mfpu=neon-fp-armv8 successfully. It has much better performance compared to the proposed -mfpu=neon.

Does -mfpu=neon-fp-armv8 not work for you?

ggerganov avatar Mar 22 '23 19:03 ggerganov

My Raspberry Pi 4 reports armv7l, but I can use -mfpu=neon-fp-armv8 successfully. It has much better performance compared to the proposed -mfpu=neon.

Ahhh, sounds like you have a 64-bit board but a 32-bit Operating System? Can you confirm?

Does -mfpu=neon-fp-armv8 not work for you?

No it does not, I do NOT have a 64-bit Pi 4, I have an armv7 board with no v8 extensions (see https://forums.raspberrypi.com/viewtopic.php?t=282791 for Pi4 self reporting, it reports as v7 in a 32-bit OS but allows access to v8 instructions). My board is ONLY 32-bit.

New idea/proposal (assuming you have a really have pi4 board with 32-bit OS), in the 32-bit OS (v7) code block we add an additional conditional for detecting a raspberry pi board? Thoughts?

Slightly off topic, you might find moving to a 64-bit OS gains you some extra performance else where for your board, then the makefile would drop into the next "if" check.

clach04 avatar Mar 22 '23 19:03 clach04

Yes, it looks like I am using a 32-bit OS on my 64-bit RPi4. Thanks for clearing this up. It would be very useful to have a branch in the Makefile for my use case, since I don't see mysql upgrading the OS anytime soon. But if there is no clean way to do it, we can merge it like this and I will simply modify the Makefile locally when working on my RPi4

ggerganov avatar Mar 22 '23 20:03 ggerganov

What do you get for:

cat /proc/cpuinfo |grep 'model name'

(| head -1) ?

If you get ARMv7 Processor rev 4 (v7l) (4 or above) that might be the (slightly messy) heuristic that could work 🤞 .

I don't have a Pi4 to check with 😿 This might also work for Pi 3b+ boards too.

clach04 avatar Mar 22 '23 20:03 clach04

$ cat /proc/cpuinfo |grep 'model name'
model name	: ARMv7 Processor rev 3 (v7l)

ggerganov avatar Mar 22 '23 21:03 ggerganov

Hmmm, that completely surprised me. Sadly, I think your idea of a private change is the safest :-( I was really hoping we could automate this nicely.

Alternative idea, mention pi 4 can use v8 extensions in a comment (e.g. the ones that worked for you) so its documented as a potential option?

clach04 avatar Mar 23 '23 02:03 clach04