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

volk_cpu.tmpl.c on non-X86 cpus #571

Open
michael-roe opened this issue May 22, 2022 · 2 comments
Open

volk_cpu.tmpl.c on non-X86 cpus #571

michael-roe opened this issue May 22, 2022 · 2 comments

Comments

@michael-roe
Copy link
Contributor

michael-roe commented May 22, 2022

Looking at the code, it treats anything starting with "neon" as an ARM feature, and everything else as x86.

I haven't tried running it yet, but I think this will break when run on any architecture that isn't ARM or X86.

(I am going to upstream some MIPS fixes to cpu_features, and I have several different MIPS workstations to test on. If I have time and I'm feeling brave enough, I might try writing a RISC-V port of CPU features.)

I think we may need a more general mechanism to say which features are part of which architecture.

=======

there's another problem with the code in this file. It assumes that the total number of cpu features, across all architectures, is less than or equal to the number of bits in an int. This is so it can set a bit in an int for each feature. This is not going to scale when volk is ported to more architectures. A bit for each feature of the architecture it's been compiled for would fit. A bit for every feature of every architecture volk has been ported to will eventually not fit.

@jdemel
Copy link
Contributor

jdemel commented Jul 23, 2022

volk/tmpl/volk_cpu.tmpl.c

Lines 101 to 108 in af69c60

unsigned int volk_get_lvarch() {
unsigned int retval = 0;
volk_cpu_init();
%for arch in archs:
retval += volk_cpu.has_${arch.name}() << LV_${arch.name.upper()};
%endfor
return retval;
}

I had a closer look at your second comment. I assume you refer to the volk_get_lvarchfunction. It is only used involk.c`, e.g.

if(!(volk_machines[i]->caps & (~volk_get_lvarch()))) {

It is related to this field:

const unsigned int caps; //capabilities (i.e., archs compiled into this machine, in the volk_get_lvarch format)

Currently, numbers up to 23 are used. This implies that 23 bit are used. It'd be better to start looking for a better solution here.

@jdemel
Copy link
Contributor

jdemel commented Oct 3, 2023

Since we use cpu_features with MIPS etc. now, and things still work, I suggest to close this issue.

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

No branches or pull requests

2 participants