Jump to content

Possible to use M1 Mac to write/test x86 assembly code?

I'm going to be going back to school for Computer Science, and as I don't currently own a laptop, I figure it's a good opportunity to get something nice for programming. I've been eyeing the M1 MacBook (either the Air or the Pro) for the battery life and performance efficiency, but I also haven't used MacOS in over a decade now

 

At least one of my courses will involve learning x86 assembly, and some other courses will involve game development using C++ and Unreal Engine. I haven't been able to find much info on whether an M1 Mac can be used to effectively write assembly for x86, so I definitely wanna know that before I buy a machine

 

Also, if there are other reasons I should consider a Windows machine over a MacBook for programming, I'd love to know. From what I can tell they're about equal in 95% of use cases, or can be configured enough that the differences don't matter, but I'm also just beginning to learn about all of this.

Link to comment
Share on other sites

Link to post
Share on other sites

On 7/9/2021 at 10:18 PM, Mr. Sandman said:

At least one of my courses will involve learning x86 assembly

Doing real mode asm on qemu should be a non-issue, even on a m1 mac.

 

On 7/9/2021 at 10:18 PM, Mr. Sandman said:

Also, if there are other reasons I should consider a Windows machine over a MacBook for programming

Windows? lol no

Unless you're really focusing on windows desktop apps, C# with visualstudio or gamedev, there's no reason to use windows. Linux may be a better bet, but you should be able to get most stuff working on a mac too.

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

On 7/11/2021 at 5:10 AM, igormp said:

Doing real mode asm on qemu should be a non-issue, even on a m1 mac.

 

Windows? lol no

Unless you're really focusing on windows desktop apps, C# with visualstudio or gamedev, there's no reason to use windows. Linux may be a better bet, but you should be able to get most stuff working on a mac too.

He said he needs to use Unreal game engine in a course, which currently afaik only supports Windows (and linux is already in the pipeline) X86 and IMO Windows X86 emulation inside a virtual machine isn't gonna happen for a while and native windows support isn't coming for a while and that still wouldn't fix windows' horrid X86 emulation support, so I would say an X86 machine would still be the correct choice.

Link to comment
Share on other sites

Link to post
Share on other sites

56 minutes ago, blocked said:

He said he needs to use Unreal game engine in a course, which currently afaik only supports Windows (and linux is already in the pipeline) X86

It works on linux since 2014, and even has official docs on how to install it on linux: https://docs.unrealengine.com/4.26/en-US/SharingAndReleasing/Linux/BeginnerLinuxDeveloper/SettingUpAnUnrealWorkflow/

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

Of course you can, in the same manner you can write android/ios apps for arm cpus on your x86 Mac/desktop computers. 

 

Just get the proper sdks which should bundle everything you need, including the proper cross platform libraries/frameworks as well as compiler that can cross compile for different operating system and CPU instruction set. 

 

For c/c++, stick with stdlib, something crossplatform like qt, and avoid anything operating system specific like syscalls and your program can be ported to every operating system which the compiler can cross compile to. 

 

For interpreted languages like node.js and python, compiler support isn't an issue. It can run on anything that has a native python interpreter but again you need to avoid anything that is operating system specific. 

 

If unity supports development on Mac and its sdk/development tool support porting to different architecture then it is a none issue. You need to look at whatever you are using and see if it supports crossplatform, not what cpu architecture you use. 

 

Edit: if you are actually writing in low level assembly then of course you won't be able to test the code on a computer that runs a different instruction set. You can totally write the assembly code on your own computer with a text editor then just move the file onto your target platform and see if it assembled and run. Heck, if there is an assembler available on your computer that assembles to that platform, you can also get the executable. 

 

However to test it, you will need to actually run it on a physical machine or use an emulator. I remember back in college, I write MIPS assembly on my x86 Linux laptop and it runs/debugs inside an emulator that emulates the mips cpu so again look towards what tool you are using. If you are writing anything higher than assembly, it is as simple as getting a cross compiler, avoid architecture and operating system specific(including avoiding any embedded assembly) and test the code on your native machine before cross compiling for other systems

 

 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

