19 comments

[ 0.22 ms ] story [ 351 ms ] thread
(comment deleted)
https://github.com/pacak/cargo-show-asm is a nice helper for the Rust->asm part of this that has seen a decent amount of work for handling all the edge cases. (I've contributed a bit to it to handle some Windows issues.)
Maybe I should say Compiler Explorer instead of Godbolt.

This should be mandatory for any programming environment, along with a CPU emulator showing how data moves through the ALU, and all the ports, to which registers it goes to, and how everything works clock by clock.

I hope AI makes this possible, at least for VS Code and C++.

Yeah there is so much to do on the visualization side! I know people who still draw these things on paper and count cycles by hand.
Paper is a medium of thought, and writing without a computer is still one of the best ways to slow down and organize your mind.

I still write code out on paper as I think through algorithms.

Modern cores are quite wide, I don’t know if my monitor is big enough to show this info for all the in-flight instructions…
When I program, I imagine the registers and ports. Only the ones I use. I see the sequence of micro-ops moving like in a queue, the stack in a different column, and the L1 cache as neighboring lines. That could be drawn.

The parts not involved could be drawn in miniature, like the AVX2 hardware. More detail could be shown if the user clicks.

It probably isn't as complex to draw.

Does that give good results?

I try to push the computations involve in the critical path up as high as possible, and then just hope that between the compiler and hardware somebody’ll take advantage of that.

I haven’t tuned a ton of kernels though, I mostly do linear algebra stuff and good BLAS implementations do better than I could hope to.

uica.uops.info has been down for a long time, but it used to show graphically how many CPU cycles it takes to execute a small piece of code.

Modern x86 CPUs have multiple execution ports, with duplicated hardware for the same operations, and the exact same operation can be performed in different ways.

As a toy example, multiplying a number by 2 can be done using multiplication, a bit shift, addition (adding the value to itself), or the pointer calculator. On x86 CPUs, these instructions can execute simultaneously on different ports, allowing you to perform six or more operations in parallel. This means you can achieve higher throughput by using different implementations of the same operation instead of relying on a single instruction.

You can't leave this to the compiler. It chooses only one implementation, leaving other execution ports unused.

i don't think IHVs would give out the RTL required for this to be possible, and it would also require a ton of compute to simulate it. TDA will be the best you can get reasonably.
genuinely asking, but isn't today the AI writing the code?
I've made this for my hobby projects where I still get to write the code manually. If you are using agentic coding then you don't need neovim to begin with.
It's certainly making the business decisions, at least. It's incredible how many CEOs admit that their decisions came from asking ChatGPT.
Some of the code, some of the time, for some of the people.

Yet far from all of the code, all of the time, for all of the people.

People just like to talk it up, especially if they've been able to let it take over they're own coding. And some people work and chat in bubbles where they only know people working similarly to themselves.

+1 only because of the seemingly non-AI README. Such a joy to get the core info in one glimpse
The whole reason this extension exists is to help me with my non-AI hobby projects like path tracer in C, and my C++ Vulkan renderer.

I don't think this extension is valuable for people who use agents to code.

Tested this on mobile Chrome — loads super fast and the UI is very clean. Nice work!