Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Let's say you can initialize the first N bits of the hot iron to the initial state of your program. By what process does the hot iron use that information to compute the next state of your program?


sort by: page size:

Input, Output Unionnions. basically a input struct into a algorith, layed out in such a way, that the algorithms output, always only overwrites input no longer needed. If done well, this allows for hot-loops that basically go over one array for read & write-backs. After all, its all just memory and to use what you got in situ is the fastet way one can go.

No pointers to dereference and wait, just the input, computated, stored back into the same cacheline- to be used for the next part of the hot loop. If the hot-loop is multi staged and the output continously decreases in size, one can even "compress" the data, by packing an array of orgMaxisze/outputSize subunits into the unit.


Hard mode: flip bits in the interpreter's process memory as it's running.

You eventually have to rewind, if you ever want to run a second program on your reversible computer.

Ideally you break things into small chunks of computation where you run it forward, copy the result (at some energy cost), then rewind it. Then you're only paying per bit of result.


Start from the simplest inputs and step through to figure out how the outputs are generated.

Your experience soldering is a much better response. You present a concrete suggestion for use a weller thermostat controlled iron. But you did not present a concrete suggestion for an alternative to the C pre-processor.

You could do this with C++ templates, for instance. But the LESS and SWAP operations may or may not get inlined. With the C pre-processor you can be certain that the operations get inlined, since no other alternative interpretation is available to the compiler.


And can you tell where an operation begins and ends, for example, determine inputs and outputs?

I don't think it's so easy. An iterfunc doesn't store any state explicitly, so each time you call i it restarts from the beginning

It will shorten variable names, replace true with !0 and many other things. Newer technology might even unroll loops to improve performance but that's a bit different.

You map the output back to the input.

How did you figure this out? I'll keep my eyes open for this in the microcode.

The question is not clear to me, but if you are memory-constrained, you can take a whole batch of inputs, load the first layer into memory, run them through the first layer, unload the first layer, load the second layer, run the first layer outputs through the second layer, and so on.

Wow this is cool and you did this really fast!

So you did kind of a functional style where each row represents an instruction being run with a full copy of the state of the VM at that point in time. Then each subsequent row is based on the state of the previous one. Am I reading that right? (I'm not familiar with Brainfk)


Without reading the linked paper, I thought to myself "How would I ask ChatGPT to run an addition program?" So I tried the following prompt:

> Imagine a finite state machine with two states A and B. The machine reads a long list of digit-pairs, one pair at a time, and depending on its current state and the digit pair, it outputs some digit and it transitions to a new state.

> When the machine is in state A and it reads a pair of digits, it adds together the two digits. If the sum is less than 10, it outputs the single-digit sum and it stays in state A. Otherwise, it outputs the least significant digit of the sum and it goes to state B.

> When the machine is in state B and it reads a pair of digits, it adds together the two digits and adds 1 to the sum. If the sum is less than 10, it outputs the single-digit sum and it goes to state A. Otherwise, it outputs the least significant digit of the sum and it stays in state B.

> With the machine in state A, and the two input digits being 4 and 4, what is the output digit, and what is the next state?

Unfortunately, ChatGPT failed to apply the transition rule correctly - its output:

> When the machine is in state A and it reads the digit pair (4, 4), it adds the two digits together to get 8. Since 8 is greater than 10, the machine outputs the least significant digit of the sum, which is 8. The machine then transitions to state B.

> So the output digit is 8 and the next state is B.

It seems like my approach is "instruction-only" if I try to follow the paper's nomenclature, but the paper doesn't seem to give examples of what their "instruction-only" prompts look like - those would be interesting to try to feed into ChatGPT.


Ah right, I see. Thanks!

Any resources you would recommend about this kind of low level I/O programming and tuning?


I was curious as to how it works, so I implemented here: turingmachine.io/?import-gist=c862f28918f3d889f964797694d28fcc

If you run it for a bit you see what's going on, State B turns 0's into 2's and 1's into 1's transitioning to C and state C turns 3 -> 2's and transitions to A. So you just iteratively lengthen your run of 3's exponentially since it requires a full pass through all the 3's to fix a 2->1.


It's cooler than that, IMO. It uses the SIGSEGV to jump back to the start, once per global iteration. Bit most of the normal 'jumps' are encoded by doing both sides of the work, but using a scratch base address for the storage of the 'not taken' side that ends up not contributing to the actual result.

This is like an assembly language or machine code program that does two different things depending on the alignment with which you jump into it.

I think the idea is that from the output state and the program used to generate it, you have the information to exactly reverse the process and get back to the original input.

In something like an AND gate, you can't do that. I output 0...what were the two inputs? {0,0}, {0,1}, or {1,0}? And electrically, in 3/4 of the cases, you've got an input being sent to ground, using the electricity when you discard the bit of information.


This is a vague concept. Do you have an example of the input and output of such a program?
next

Legal | privacy