On 7/10/2021 at 11:10 PM, igormp said:

Doing real mode asm on qemu should be a non-issue, even on a m1 mac.

 

Windows? lol no

Unless you're really focusing on windows desktop apps, C# with visualstudio or gamedev, there's no reason to use windows. Linux may be a better bet, but you should be able to get most stuff working on a mac too.

Nearly all the languages (basically, anything not Apple or specialized) runs and be developed fine under Windows.

People buy Macs for development because it is companies that get them for their employees so that the company look "hip and cool", or because they need to setup a specific Linux back-end or uses dockers.... that was... until Docker for Windows became reality, and now you have WSL.

 

Link to comment
Share on other sites

Link to post
Share on other sites

11 hours ago, GoodBytes said:

Nearly all the languages (basically, anything not Apple or specialized) runs and be developed fine under Windows.

People buy Macs for development because it is companies that get them for their employees so that the company look "hip and cool", or because they need to setup a specific Linux back-end or uses dockers.... that was... until Docker for Windows became reality, and now you have WSL.

 

I didn't say it was impossible, but it's far from comfortable, specially since most stuff isn't built with windows in mind.

Docker for windows still relies on a VM underneath (wsl2 now), is slower than a native install and is not as ergonomic. Even silly stuff such as line termination is a pain when you're dealing with windows devs in your codebase.

 

The only devs in my company (~4000 people) that get issued windows machines are the ones that require it for some specific reason. 70% of them use linux based laptops, with the other 20% being macs.

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, igormp said:

I didn't say it was impossible, but it's far from comfortable, specially since most stuff isn't built with windows in mind.

Incorrect. Windows is nearly always in mind. Windows market share is well over justified.
 

8 minutes ago, igormp said:

Docker for windows still relies on a VM underneath (wsl2 now), is slower than a native install and is not as ergonomic. Even silly stuff such as line termination is a pain when you're dealing with windows devs in your codebase.

Incorrect. The kernel of Linux runs under a Tier 1 VM, the rest isn't. It's not a VM in a traditional sense.

Speed is the same. It isn't slower.

As for "ergonomic" I have no idea what you are talking about, but the experience is the same but LESS limiting than on a Mac.

 

Line termination isn't an issue. Doesn't mean Notepad had issues back in the old days that this affects the whole system, forever and ever.

 

 

8 minutes ago, igormp said:

The only devs in my company (~4000 people) that get issued windows machines are the ones that require it for some specific reason. 70% of them use linux based laptops, with the other 20% being macs.

Excellent. All the companies I worked for, small, medium and gigantic (no experience in large), uses 90-99% runs on Windows for development, the rest is a split between Linux based OS and MacOS. Windows + actual VM was the preferred choice until WSL2 came along. The Linux users have many times issues with their systems, especially when they do updates. In the current company, now they refuse to do any updates, beside one guy who wants to do image backups before doing any updates. I mean it is his weekend, he does what he wants.

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, GoodBytes said:

Incorrect. Windows is nearly always in mind. Windows market share is well over justified.

It is always in mind, for end-user applications.

Most of the stuff on github doesn't even mentions windows.

 

2 minutes ago, GoodBytes said:

The kernel of Linux runs under a Tier 1 VM

You mean a type 1 hypervisor?

2 minutes ago, GoodBytes said:

It's not a VM in a traditional sense.

It is, it runs on top of hyper-v (no matter the backend, the wsl2 still uses the hyper-v core, but with less overhead and more tightly integrated).

 

3 minutes ago, GoodBytes said:

Speed is the same. It isn't slower.

It is not, it's slower, specially when it comes to IO. CPU of course there isn't much of a difference (CPU virt extensions et al), but the overhead related to IO makes it so much more painful to use with really high latencies and slower transfer speed.

