Stephen Shankland/CNET

Designing your own chips is hard. But Tesla, one of the most aggressive developers of autonomous vehicle technology, thinks it's worth it. The company shared details Tuesday about how it fine-tuned the design of its AI chips so two of them are smart enough to power its cars' upcoming "full self-driving" abilities.

Tesla Chief Executive Elon Musk and his colleagues revealed the company's third-generation computing hardware in April. But at the Hot Chips conference Tuesday, chip designers showed how heavy optimizations in Tesla's custom AI chips dramatically boosted performance -- a factor of 21 compared to the earlier Nvidia chips. As a bonus, they're only 80% the cost, too.

The company needed better hardware to achieve its 2019 full self-driving goal, in which cars navigate not only freeways as today but also local streets with stop signs and traffic lights. "It was clear to us, in order to meet our performance levels at the power constraints and the form factor constraints we had, we had to design something of our own," said Ganesh Venkataramanan, one of the chip designers and a former AMD processor engineer.

Now playing: Watch this: Tesla Model S Long Range pulls further ahead of the EV...

It's a major effort to design a processor chip. The magnitude of the work is reflected in the gargantuan number of transistors -- 6 billion -- that make up the processing circuitry on each of Tesla's chips. But Tesla's in-house expertise, spanning everything from processors and software to battery manufacturing and charging stations, gives it a major advantage over conventional automakers.

"Other car manufacturers can't compete," said New Street analyst Pierre Ferragu in an August report on Tesla. "Their business model doesn't allow them to fit all cars with this expensive hardware, and they run vastly behind on technology, depending too much on their suppliers and unable to tightly integrate hardware, software, and operations. As a result, Tesla is setting the standard for mass-market autopilot."

Two brains for self-driving safety

Each Tesla computer has two AI chips, a redundant design for better safety, Venkataramanan said. There's redundancy in the chips' power supplies and data input feeds, too. Even the car's cameras are on two separate power supplies to guard against failures.

"There are a lot of redundancy features, which makes sure ... nothing untoward happens to the system" if a sensor, component, camera or power supply fails, Venkataramanan said.

Each chip makes its own assessment of what the car should do next. The computer compares the two assessments, and if the chips agree, the car takes the action. If the chips disagree, the car just throws away that frame of video data and tries again, Venkataramanan said. That's one of the reasons Tesla wanted powerful AI chips that could handle such a high frame rate for video.

Highly optimized

Each Tesla AI chip runs at 2GHz and performs 36 trillion operations per second. That performance is possible because Tesla optimized the chips for self-driving cars and dropped anything more general purpose, said Debjit Das Sarma, another Tesla chip designer and former AMD engineer.

For example, the chip handles data recorded as 8-bit integers instead of the 16-bit floating-point numbers more common in AI tasks but that require more power to process. For another, it's got an extremely limited set of instructions it can process. And it's got a gargantuan 32 megabytes of high-speed SRAM memory on the chip, which means it doesn't have to wait around while fetching data from much slower conventional DRAM memory.

"Rather than spending all the power on these profligate things, we wanted to spend most of the energy on what really matters for us," Das Sarma said. Although Tesla designed the core AI elements of the processor, it relied on off-the-shelf elements for things like graphics processing.

The AI chip took 14 months to design, and now Samsung is manufacturing the processor. It's shipping in newer Tesla cars now, and older models can be upgraded.