web counter
April 19, 2024

Why We’re Building a Classical to Quantum Toolchain

Early computers were special-purpose machines aimed at narrow use cases, a far cry from the computers we use today. Quantum computing is currently in a similar position, dominated by specialists developing standalone quantum algorithms rather than building up tools for broader applications. At Horizon Quantum, we learn from the history of classical computing in order to accelerate the development of a full software stack that will unlock the potential of quantum computers as powerful general-purpose machines.

Quantum Programming

It’s easy to forget that computer scientists didn’t build the world’s first computers.

Computer science didn’t exist as a field in the 1930s and 40s. No one at Bletchley Park had a computer science degree. Alan Turing and William Tutte were mathematicians. Hugh Alexander and Stuart Milner Barry were chess champions. Before they designed ENIAC, John Mauchly worked as a physics professor and J. Presper Eckert as an electrical engineer. John Von Neumann, namesake of Von Neumann architecture, studied chemical engineering and maths and made fundamental contributions to physics, statistics, economics, and the numerous other fields in which he worked.

Mathematicians. Physicists. Code Breakers. Engineers. These are the people who worked on “scientific computing” in its early days. These pioneers aimed to solve specific problems relevant to their specific fields at a specific time. Their interests drove them to build computational hardware. They didn’t necessarily envision broader use cases and applications for the technology.

Today, the field of quantum computing looks very similar to the early days of classical computing. It primarily draws physicists, mathematicians, and engineers. It’s awash with people concerned with and motivated by applications relevant to their fields. Physicists are interested in how quantum computers can simulate condensed-matter systems and field theories. Cryptanalysts see potential for tackling some of the hard computational problems underlying the security of public-key encryption, such as factoring integers or computing discrete logarithms. Mathematicians focus on abstract problems with important mathematical implications, such as those with implications for well-studied computational complexity classes.

Today, the field of quantum computing looks very similar to the early days of classical computing.

The focus on specialised applications doesn't stem from a scarcity of experience with broad applications but rather from the current constraints of the quantum computing landscape. With the limited talent available to develop advanced applications and the industry's eagerness to find a killer app that justifies the investment, companies have gravitated towards more narrow use cases. These lower-hanging fruit are easiest to productise with today's hardware capabilities.

But quantum devices aren’t special-purpose machines — they’re computers. Treating quantum computers as specialised appliances risks underutilising their potential as powerful general-purpose machines.

Today, most of the quantum computing industry is focused on developing standalone quantum algorithms rather than on building up the methods and tools to allow the development of the more complex quantum computer programs that will surely be needed to address many real-world problems.

At Horizon Quantum, we aim to take the lessons learned from the last 70 years of conventional computing and compress them to seven years for quantum computing so that software developers and programmers can take full advantage of the power of quantum computing as it emerges.

The Need for Quantum Software Development Tools

Making quantum computing useful depends on more than perfecting the hardware; it also requires developing the necessary software to address important problems. If tomorrow there were large-scale quantum computers with hundreds of millions of qubits and no errors, their utility would still be modest, and their power would largely be underutilised. 

We don’t yet have the programming tools and languages to develop programs of the sophistication or complexity of modern computer software. Quantum software developers are still piecing together programs logic gate by logic gate. At such a granular level, building complex software or thinking about real-world use cases is practically impossible. Our ability to formulate quantum algorithms is also sorely limited, as is our certainty about when to apply the algorithmic techniques we do know. The quantum algorithms we do have are standalone and cannot necessarily be composed to form more complex algorithms.

Developing quantum algorithms is notoriously hard, largely because they derive their advantage from interference effects, and so they must necessarily take a very different form from the way humans solve problems with pen and paper or on conventional computers.

Quantum algorithms explore many possible routes for getting to an answer. The advantage of quantum computers comes from exploiting quantum interference between these routes to solve problems beyond the limits of conventional computing. Because qubits are capable of exhibiting superposition, quantum computers can explore different possible routes to a solution in superposition and use interference between these to influence the probabilities associates with particular outcomes. Constructive interference increases the probability of a correct answer while destructive interference decreases the probability of an incorrect answer.

Quantum interference is fundamentally antithetical to our everyday experience of the physical world. These features of quantum computing that make it so different from conventional computing are also what makes constructing quantum algorithms so difficult.

To take full advantage of quantum technology, we need to develop tools that allow programmers to take advantage of how quantum computers perform computations without requiring them to write quantum algorithms. If we don’t start building these tools now, then we’ll still have a long road to useful quantum applications even after we have perfect quantum hardware. 

Using Classical Languages to Program Quantum Computers 

The widespread adoption of the technology and the development of new use cases depend on how domain experts in the fields quantum computing is set to impact — who do not necessarily have knowledge of quantum mechanics — can use quantum computers. They should be able to focus on writing programs that manipulate and interact with data in the method best suited for achieving a specific task.

When using quantum computers, programmers should be able to focus on what they want the device to do rather than how they want the device to do it. 

The challenge is that most developers or domain experts might not know quantum mechanics, and the current methods of programming and using quantum computers require this knowledge. They are, however, already skilled at using conventional programming languages.

Horizon Quantum is building tools that accelerate conventional code using quantum computing. The quantum computer won’t solve the problem as laid out in conventional code: our tool reorganises it into a form more amenable to quantum speedup. Our approach is to untangle the loops and recursive function calls that dominate the run time of conventional programs and replace them with structures that take advantage of quantum interference.

The quantum computer won’t solve the problem as laid out in the conventional code: our tool reorganises it into a form that is more amenable to quantum speedup.