But don't trust me, have some benchmarks: https://www.phoronix.com/scan.php?page=article&item=windows11-wsl2-preview&num=1

Specially the IO bound tests, such as compiles and git (which is what matters most when you're developing): https://www.phoronix.com/scan.php?page=article&item=windows11-wsl2-preview&num=4

 

6 minutes ago, GoodBytes said:

As for "ergonomic" I have no idea what you are talking about, but the experience is the same but LESS limiting than on a Mac.

That may be subjective or due do the area of work. I do data engineering and ML on embedded, windows is a pain for both. Compiling even the simplest embedded project on windows (I shit you not) takes 3 times as much than on linux or mac.

As for ML, mac is a no go due do the lack of proper nvidia gpu support, and many of the tools simply won't work on windows.

 

10 minutes ago, GoodBytes said:

Excellent. All the companies I worked for, small, medium and gigantic (no experience in large), uses 90-99% runs on Windows for development, the rest is a split between Linux based OS and MacOS. Windows + actual VM was the preferred choice until WSL2 came along. The Linux users have many times issues with their systems, especially when they do updates. In the current company, now they refuse to do any updates, beside one guy who wants to do image backups before doing any updates. I mean it is his weekend, he does what he wants.

Fair enough, anecdotal examples will work for both sides, since all of the companies I've worked for (mostly research, startups and now a 5000+ people one) are mostly linux-based.

 

StackOverflow puts both systems at an equal usage, but that may be skewed due to people only using linux remotely on servers, or windows on their personal PCs.

 

Jetbrains puts Windows at the top, but linux and macos are really close, and I find it weird that most devs use all of the 3 systems at once (2 would've been ok, but 3?).

The part about desktop development is also weird. Windows at the top is expected, but linux trailing that close? I can't think of any explanation for that.

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, igormp said:

You mean a type 1 hypervisor?

Yes, Type 1, sorry, it's the morning for me.
 

Quote

It is, it runs on top of hyper-v (no matter the backend, the wsl2 still uses the hyper-v core, but with less overhead and more tightly integrated).

Yea! Exactly!

 

Quote

It is not, it's slower, specially when it comes to IO. CPU of course there isn't much of a difference (CPU virt extensions et al), but the overhead related to IO makes it so much more painful to use with really high latencies and slower transfer speed.

But don't trust me, have some benchmarks: https://www.phoronix.com/scan.php?page=article&item=windows11-wsl2-preview&num=1

Specially the IO bound tests, such as compiles and git (which is what matters most when you're developing): https://www.phoronix.com/scan.php?page=article&item=windows11-wsl2-preview&num=4

Ok thank you for proving my point! Identical performance.

 

Quote

That may be subjective or due do the area of work. I do data engineering and ML on embedded, windows is a pain for both. Compiling even the simplest embedded project on windows (I shit you not) takes 3 times as much than on linux or mac.

As for ML, mac is a no go due do the lack of proper nvidia gpu support, and many of the tools simply won't work on windows.

Well, if you use WSL2:

https://docs.nvidia.com/cuda/wsl-user-guide/index.html

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, GoodBytes said:

Yea! Exactly!

That's... a regular VM. Not to the likes of virtualbox, but pretty similar to kvm.

 

6 minutes ago, GoodBytes said:

Ok thank you for proving my point! Identical performance.

If you want to ignore the whole point about IO, then sure.

 

8 minutes ago, GoodBytes said:

I've tested it, performance is 20% worse then even a native windows install in the best case scenario (simple mnist network), and up to 3x slower (resnet-50).

And some libraries still won't work whatsoever, such as rapids.

 

If you go through WSL's repo issues and search for CUDA, you'll see that it isn't really an option at the moment.

Another option would be DirectML (which even works for AMD gpus!), but then you'll have to deal with something that's 10x slower.

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

36 minutes ago, igormp said:

That's... a regular VM. Not to the likes of virtualbox, but pretty similar to kvm.

There is a big difference between a Type 1 and Type 2.

Also, memory allocation for WSL2 isn't reserved. Closing a Linux based programs will free up system memory for Windows applications and vise-versa.

 

Quote

If you want to ignore the whole point about IO, then sure.

IO performance is near identical. If you want to start counting small performance differences and acting as they are night and day, that is on you. On actual real life, there is no difference, and those benchmarks shows that. The graph might look away part, but the value points are close enough, that in real world there isn't much of a difference. You are DEVELOPING under Windows, not running your entire infrastructure on it.

 

Also, there is a difference between having your files on Windows and accessing them under WSL2, and having them under Linux... perhaps this is what you are referring, if you are using personal experience? Move them under Linux.

 

Quote

If you go through WSL's repo issues and search for CUDA, you'll see that it isn't really an option at the moment.

Another option would be DirectML (which even works for AMD gpus!), but then you'll have to deal with something that's 10x slower.

I don't do ML to comment. So, I won't comment further. 

But ML is a small subset of software development in this planet. You don't reflect the entire world. The OP is at university, clearly starting his degree. He won't do ML. Assuming he does, the simplistic project he will be working on, WSL2 can handle, and at the very worse, he can dual boot a Windows PC with Linux or use the computer Lab of the university. He won't die for 1 class.

 

You can't ignore the context of the conversation.

Link to comment
Share on other sites

Link to post
Share on other sites

11 minutes ago, GoodBytes said:

There is a big difference between a Type 1 and Type 2.

Yes, I know, but no one was talking about any of that before you brought that up. Both are still VMs, and I compared it to KVM, another VM that you could classify as type 1.

13 minutes ago, GoodBytes said:

Also, memory allocation for WSL2 isn't reserved. Closing a Linux based programs will free up system memory for Windows applications and vise-versa.

What does that bring to the conversation? Dynamic memory allocation isn't new, and even my windows vms under KVM free up system memory to my host.

 

15 minutes ago, GoodBytes said:

IO performance is near identical. If you want to start counting small performance differences and acting as they are night and day, that is on you. On actual real life, there is no difference, and those benchmarks shows that. The graph might look away part, but the value points are close enough, that in real world there isn't much of a difference. You are DEVELOPING under Windows, not running your entire infrastructure on it.

Did you actually check the scales? It's in SECONDS, which means that a project that takes 5 minutes to compile on native linux takes 10 minutes on windows.

Reasonably large projects that take 10~20 minutes (with proper caching and whatnot) would then take 20~40 minutes under wsl. And that's exactly the point where DEVELOPING under windows becomes painful. If you were just running regular CPU intensive stuff as a end user, then there wouldn't be a problem, but that's not the case discussed here.

Also keep in mind that those tests were done on a 5950X, the results on a laptop cpu would be at least 5x worse than that.

 

22 minutes ago, GoodBytes said:

Also, there is a difference between having your files on Windows and accessing them under WSL2, and having them under Linux... perhaps this is what you are referring, if you are using personal experience? Move them under Linux.

Those tests are run entirely under WSL's file system (that's the issue that I'm pointing). God forbid accessing those files from Windows, it'd be slower and bring another new plethora of problems.

 

24 minutes ago, GoodBytes said:

But ML is a small subset of software development in this planet. You don't reflect the entire world. The OP is at university, clearly starting his degree. He won't do ML.

 If their university is somewhat good, he will do ML, and we will do many other things, since the idea of a university is to study and explore a wide amount of topics.

 

28 minutes ago, GoodBytes said:

Assuming he does, the simplistic project he will be working on, WSL2 can handle, and at the very worse, he can dual boot a Windows PC with Linux or use the computer Lab of the university. He won't die for 1 class.

Anything will do for any topic then. The matter is what's more comfortable.

 

28 minutes ago, GoodBytes said:

You can't ignore the context of the conversation.

Maybe you're the one ignoring the context? OP wants to go for a Mac, I said that it should be better than windows for the general case, and mentioned the cases where Windows would be the best option, then you come to try and defend your favorite OS with all your might, mentioning Docker as an excuse that people used to use Macs (which also run docker under a VM, pretty much like windows).

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

41 minutes ago, igormp said:

Yes, I know, but no one was talking about any of that before you brought that up. Both are still VMs, and I compared it to KVM, another VM that you could classify as type 1.

What does that bring to the conversation? Dynamic memory allocation isn't new, and even my windows vms under KVM free up system memory to my host.

 

Did you actually check the scales? It's in SECONDS, which means that a project that takes 5 minutes to compile on native linux takes 10 minutes on windows.

Reasonably large projects that take 10~20 minutes (with proper caching and whatnot) would then take 20~40 minutes under wsl. And that's exactly the point where DEVELOPING under windows becomes painful. If you were just running regular CPU intensive stuff as a end user, then there wouldn't be a problem, but that's not the case discussed here.

Also keep in mind that those tests were done on a 5950X, the results on a laptop cpu would be at least 5x worse than that.

 

Those tests are run entirely under WSL's file system (that's the issue that I'm pointing). God forbid accessing those files from Windows, it'd be slower and bring another new plethora of problems.

 

 If their university is somewhat good, he will do ML, and we will do many other things, since the idea of a university is to study and explore a wide amount of topics.

You are the one that was "lol" on the idea of Windows.

And Windows isn't my favorite OS. None are.

I presented an option where the OP will not have to worry about drivers, or software support. 

ML class will be up to him to choose if he wants to take that case or not. It is his choice, and his choice only.

And again if it somehow is an issue. And no, it won't take ages to compile or process his stuff under WSL as you suggest. It will be at worse a few seconds compared to native Linux, assuming he has all his system in operating order, without any missing drivers (the cost of that could potentially take more time then spreading that extra 1-2 second each time he compiles).

 

41 minutes ago, igormp said:

Anything will do for any topic then. The matter is what's more comfortable.

Yes!

 

41 minutes ago, igormp said:

Maybe you're the one ignoring the context? OP wants to go for a Mac, I said that it should be better than windows for the general case, and mentioned the cases where Windows would be the best option, then you come to try and defend your favorite OS with all your might, mentioning Docker as an excuse that people used to use Macs (which also run docker under a VM, pretty much like windows).

OP was considering a Mac... he didn't say he wanted a Mac. As he states:

"I figure it's a good opportunity to get something nice for programming. I've been eyeing the M1 MacBook (either the Air or the Pro) for the battery life and performance efficiency, but I also haven't used MacOS in over a decade now"

 

As WSL is relatively new, I proposed something that many people don't know about.

He likes it? Great! He doesn't? Great! At least he tried or considered it.

 

Link to comment
Share on other sites

Link to post
Share on other sites

11 minutes ago, GoodBytes said:

You are the one that was "lol" on the idea of Windows.

Yes, I was. Going from OP's original question: "Also, if there are other reasons I should consider a Windows machine over a MacBook for programming", what would you answer, apart from what I've already mentioned?

 

12 minutes ago, GoodBytes said:

And no, it won't take ages to compile or process his stuff under WSL as you suggest.

I didn't suggest it, I gave you proper numbers with tests done by a 3rd party. It's not an opinion, it's a fact that you're trying to ignore.

 

Anyway, our silly discussion won't go anywhere, and we're not helping OP whatsoever. You can answer my initial question in this topic (since I believe it could actually be constructive to OP) or just ignore it, I personally believe there's no point for any of us to go on.

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

11 hours ago, igormp said:

 70% of them use linux based laptops, with the other 20% being macs.

Really? Everyone in my company uses macos even though the applications are deployed in Linux. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×