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

Misc. bug: HWCAP2_I8MM defined as 0 instead of real value (1 << 13) #10621

Closed
TianyuLi0 opened this issue Dec 2, 2024 · 2 comments · Fixed by #10646
Closed

Misc. bug: HWCAP2_I8MM defined as 0 instead of real value (1 << 13) #10621

TianyuLi0 opened this issue Dec 2, 2024 · 2 comments · Fixed by #10646
Labels
bug Something isn't working

Comments

@TianyuLi0
Copy link

TianyuLi0 commented Dec 2, 2024

Name and Version

build: 3983 (8841ce3)

Introduced via #9684

Operating systems

No response

Which llama.cpp modules do you know to be affected?

No response

Problem description & steps to reproduce

On Arm CPU with i8mm feature platform.

In ggml.c

default HWCAP2_I8MM as default 0 should be improved.

#if !defined(HWCAP2_I8MM)
#define HWCAP2_I8MM 0
#endif

HWCAP2_I8MM should be defined at following value instead,
#define HWCAP2_I8MM (1 << 13)
Refer to https://github.com/torvalds/linux/blob/master/arch/arm64/include/uapi/asm/hwcap.h#L76C1-L76C31

This lead to ggml_arm_arch_features.has_i8mm initialized as 0 instead of 1 when i8mm present in lscpu's output.

First Bad Commit

No response

Relevant log output

No response

@slaren slaren added bug Something isn't working and removed bug-unconfirmed labels Dec 4, 2024
@slaren
Copy link
Collaborator

slaren commented Dec 4, 2024

I wonder if the intent here was to disable I8MM in this case, since if HWCAP2_I8MM is not already defined it may be because the version of linux being built on is too old. Not sure if I8MM requires OS support, but I imagine it does if it adds new registers. Did you verify that setting it to the correct value fixes your problem?

@TianyuLi0
Copy link
Author

TianyuLi0 commented Dec 4, 2024

I wonder if the intent here was to disable I8MM in this case, since if HWCAP2_I8MM is not already defined it may be because the version of linux being built on is too old. Not sure if I8MM requires OS support, but I imagine it does if it adds new registers. Did you verify that setting it to the correct value fixes your problem?

Yes, the correct value fixes my problem. gemv/gemm go to the optimized kernel instead of the slow reference implementation.

In my case (ubuntu 20.04) the kernel support is there(lspcu shows i8mm) but glibc header asm/hwcap.h is old and HWCAP2_I8MM is not defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants