-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Build OpenBLAS 0.3.6 for iOS #2275
Comments
Try adding "AR=ar" to your make command line (the "-ru" is an option for the ar program which creates the .a file). Not sure why this goes wrong though... |
Sorry, my bad. I found my mistake. I forgot to add to
But new problem arised. Now I have those errors:
That's a part of it, but it's basically all the same. I think I saw a fix for that somewhere in Issues list |
Pretty sure it was in the closed ticket #1531 you commented on earlier...though I think I had put in a fix for this bac then (maybe it was affected by later changes) |
#569 I found a fix for that here. But now when I try to build my XCode project with new library, I have those errors: ld: warning: directory not found for option '-L/Users/user/Documents/Work/AlgofaceWork/algoface-ios-209-landmarks-tracker/Algoface-Landmarks-Tracker/tracker/3rdparty/eigen/OpenBLAS_iOS_0.2.21'
Can that be an issue that XCode can't compile assembly files? I think it's pretty significant moment, because I forced XCode to build C versions of functions previously and the library is not fast as I think it should be |
Hard to tell from the partial log (there should have been earlier errors from trying to compile the respective OpenBLAS sources), but the previous reports (e.g. #1531) made it look like xcode only has problems with some of the assembly files. On the other hand, some enhancements have been made since #1531 was last updated (in particular, #1821 brought in more assembly kernels including one for SAXPY) so the situation may have become worse on IOS since it was last tried. |
@martin-frbg are there any suggestions of what should I do? Maybe I can download a clang compiler and compile assembly files with those? I understand that the best solution would be to optimize assembly files just so XCode compiler could compile them, but unfortunately I don't have such experience. |
I thought that I might try older version of XCode. But I highly doubt the older version of compiler will do a better job |
No suggestion at the moment unfortunately - I am still trying to set up an equivalent cross-build on the Travis service for experimenting. As far as I know, the standard compiler in xcode is clang, so if anything one would have to try building with gcc (and the assembler from gnu binutils). |
As far as I'm aware, that XCode's So I will try to intall |
Probably easier to just strip all the "@" from the offending .S files and see what blows up. |
@martin-frbg I noticed that all Sorry, I know almost nothing about Assembler :( |
I removed
Do you have any comments on how it can be fixed in Assembly? |
Sorry, probably that was just a silly suggestion. Not clear to me where the "redefinition" happens (unless the labels are local to the file when the @ is present, and become global ones when not). |
Found a possible explanation (though for an entirely different compiler/assembler):
if this is widely used, wonder why the xcode assembler does not understand it (and what its Apple equivalent would be) |
Just tried to build with
A lot of these errors. I won't provide the full text, it was in issues list too many times now. I'm trying to figure out what this |
As I understand it now, the problem is not exactly the compiler, but the assembler that xcode uses. (I think clang also has an option -integrated-as to use assembler functionality built into it). And from what I found, the "@" is a placeholder that gets replaced by a number whenever the macro is instantiated in the code, so when KERNEL_F1 is used e.g. in KERNEL_F8, the first gets its internal |
@martin-frbg is there an article where I could read about this '@' placeholder? There must be an alternative for that which XCode will read and understand |
Please try adding this parameter to the long CC patamter : |
Hello @brada4! Now my
I ran
|
What I quoted yesterday was from some other compiler manual, but I did not keep the reference. |
If I use And for the record, I'm building |
@martin-frbg thank you for the link. I found out that symbol |
@martin-frbg @brada4 Ok, I think I make some progress. Here's how
Here's how I changed it. @martin-frbg please verify if I understood your advice correctly:
When I try to compile the library with those changes, I get next error. That's the whole error log:
I see that
Error is pretty straight-forward. Compiler can't find What should I do to fix that? Should I create another copy of I understand that I'm solving the problem with an "axe". But this approach I can at least understand at that point :) |
I did the same trick for
What's suspicious to me here is that this macro is used only here in
Now it makes me thinking - how often this Or was it done this way just to keep coding style the same? |
@martin-frbg Here're modified But, when I try to compile the project with new the library I have following errors:
|
Yes your changes look correct (if ugly), but all the other "missing" functions like sdot, caxpy, etc. are also assembler files (dot.S etc, the assignments are in KERNEL.ARMV8) and the xcode assembler probably has some problem with them as well. (There is no @ used in any of them, so the problem must be different - but it should be somewhere in the |
I found a proposed fix here -#569 (comment) . But unfortunately, no luck, functions are still missing. Could you suggest what kind of difference I can find in the |
I had assumed there would be actual error messages from the compilation of those files. But re-reading #569 it could be that the functions just got "wrong" names in the respective object files (and the final library). If OSX has the |
Here's the output of
Also, there's
So, in both cases there's no capital |
Hmm, thats just the locally defined labels. I guess others like "snrm2" do show up with a capital "T" - any underscores on their names ? |
I'm comparing two outputs, one for
I noticed that output for |
No, nothing to do with the problem at hand - in some cases, the same source file is used to build several variants of a function via suitable |
@martin-frbg @ashwinyes guys, I did a little experiment just out of curiosity. I modified
As you can see, I hardcoded PROLOGUE and most importantly, I hard-coded function name. After that I did
I tried to build a project with that Any idea how to debug it? |
REALNAME should be (from common_arm64.h) what the build log shows as ASMNAME on the make command line for sdot_k.o. Did you ever see a warning like "ASMNAME redefined" during the build ? |
No, never. I even checked building log, there's no mention of any redefinition. Well, |
@martin-frbg |
You can run the above command by adding a '-S' option and remove the '-c' and '-o sdot_k.o' to see the assembly output. There will be sdot_k.s file generated. You will need to run it from inside the kernel directory. |
@ashwinyes correct me please if I build a command correctly:
And that's an output:
|
So I guess -S just outputs into stdout if you are giving it for an assembler file instead of C file. Your output has the following. So looks like its replacing appropriately. |
Can |
It could be an issue. You could hard code it in the assembly file and see whether it causes an issue. |
Hmm. He hardcoded it before, and that appeared to work. Perhaps just remove all ; from the (multi-line) definition of PROLOGUE in common_arm64.h |
Tried next thing on
Function is there. It just must be But simply removing If I just remove all
|
I meant to hard code ";" in the assembly file and see whether its not working. You cant remove ";" from the #define , it would cause an error. |
You can try changing PROLOGUE to a macro
|
Tried:
Working. Here's
But apparently, new line really matters. I tried two other options:
Both of them don't work |
@ashwinyes I tried your GAS macro (that is GAS macro, right? :). It looks like this:
AND IT TOTALLY WORKED!!!!!!! :) Library is running like a charm! :) COMPARING RESULTS: I also decided to build @ashwinyes @martin-frbg guys, thank you SO SO MUCH that you've been here all day with me, I really appreciate that! I wouldn't over come all those issues if not your presence here :) |
You can always use Apple Accelerate Framework which is BLAS and consistent between OSX and iOS |
@L1onKing thanks for persevering , getting OpenBLAS built on IOS has come up several times in the past but all the others gave up at a partial solution. @brada4 initial comparison of a generic C build to Accelerate was in #1531, the idea here was to see what speedup could be gained from making the optimized assembly kernels work. |
@brada4 Unfortunately, using Accelerate framework was not an option for me. I needed |
@L1onKing Thanks for the perseverance shown to solve this issue. However you should keep in mind that the iOS ARM64 ABI has certain deviations from the generic ABI (https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html) and the ARM64 assembly implementations in OpenBLAS dont take that into account. So there may be some runtime issues. But I dont see the current assembly implementations being affected by it. Anyways it would be good if you keep that in mind. @martin-frbg
to
i.e changing PROLOGUE from #define to a macro can be used for all arm64 cases I believe. Can this change be pushed after a sanity test? |
@ashwinyes I understand that there's a lot of tinkering involved when it comes to using custom libraries on Mobile OS, considering that it's constantly evolving. But a lot of really good libraries is offering When it comes to performance I'm doing my best to research every option I have, even if it means to go the hard way. |
I intend to create a PR from this tomorrow (which is a public holiday here), I just have other work testing my sanity today. |
I saw your suggestion about using I found this Apple documentation related to Assembly - https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/Assembler/040-Assembler_Directives/asm_directives.html They're using in their examples |
@martin-frbg could you please elaborate on how to use |
Yes, the number changes to the appropriate exponent of 2 (so |
Hello! I'm trying to build Open BLAS
0.3.5
version for iOS. Here's my shell script I'm using for building:When I execute it, I'm happen to have this error:
How can this be fixed? Thanks!
The text was updated successfully, but these errors were encountered: