Chapter 164: AMD
Reborn in 2010: The AI in My Brain Is Too Powerful! by yangxxxxxx
AMD's headquarters sat in Sunnyvale — just five gray office buildings.
This was actually the normal form for a Silicon Valley company. Not everyone could build a grand headquarters like Oracle's.
Especially not AMD, locked in a love-hate death match with Intel, and never able to beat Nvidia on graphics cards. Money had always been tight; the company simply wasn't in a position to chase outward grandeur.
Chen Yiran had recently visited two very impressive headquarters, so AMD's struck him as almost shabby by comparison. But once he actually walked inside, it didn't feel bad at all.
The one distinctive touch was a row of glass display cases in the lobby, holding chips from the K6 all the way to the newest Bulldozer architecture, lined up in chronological order.
Unlike the hush of Oracle, this place had more life to it. Engineers were constantly moving through the corridors carrying motherboards, graphics cards, and assorted components, and the air sometimes carried an odd mixture of solder and coffee.
Harry, who had been following the project from the beginning, received Chen Yiran together with interim CEO Thomas Seifert. They showed him around, then led him up to the fourth floor.
Chen Yiran didn't need to come in every day — he only had to sync up on process with AMD's people once a week — but AMD had still set him up with an extremely spacious office of more than forty square meters.
The window looked out directly onto a range of low hills. There was a large L-shaped corner desk, a small workstation off to one side, even a dedicated coffee machine, plus a mini fridge stocked full of Coca-Cola.
You could tell someone had put real thought into the setup.
Chen Yiran nodded. "This works. You two go take care of your own business. Send the liaison group in and we'll get started right away."
Harry and Thomas nodded and left. A few moments later, four engineers knocked and came in. The one in front was a Chinese man in his early forties, wearing metal-framed glasses.
"Mr. Chen, I'm Marvin, technical lead for the OpenCL compiler team. These three are Lin, Sunil, and Amy — all from our compiler backend and memory management groups.
There are several more engineers under our group who can pitch in. Shall we get straight to it?"
Chen Yiran nodded. "Sure. Start by telling me what you're thinking."
Nobody bothered moving to a conference room. Marvin hooked a laptop up to the projector on the meeting table and threw an architecture diagram onto the blank wall beside them.
It showed the complete compilation pipeline of AMD's OpenCL runtime: OpenCL C source files parsed by the front end into an intermediate representation, then run through a unified optimizer that converted it into the AMD IL intermediate language, and finally handed to the GPU backend compiler, which mapped IL onto the actual very-long instruction slots.
"This is our current compilation pipeline. Four layers total, roughly sixty-odd thousand lines of C++. The main bottleneck is in the backend, at the VLIW packing stage.
Our GPU uses a very long instruction word architecture. The compiler has to bundle multiple independent instructions into a single execution bundle to fully utilize the stream processing units, but how well that bundling goes depends enormously on the structure of the input code."
Marvin brought up another slide, showing several code fragments marked in red.
"With a reasonably regular compute-intensive kernel, our backend can fill seventy to eighty percent of the instruction slots. But the moment a kernel contains complex branching or non-contiguous global memory access, the fill rate drops below forty percent."
Sunil added, "Our current thinking is a two-step approach. Step one, add a pre-analysis pass for recognizing global memory access patterns. Step two, add a heuristic algorithm inside the VLIW scheduler."
Chen Yiran watched the screen without saying anything right away. In fact he was discussing it with Molly.
| ( >ρ < 」) No wonder AMD can't get anywhere. What on earth is any of this. |
|---|
Seeing that Chen Yiran wasn't jumping in, the four of them went on debating among themselves for quite a while, all looking very pleased with their own ideas.
Chen Yiran finally couldn't take it. He covered his face and asked, "That AMD IL intermediate language layer of yours — did you write it yourselves, or is it carried over from ATI?"
Marvin glanced at Lin. Lin was the only person on the team who had come out of ATI, joining AMD when ATI was acquired.
"It's inherited from the ATI days. We've done several rounds of refactoring, but the skeleton hasn't changed."
"How many opcodes does the intermediate representation have?"
"A little over four hundred."
"How many of those do you actually use now?"
Lin thought about it. "A bit more than half."
Chen Yiran took a sip of his Coke. "Four hundred-plus opcodes, and only two hundred get used. ATI was founded in 1985, if I remember right, and AMD acquired it in 2006. God knows how many years' worth of junk has been piling up in there.
Your compilation pipeline has four layers. Each layer has its own data structures, each layer has its own optimization rules, and every hand-off to the next layer requires a format conversion.
Everything you've described is textbook methodology. But the problem right now isn't the methodology.
It's that the intermediate representation is too bloated. That causes information loss in the inter-layer conversions, so by the time you reach the packing stage the scheduler probably doesn't even have enough dependency information to make an optimal decision.
This is garbage. Let me just rewrite the whole thing from scratch."
The four engineers were more than a little unconvinced, but Chen Yiran's technical authority was overwhelming, and he was rumored to have an extraordinarily broad technical range. None of them dared push back.
Chen Yiran ignored them and kept going. "VLIW packing doesn't have to happen last. If the compiler already knows the dependency relationships and data paths of every instruction at the moment it generates them, it can perfectly well mark which instructions can run in parallel right there at generation time."
Marvin pushed up his glasses. "That's possible. But it means the AMD IL layer has to be torn down."
"Is that a problem?"
Marvin didn't dare answer rashly. He thought for a moment. "I need to escalate this. First of all, if we're really going to do it, our project group is going to need a lot more people. Second, the associated adaptation work could be enormous. I need to escalate — this is a very difficult undertaking."
Chen Yiran nodded. "Go escalate it, then. I'll leave the rest to you. I'm heading home. My dog isn't around, and that hurts my productivity. I'll start working once I'm back."
| (๑•̀ㅂ•́)و✧ Let's go home and get started. Time to show them what real engineering looks like! Give me one week and I'll scare them to death. |
|---|