# Building a Hyper Computer

I had an idea for a theoretical super computer. Supposing, one was able to optimise(or significantly increase efficiency) all algorithms used in most computing tasks(An open source project on algorithm optimisation maybe? The system design is being optimised from the barest tools, the "axioms" of the RAM model(algorithms for file access and basic arithmetic operations will be optimised) all the way to the most complicated algorithms. Supposing one were to then develop a language that implemented these algorithms most effectively and had the best performance with the algorithms(A language was designed for the express purpose of getting the best performance possible out of the algorithms with no constraints based on the target machine). Suppose this was also a high level language like C++.

I hypothesised that one would be able to vastly increase the speed of the system, by designing entirely new architecture to effectively run programs built in this language. A sort of Hardware level compiler(By hardware level compiler, I was referring to architecture design, that can execute the program's source code through native hardware configurations. The hardware is designed for the language and NOT the other way round(which is what I thinks happens in with modern architectures).

An OS built on this language will be much faster on that hardware, but will lose portability. But gain a lot of speed. (I feel the tradeoff is worth it).

I have $3$ questions.

$(1.)$ Is my proposal feasible.

$(2.)$ Is my hypotheses correct.

$(3.)$ What magnitude of speed increases is feasibly possible.

• What makes you think existing architectures are not built to effectively run C++ programs? :) – rici Dec 6 '16 at 23:11
• I don't think they come with hardware level Compiling for C++. It's why we have GCC. :P – Tobi Alafin Dec 6 '16 at 23:27
• But hardware is designed to run well the kind of programs that people write. And the kind of programs that people write are C++ programs, among others. If AMD's CPUs ran C++ programs significantly better than Intel's CPUs do, a way larger segment of the market would move to AMD. – David Richerby Dec 7 '16 at 0:57
• Compiling is irrelevant; a program is compiled once, not even on the machine it eventually runs on, and run many many times. So the cost of compiling is not significant. – rici Dec 7 '16 at 1:05
• Question edited for clarity. – Tobi Alafin Dec 7 '16 at 7:02

You fundamentally misunderstand what a compiler is.

A compiler is just a translator: it transforms programs in one language (usally high level source code) into another language (machine code, assembly, LLVM, JavaScript, etc.)

A compiler can optimize code, and output code specialized for specific hardware, but what's important is, that is completely independent of where the compiler is run.

This means there is literally no difference in the quality of outputted code between a compiler that runs in software, and the same compiler running in hardware. A compiler is just a transformation, and whatever implements that transformation doesn't affect the quality of its output.

1. No, it's not feasible, and it's not even well specified. "Supposing, one was able to optimise(or significantly increase efficiency) all algorithms". What does that even mean? Why do you think such a thing exists?

Likewise, a language might be fast at implementing some algorithms, and slow at others. And a high-level language like C++ will always have some performance tradeoffs compared to expert-written assembly (although optimizers are crazy good at this).

Performance is not an absolute. There isn't necessarily a "most efficient" algorithm for all inputs, and there certainly isn't a "fastest language".

2. Your hypothesis is not correct, for the reasons I said above. Running a compiler on hardware doesn't improve the outputted code.

As for optimizing for specific hardware, this is already possible, and compilers already do this.

3. There's no way to determine this logically. You just have to experiment, especially since speed of code depends heavily on things like cache-misses, pipelining, branch-prediction, etc. These are all hard to reason about on paper.

• Question edited for clarity – Tobi Alafin Dec 7 '16 at 7:03

TL;DR:
Your approach is valid (looking at the question benevolently: What if parts that can be identified to contribute to experienced data processing performance could be significantly improved) - that is what CS is about since at least Bletchley Park and Colossus, if not Babbage.
Your hypotheses have been put forward, and some have been dismissed (along with conclusions like vastly increase the speed). E.g., part of complexity analysis is establishing lower bounds for any algorithm for a given problem (using a specified machine model - RAM for starters, with useful quantum computing hardware feasible RSN). If an algorithm is known to have worst case performance coincide with the lower bound, significance of further improvement is debatable - but see the history of sorting - mechanised radix sorting was popular decades before general purpose computers were created, the topic is hot a century after.
Another part is comparing models of computation (sometimes by types of (abstract) machines, e.g. Turing and RAM), leading to insights like the equivalence of many variants (accumulator, register, stack machines; "von Neumann" and Harvard,…)

There has been concern about a semantic gap between "high level" programming languages and computing hardware - attempts to close it led to the notion of semantic clash.
For ideas, look at FORTH machines (e.g. Novix N4000) and the history of the Intel iAPX 432 (same time frame - coincidence?).

(Another idea is: It takes intelligence and expert knowledge to improve data processing: let's create AI and Expert Systems, set them at improving data processing and lay back to dreams of machines taking over.)

To some extent such machines already exist – FPGA-based supercomputers. FPGAs are programmable hardware which can be tuned to the algorithm being executed.

In a similar vein, GPUs are specialized hardware originally designed for graphics, but now also used in other domains, being much more cost-effective than CPUs for some specific purposes.

In the past, Borroughs produced several CPUs which were optimized for specific languages such as ALGOL 60.