Readit News logoReadit News
mwkaufma · 2 months ago
"Assembly is Brutal"

Counterpoint: I picked it up in high school and I was Not That Bright(tm).

Certainly, some complex instruction-set extensions or sprawling SIMD mnemonics are more challenging that what I was reading in the 90s, but the boogie-man status of assembly is greatly overstated.

The final thesis, that we can-and-should let LLMs micro-optimize assembly into non-statically-verifiable gibberish to save an instruction stacks misunderstandings on top of misunderstandings. Just vapid gold-rush cheer-leading from Wired.

antonvs · 2 months ago
Re your counterpoint, learning to write small extremely toy programs in assembly isn’t hard. But using it to write bug-free programs with non-trivial functionality is much more difficult.
bigfishrunning · 2 months ago
Generally, people aren't writing programs with non-trivial functionality in assembly; they're writing very small, hyper optimized functions that get called by some higher level language.

Deleted Comment

Deleted Comment

qalmakka · 2 months ago
Yeah it's all shit and giggles until you need to allocate memory and handle it. Or when you need to use vector instructions or some CPU-specific stuff. Then you start understanding why people call it nightmarish
pjmlp · 2 months ago
I picked it at the age of 11 years old or thereabouts.

Somehow it got fantasized as being hard.

I would go a step further, eventually we might be able to compile directly from high level prompts into Assembly instead of the high level languages like everyone is doing now.

It is the new coming of CASE tools, just needs to mature a bit more, lets see how far this AI cycle goes.

jcranmer · 2 months ago
Programming in assembly isn't hard, it's just incredibly tedious. Doing manual linearization of an expression DAG, or manual register allocation, or manual control-flow layout very rarely adds any extra value compared to what the compiler will do for you.

As for the idea that AI can optimize code better if we give it assembly code, that's called a peephole superoptimizer, and we've known about it for quite some time ([1], which cites the first relevant paper as being from 1987). It's not new, and it's actually been used to improve the peepholes of compilers for quite same time now. The main limiting factor is probably in our ability to prove correctness of the code generated by search algorithms.

[1] https://www.cse.iitm.ac.in/~krishna/courses/2022/odd-cs6013/...

JonChesterfield · 2 months ago
The klever idea of using llms instead of superoptimisers is to drop the correctness requirement. You get some shorter code that does a different thing, maybe it'll still do something you like.
robviren · 2 months ago
I have been playing with the idea of an LLM native programming language focusing on token efficiency, comprehension, and attention. It is interesting to see what the various large models come up with. A common theme actually reminds me quite of bit of assembly. The verb prefixing, limited statements per line, small concept surface area all appeared in multiple conversations across several larger models. The big difference being assembly lacks semantic meaning leaving some benefit on the table. I still cannot believe what some did with the tech, RCT is such a retro favorite.
sylware · 2 months ago
I am coding my own wayland compositor, in rv64 assembly... running on x86_64 with a small interpreter.

I am currently only using the core ISA (no compressed instructions, not even the pseudo instructions), and I use a C preprocessor to avoid to get my code locked on the preprocessor of one assembler.

I started to code assembly when I was a teenager as it is not hard: only uncomfortable. Nowdays, with what seems a real global, no IP locks, ISA, RISC-V, it is very reasonable to write directly assembly, as (real and sane) standard assembly is extremely efficient at fighting planned obsolecence.

general1465 · 2 months ago
How did you validate correctness of your interpreter?
sylware · 2 months ago
I have been using only basic RISC-V core machine instructions: the interpreter is beyond stupid, I did write it directly in x86_64 assembly.
matt_daemon · 2 months ago
I enjoyed assembly programming in uni but haven’t done much since. This take to rewrite everything in it tends to pop up every now and then, and I think the last line sums pretty well why it never actually happens:

“It was probably just his imagination, but the display had been a little laggy, he thought. He’d redo the code if he could, he said. But alas, Sawyer and the machine did not speak the same assembly language.”

Deleted Comment

estimator7292 · 2 months ago
I firmly believe that all programmers, even you, should be forced to program a microcontroller in assembly at least once.

IMO the utter lack of awareness that our abstractions represent a physical machine with real hardware that operates in finite time is why software today is so bad. Our languages are so far removed from the hardware that the CPU and its finite resources simply don't exist for most programmers. Many of the rising generation of engineers have no clue how a CPU works, what a register is, or what the cost of reading and writing to RAM is.

Assembly is not so difficult as to be unapproachable for beginners. Remember, back in the day we all started in assembly and produced a generation of absolutely brilliant engineers and scientists. We all had to understand the physicality of the real machine and we had to make the best we could with very constrained resources.

Deleted Comment

antod · 2 months ago
Does Z80 or 6502 on 8bit computers count?

I'm not a great programmer and don't code full time, but I've done a bit of that 8bit assembler and enjoyed the relatively finite single-focused determinism of it, but I don't know if it has improved my current coding at all.

I suspect doing some Linux systems coding in C might have a bigger effect on connecting the dots between the layers for me.

1718627440 · 2 months ago
> Many of the rising generation of engineers have no clue how a CPU works, what a register is, or what the cost of reading and writing to RAM is.

I am not sure if this is true, given that this is college education and some of the easy part of CS, which is even taught just for fun to (non-CS) engineers.