Somewhat related to the above, what is the differe...
# kotlin-native
m
Somewhat related to the above, what is the difference between
iOSArm64
and
iOSSimulatorArm64
? Could they somehow be merged as the instruction sets are the same? Or are the APIs different somehow?
👀 1
s
From my understanding, the
iOSArm64
is a real device running Arm64 (all devices since… iPhone 5S I think) and the
iOSSimulatorArm64
is for the simulator running on Arm64 computers, the new Macs with M1/M1Pro/M1Max chips.
m
I understand the same that but how is the instruction set or API different between a phone M1 and a Mac M1?
Or does the M1 include newer instructions maybe? In which case, it should more be like
iOSArm64
and
iOSM1
?
s
As far as I know, there isn’t any phone with M1 chip. The A12 chip line is for iPhone and iPad and the M1 line is for computers. They are acquainted but doesn’t seems exactly the same. So this might be the reason. But I’m no chip expert 🙂
m
You're right, the iPhone doesn't have M1, only A12
According to Wikipedia, • A12 is ARMv8.3-A • M1 is ARMv8.4-A
So maybe
iOSSimulatorArm64
can use some of the "8.4" features ?
But all of that is Arm64 still according to Wikipedia
s
Indeed, they are all Arm64 chipsets. Now that’s the limit of my knowledge 😆
k
Apple should ship macbook pro with an A12 and just use it for the simulator. Make everybody's life simpler and more realistic /s
😆 1
I'm kidding sort of, but it would be nice
s
Indeed, that would be pretty nice! A step forward to have the simulator less simulator!
m
I'm still somewhat skeptical that
iOSSimulatorArm64
uses any of the M1-specific instructions
I'd happily have it downgrade to
ARM-v8.3
if that can save minutes of linking time
k
I think you're probably right, but that whole thing is complicated. We just ran into a situation where somebody wanted to build Catalyst apps, but that's 100% not possible with Kotlin/Native at this point.
👀 1
e
afaik the difference is that simulator binaries need to be marked as such (eg os=macos vs ios)
m
Which raises the question of why it needs to be marked... (feeling like a 4 y.o. discovering the world right now 😅 )
e
in the case of macos/iOS ARM, they probably don't. if you manually edit the binary it tends to work: https://bogo.wtf/arm64-to-sim-dylibs.html
👀 1
but in general binary formats embedded the target architecture and os, as there can be differences
e.g. Windows, Linux, and OS X each use a different calling convention on the same x86-32 architecture
m
Interesting, thanks for the link!
h
The M1 based on A13, so there is no big difference from CPU side. In practice, the simulator does not support all modules/sensors, eg AR, gyroscope.
s
I believe they link against different libraries even though the architectures are the same. You don’t strictly need the arm64 simulator slice. On M1 based macs in Xcode, apps can be run directly using the My Mac (Designed for iPad) mode. If you’re using SwiftUI though, you still need to build a simulator target or previews won’t work.
e
the simulator has the ≈same libraries that the devices do
in theory Apple doesn't need to use such a similar ABI on iOS vs iOSSimulator. but on the other hand there's not really any reason for them not to be the ≈same
m
We "just" need jetbrains to build
iOSSimulatorArm64
from
iOSArm64
and then patch it with https://github.com/bogo/arm64-to-sim 🙂
And BOOM, 10min CI time reclaimed!
🎉 1
k
Interesting!
m
That'd be super dirty but looks like that could work...
k
That feels like one of those things that works until it doesn't, and then it's a nightmare, but hey, 10 minutes!
m
Exactly, that'll break any time Apple touches anything in the binary format 😅
That could maybe be made as a third party "use at your own risk" Gradle plugin
h
It would more love to see faster builds than some "hacks", eg parallel c compiling and linking (https://youtrack.jetbrains.com/issue/KT-49385)
💯 1
l
@mbonnin Are you actually considering making such a Gradle plugin?
m
That'd be like project #512 😅
So don't hold your breath ! 🙃