r/Compilers • • Sep 28 '26

My take on the limitations of existing programming languages.

https://vxlang.org/blog/many-short-tapes.html
12 Upvotes

19 comments sorted by

10

u/baehyunsol Sep 28 '26

Does it mean that the programmers can (or have to) read/write data to L2 cache in your language? I don't think it's a good idea to explicitly control L1/L2 caches.

6

u/adityazero Sep 28 '26

There is no programmable interface to CPU caches (L1/L2) AFAICT, but there are to NUMA nodes and malloc implementations take advantage of that already. In accelerator space it is quite common, and kind of necessary,

5

u/hopeless__programmer Sep 28 '26

I think that's a great idea to control L1 cache. GPU programmers do this all the time to their advantage.

4

u/Gauntlet4933 Sep 28 '26

This is common for ML accelerators. Transfers between on chip and off chip memory are explicit and programmed by the user / compiler not inserted by hardware.

I think controlling caches from software is fine but requires more sophisticated compilers. ML accelerator programs are rather simple compared to logic heavy applications. It’s a lot trickier to program in all the prefetches, branch hints, and caching for those programs.

2

u/Inconstant_Moo Sep 29 '26

I think there must be some words missing from this sentence, I can't parse it.

A host description declares no capacity on purpose: host memory is virtual, and a tensor larger than physical RAM pages rather than failing.

3

u/--predecrement Sep 29 '26

It parses fine for me (if I interpret "pages" as a verb).

1

u/Inconstant_Moo Sep 29 '26

Ah, I don't know what it means as a verb except "uses a pager".

3

u/MCWizardYT Sep 29 '26

In this context, it's referring to memory paging I believe

1

u/--predecrement Sep 30 '26

Hopefully the author's comment has cleared things up. Earlier in the article they had noted the distinction between the assumptions in cpu memory addressing (in this instance the key aspect is the memory address space being unbounded (other than by the "address" size, which is often effectively unbounded)) vs in in other processing units (which have critically important bounds).

I think it's reasonable to say that almost all cpus in use today implement paging, and, partly due to that, almost all software (languages, compilers, applications) assume paging. My guess is that either no other processing units in use do, or almost none.

I note the author added the vital qualification "by default" in their reply to you because clearly someone might want to declare that a particular host (cpu) does not have unbounded memory but rather some specific bound.

0

u/adityazero Sep 29 '26

yeah pages as in virtual memory terminology. sorry for the confusion. A host description is unbounded by default to be compatible with CPU programs. In CPU world, anything larger than certain size gets paged, in GPU/Accelerator world that would be an error.

1

u/CJKay93 Oct 02 '26 edited Oct 02 '26

This isn't your take, this is some sloppy AI's take.

Speak nothing of the fact that this language is supposed to be one level removed from typical abstract machine models, and yet still leans on LLVM.

1

u/adityazero Oct 02 '26

What made you say that this is (sloppy) AI's take? countless research before me have also validated this. Those ideas didn't become popular mostly because people enjoyed writing C and then piling libraries on top of each other.

> Speak nothing of the fact that this language is supposed to be one level removed from typical abstract machine models.

Modern machines are anything but linear Turing tape style. Programming languages haven't evolved significantly to accomodate that notion. Result is things like: `float *f = cudaMalloc`, and then bugs all over the place.

> , and yet still leans on LLVM