We restructure the code and break it down into simpler elements. We analyse the code to determine the specific task that each element is performing and replace them with quantum subroutines that do the same thing but in a more efficient manner. The resulting quantum algorithm solves the same problem and behaves the same way as the classical code but takes advantage of quantum interference to accelerate computation. We pass this quantum program through our compiler chain to obtain a processor-optimised implementation, which can then be deployed as an API for easy integration with other technologies.

A Classical to Quantum Toolchain

Our plan is to build a full classical to quantum toolchain, spanning the gap between classical code and deployed quantum application. We are approaching this by building a compiler chain which allows users to code at varying levels of abstraction depending on their needs.

The lowest level of abstraction is the Hardware level, which is aimed at users who want target specific processors with fine-grain control over the quantum program. Each quantum computer has its own specific peculiarities and constraints, such as the number of qubits, connectivity between those qubits, and native operations, and so code written at this level isn’t portable because it is customised for the target processor.

Hydrogen is the next level of abstraction, and allows users to write low-level architecture-agnostic code. Our compiler performs gate synthesis at the Hydrogen level and optimises the program to fit the topology of the intended quantum processor by doing qubit routing. Users are not restricted to the gate set specific to any particular quantum processor. When coding, they can work with whichever quantum operations they want, by giving a description of these operations. After the user writes the program, Horizon Quantum’s compiler will map it to the hardware topology and instruction set for the target processor and export it into the appropriate framework for the device.

Above Hydrogen is Helium. Helium shares the same basic instruction form as Hydrogen, but offers control structures similar to BASIC. Users can write loops and call subroutines within a pure quantum language, while benefitting from the ability to perform concurrent classical computation. We’ve also included the ability to include subroutines written in the C and C++ programming languages, which are automatically converted by the compiler to efficient quantum circuits.

The Hardware, Hydrogen and Helium levels are integrated in our web-based integrated development environment, Triple Alpha, which offers unprecedented capabilities for programming quantum computers: control flow, subroutines from C/C++ and code portability for any quantum computer.

Further up the ladder will be Beryllium, the algorithm-focused level, intended for quantum programming with a high level of abstraction. At this level, the compiler provides full quantum control with support for data structures, functions, and classes. The object-oriented nature of Beryllium makes it possible for users to focus on high-level operations on data rather than focusing on the details of how it is represented. The user still needs to instruct the computer by defining the quantum operations they want to perform, but they don’t have to define the rules for manipulation repeatedly or re-specify the instructions at each stage.

At the top of the ladder, there’s Carbon. The user can write in a classical programming language such as C or MATLAB  and does not need to have quantum expertise to run their program on a quantum computer. The Carbon compiler, which is currently in development, will take classical code and automatically restructure it, breaking it down to its elementary building blocks that are more amenable to quantum acceleration. By replacing control structures and data structures with more efficient quantum primitives, a quantum algorithm having the same effect as the original classical code can be produced. In this manner, we accelerate the code when it is possible to do so and producing a high-level description of a quantum program. This program can be compiled through the lower layers of abstraction to result in efficient processor-optimised code, ready for execution.

Beryllium and Carbon are currently in development and will be added to Triple Alpha as they become available.

Matching our Tools with User Needs

The level of abstraction and type of tool required depends on the needs of the user. 

Conventional software engineers, quantum computing researchers, hardware manufacturers– each specific type of user will operate on a different level of abstraction, and Horizon Quantum enables users to work at whichever level of abstraction is best suited for their tasks. 

  • Hydrogen: The ideal level for users interested in writing programs with very fine-grain control, implementing applications on hardware, or conducting physics experiments. By abstracting away the hardware constraints, users can use this level to try out different schemes for mitigating errors, study noise in particular processors, write calibration routines, and more.
  • Helium: This level is well-suited for users focused on error correction or building quantum algorithms. At this level of abstraction, users don’t have to worry about how to implement classical functions as reversible circuits or other gate-level issues. 
  • Beryllium: This level is a good fit for users focused on developing and implementing quantum algorithms. The user can program in a manner similar to using an object-oriented programming language. 
  • Carbon: This level is for software developers who want to harness the power of quantum computing while using a programming language they’re familiar with. It abstracts away the quantum mechanics so that users don’t have to understand quantum mechanics or know how the calculations are performed on the hardware.

The Future of Quantum Computing

Billions of people use computers today, but most of them don’t know the details of how those computers are constructed.

In the early days of conventional computing, mathematicians who were using and programming computers had to understand how to build hardware. Seventy years later, the professionals writing code no longer need that knowledge to do their jobs effectively.

There are still computer engineers who need to understand how silicon and phosphorus interact– but it’s a relatively small number of people. There are a greater number of hardware engineers who need to know how to build a processor, and there are even more software developers who need to know how to build programs that run on those processors. However, these software developers don’t need to know how transistors work to be able to write programs that allow computers to solve problems effectively.

For quantum computing to become a widespread technology in the way that conventional computing has become, software developers must be able to exploit the power of the technology without needing to understand how the hardware works. 

If we begin treating quantum computers like computers rather than special-purpose devices and act on the lessons learned from seven decades of building and programming conventional computers, then quantum computing will be able to address a broad range of problems. If not, we risk wasting the revolutionary potential of quantum computers by sidelining their use to highly specialised fields for decades longer than necessary.  

By creating tools that help software developers take advantage of quantum hardware, we can accelerate the timeline for quantum computing adoption. 

Related articles

View all