-
Notifications
You must be signed in to change notification settings - Fork 628
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
arm64 is not a valid aot target. #3688
arm64 is not a valid aot target. #3688
Conversation
can you explain a bit? other people were saying it should be arm64. |
wamrc doesn't appear to have an arm64 target. (Based on calling wamrc --target=help) I can also confirm that my m3 mac is able to run an aarch64.v8 aot with this change. |
how about the default? (without --target option) maybe we can make wamrc normalize it? |
Hm. I get this then:
Which kinda implies that it tried to do that but it aborted. Not sure what the code model thing is about tbh. Didn't see anything about it in the help. |
i agree it's a bit cryptic. it means --size-level. |
While it claimed to create that format based on stdout I still get the same error when trying to load it (after reverting my patch). I think it just plain doesn't exist as a target. Mac is just aarch64 AFAICT. AOT module load failed: invalid target type, expected arm64 but got aarch64v8 |
what's "it"? can you share the exact command line option?
my understanding is: |
Sorry. That wasn't really clear. My findings are that wasm-micro-runtime still says that this file is the wrong target type when loaded. E.g. The file appears to be aarch64 even when produced with the command line underneath.
|
I think I made a mistake in testing. It does indeed load it correctly now like you thought it would. I guess the only problem is that wamrc needs to get another valid --target. I'll see if I can come up with a pr for that. Sorry about the confusion. |
i think the reported problem is still valid because there seems no way to cross-build "arm64" aot module. spacetanuki% ./wamrc --target=arm64 -o aot ~/git/garbage/wasm/hello/hello.wasm
Error: Invalid target. Use --target=help to list all supported targets
spacetanuki% ./wamrc --target=aarch64 -o aot ~/git/garbage/wasm/hello/hello.wasm
Create AoT compiler with:
target: aarch64v8
target cpu:
target triple: aarch64v8-pc-linux-gnu
cpu features:
opt level: 3
size level: 3
output format: AoT file
Compile success, file aot was generated.
spacetanuki% IMO, we should
@eloparco how do you think? (i'm asking you because you made the "use arm64 for apple" change.) |
5ab6af3
to
53cef38
Compare
I guess it maybe was premature to close this pr. @yamt suggestions sound good to me. I've tried to update the patch to implement it that way. Maybe @eloparco could take a look? I have verified that I can do the following now:
|
core/iwasm/aot/aot_loader.c
Outdated
@@ -546,6 +546,12 @@ load_target_info_section(const uint8 *buf, const uint8 *buf_end, | |||
return false; | |||
} | |||
|
|||
#if (defined(__APPLE__) || defined(__MACH__)) && defined(__arm64__) | |||
// for backwards compatibility with previous wamrc aot files |
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.
Could you please use /* .. */
to comment the code like other places? This is C source code, we usually add comment like 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.
And maybe we can remove the macro control (L549)? Just convert target arm64
to aarch64v8
unconditionally?
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.
Agree with both points. Will update.
@Andersbakken I tried to look into the code, if IIUC, what the PR does are: (1) wamrc accepts I added several comments, could you help have a check? Thanks. |
|
53cef38
to
8db55ae
Compare
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.
LGTM
Thanks. I'll add the comment |
Make wamrc normalize "arm64" to "aarch64". Previously the only way to make the "arm64" target was to not specify a target on 64 bit arm-based mac builds. Now arm64 and aarch64 are treated as the same. Make aot_loader accept "aarch64v8" on arm-based apple (as well as accepting legacy "arm64" based aot targets). This also removes __APPLE__ and __MACH__ from the block that defaults size_level to 1 since
8db55ae
to
37a2efe
Compare
Make wamrc normalize "arm64" to "aarch64v8". Previously the only way to make the "arm64" target was to not specify a target on 64 bit arm-based mac builds. Now arm64 and aarch64v8 are treated as the same. Make aot_loader accept "aarch64v8" on arm-based apple (as well as accepting legacy "arm64" based aot targets). This also removes __APPLE__ and __MACH__ from the block that defaults size_level to 1 since it doesn't seem to be supported for aarch64: `LLVM ERROR: Only small, tiny and large code models are allowed on AArch64`
Without this aot files won't load on arm64 builds on mac.