LLVM is more expressive than C/C++/Rust. LLVM has notion of addresspace and memory model for example (https://llvm.org/docs/LangRef.html). Not sure why leaning on LLVM/MLIR would be a problem. Vx lowers to MLIR (and then to LLVM) which is even more expressive.

3

u/CJKay93 Oct 03 '26 edited Oct 03 '26

What makes me say it's AI slop..? This write-up and all of the rest of its website. It's just... endless, winding prose which doesn't lead you anywhere, riddled with metaphors that don't explain anything.

This article, for example... "nonlinear Turing tapes"? What on earth does that have to do with programming languages? You can implement the tape in a Turing machine however you like - in the original "PowerPoint is Turing complete" paper, the tape was a row of AutoShapes. It's totally irrelevant to memory topology or how programming languages represent it (if at all).

Turing tape was designed to model a simple computing machine. Vx models what can be computed on a specific machine; the answer depends on sizes and topology.

The first sentence of this is just patently wrong; the Turing machine was designed to model all computing machines simply. The rest of this marketing-speak is totally meaningless - what a real computer can compute obviously depends on the memory available to it.

What you just wrote:

Modern machines are anything but linear Turing tape style. Programming languages haven't evolved significantly to accomodate that notion. Result is things like: float *f = cudaMalloc, and then bugs all over the place.

... it's literally word salad, and the semantics of dynamic memory allocation have nothing to do with the conceptual tape of the Turing machine model.

Back to the article:

The C standard describes a program's meaning in terms of “an abstract machine”, and C++ and Rust follow it. The details differ. The memory is the same in all three: one flat space of bytes, where every object has an address and every address is a number of the same kind.

This is just downright wrong. There's absolutely nothing in any of these languages that dictates that memory must be one flat, linear sequence of bytes, because they have historically had to support systems where that was not the case, e.g. bank-switching MCUs.

On that same point:

LLVM is more expressive than C/C++/Rust. LLVM has notion of addresspace and memory model for example (https://llvm.org/docs/LangRef.html)

... Clang has supported address space attributes for years.

Then moving on to the example, I simply don't see anything that could not be done just as conveniently in C++. As a hypothetical example:

int main() {
    Tensor<float, Shape<256, 256>> host;

    auto tile = transfer<H100, Memory::SMEM>(std::move(host));

    return 0;
}

I see no reason transfer could not reproduce the very same semantics as Vx via intelligent use of const evaluation.

1

u/adityazero Oct 03 '26

First of all, thanks for taking time to review/critique. This is the reason I posted on reddit, to get useful feedback.

> This article, for example... "nonlinear Turing tapes"? What on earth does that have to do with programming languages? You can implement the tape in a Turing machine however you like - in the original "PowerPoint is Turing complete" paper, the tape was a row of AutoShapes. It's totally irrelevant to memory topology or how programming languages represent it (if at all).

Agreed, my argument is about how programming languages represent/allow programming of their abstract machine representation, not about the Turing machine model.

> This is just downright wrong. There's absolutely nothing in any of these languages that dictates that memory must be one flat, linear sequence of bytes, because they have historically had to support systems where that was not the case, e.g. bank-switching MCUs.

How would you model memory hierarchy in C/C++/Rust. For example, for B200 https://github.com/vx-lang/Vx/blob/main/fleet/b200.vx?

> Clang has supported address space attributes for years.

clang is a compiler not a programming language. It is nice of clang to provide address space but it is not properly defined and unmaintained (https://discourse.llvm.org/t/what-are-the-precise-semantics-of-the-address-space-attribute/89752). A call to cudaMalloc or even the device side code has to cast back to a generic `float*` https://godbolt.org/z/r3177PnY7. Later, LLVM backend has to do additional gymnastics to recover the address space https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp#L221

> to the example

This 'library based solution' has been tried before and it did not scale. To the effect that cuBLAS records where a result pointer lives in a runtime mode flag, because the C/C++ type system has nowhere to put it reliably.

Even in the best case (if everyone uses the same discriminant type), this abstraction gets dropped immediately coming out of compiler frontend, so no performance advantage. Moreover, unified memory (where CPU and NPU can access the memory with same set of pointers) will result in API design that will be confusing at best.

> I see no reason transfer could not reproduce the very same semantics 

Please demonstrate this the way Vx can do.

Side note: `std::move` doesn't respect linear/affine typing, rust and zig has better guarantees. So one can incorrectly use the `host` Tensor after the transfer. Vx will give you a compiler error.

1

u/umlcat Sep 28 '26

Think different.

-1

u/Haunting_Swimming_62 Oct 01 '26

Unabashed slop website and repo... people really have no shame these days

1

u/adityazero Oct 02 '26

I'd encourage folks to get over this notion of relating AI and Slop. People use AI for speed not that they can't write it by themselves. As someone who has invented+written+shipped compiler optimizations, I've fully embrased using AI to speed my productivity.

-1

u/Haunting_Swimming_62 Oct 03 '26

Thats what a clanker would say

0

u/adityazero Oct 03 '26

clanker types, I'm the selector. And therefore the work (+all the criticism) are attributed to me.