-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add ARMv8.x feature flags #4489
Conversation
This allows selecting the ARMv8.3a feature set via a new Feature flag. We don't (yet) add any specialization to our codegen (beyond what LLVM will do for us under the hood).
I think this needs a bit more tweaking before review. |
So I suspect this is probably ok as-is, but given that it may have overlap with arm64e (see #4490), it probably makes sense to hold off landing it until we have a bit more clarity on that issue. (If anyone urgently needs it before then, speak up.) |
Hi, i am trying to compile AOT generators for ios arm64e architecture. I found this old PR and applied the changes to the latest branch on master (Note: i skipped the changes to It can generate the static libraries successfully:
But the generated library has architecture
Furthermore i checked the Mach header and it shows the wrong cpu subtype. it should be 2 instead of 0 for
I also tried hardcoding the llvm triple in
This does get the correct architecture but it crashes when i run it on ios. What am i missing to be able to generate proper |
@f0enix -- I have updated this PR to be up-to-date with master, but I'm not equipped to debug the arm64e issues, unfortunately (I don't have any iOS devices here, nor will I be able to get any within a week or so, nor do I have enough expertise in iOS development to have confidence in fixing this without a real device at hand). We'd love to get this fixed, though. If anyone out there would like to contribute to fixing this, we'd welcome the help. (Probably worth asking on the Gitter channel as well.) |
@steven-johnson Thanks you for updating the PR. i just tried the latest version and it has same result (the generated static library is Note that i built Halide with apple llvm fork instead of the default llvm because i think they have all the handling of arm64e in there. Was that the right way of doing it or should i be using the default llvm? Other things that i tried:
But when i check the available commands by going directly in the compiled llvm I would like to help but i am very new to Halide and my main area of work is ios app development. I do have a arm64e compatible device to do debugging but for the ARM code generation, i am not sure of how i can help. |
Update: i found this extract from Apple XNU pac doc:
The closing thing i have found to this is the llc
The next thing i tried was to edit the LLVM_Runtime_Linker.cpp#L428 in Halide and forcing it to emit only arm64e: triple = llvm::Triple("arm64e-apple-ios"); This does generate arm64e static libraries but if i try use them it crashes with pointer authentication failure when i run them on my iphone:
For those who do not have an A12+ iPhone, they can test it on ARM macs.
|
I brought this up to date after some recent discussion on #4490 but I have no idea if it's correct or not -- I have no iOS testing setup locally. Tagged @alexreinking somewhat arbitrarily because of some recent macOS/iOS work he's done. |
Update for those coming in late: this PR is intended only to enable support for the ARM v8.x (v8.1a ... v8.9a) architectures. It does not add support for arm64e; that is being worked on separately (see #8330) and is orthogonal to this PR (although arm64e support does imply v8.3a or later). I expect that this PR can land without much drama; the codegen changes it makes are limited to whatever LLVM does for us (there is no attempt at additional specialization yet). |
} | ||
if (target.has_feature(Target::ARMv89a)) { | ||
attrs.emplace_back("+v8.9a"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If target
has been completed at this point, isn't this going to add attrs for everything requested and below? Is LLVM cool with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, good question.
src/CodeGen_ARM.cpp
Outdated
@@ -2482,7 +2541,7 @@ string CodeGen_ARM::mattrs() const { | |||
} | |||
} else { | |||
// TODO: Should Halide's SVE flags be 64-bit only? | |||
// TODO: Sound we ass "-neon" if NoNEON is set? Does this make any sense? | |||
// TODO: Sound we add "-neon" if NoNEON is set? Does this make any sense? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're here, Sound -> Should
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Sound we ass" FTW
PTAL |
Gentle review ping |
This allows selecting the ARMv8.x architectures via a new Feature flag. We don't (yet) add any specialization to our codegen (beyond what LLVM will do for us under the hood).
(Note that we should also add similar feature for v9.x architectures, but that will come in a subsequent PR.)