-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Compile time constants when cross compiling for Android #1616
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
Comments
Looking closer at the code, if the build is single threaded, even though the constant MAX_CPU_NUMBER is not used, doesn't it make sense to set it to 1 to be explicit? |
I believe MAX_CPU_NUMBER is used to guess a sensible value for NUM_THREADS if that has not been set explicitly. In that sense, using the host system value is probably as good a guess as any. Not sure if setting the unused constant to 1 would really help - it might make sense to collect such tidbits of information on the wiki page that aspires to be the "Developer Manual" however. |
@martin-frbg thanks for the prompt reply. I agree that updating the wiki is a good idea, and I would be happy to help. Let me gain a bit more familiarity and I will try and suggest some sensible changes. That said, in the case of a single threaded build, should MAX_CPU_NUMBER be even defined? |
Oh wow, thanks for the education @martin-frbg #1141 was educational. |
If only I knew how to solve it, probably that whole buffers business needs to be taken out and rewritten. |
@oon3m0oo may have some thoughts on this, since he is also thinking about how to do threading right. |
I am going to close this issue, as this was mostly a query not necessarily a call to action and the relevant work is already happening in the threading related issues. |
I noticed that when building either a single or a multi-threaded build of OpenBLAS for android using the NDK, the build system detects the number of cores my desktop has, and uses that as the constant MAX_CPU_NUMBER. In my case 48!. which is clearly not the case. This happens in Makefile.prebuild by calling getarch.c, which tries to detect the number of cores on the machine that the library is being built upon.
The various cache sizes for the ARM64 platform are hard coded in cpuid_arm64.c. But a large section of these constants are not used for anything
L1_CODE_LINESIZE
L1_CODE_ASSOCIATIVE
L1_DATA_SIZE
L1_DATA_LINESIZE
L1_DATA_ASSOCIATIVE
L2_SIZE
L2_LINESIZE
L2_ASSOCIATIVE
(in fact this seems to be true for X86_64 also)
Are these constants just being declared for completeness so that one day the kernels can use this information as needed? Also are the values actually correct and constant across various ARM64 instantiations?
The text was updated successfully, but these errors were encountered: