frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Are compilers deterministic?

https://blog.onepatchdown.net/2026/02/22/are-compilers-deterministic-nerd-version/
34•fragmede•2h ago

Comments

cyanydeez•1h ago
tl;dr: In the universe of chaos, the definition of deterministic is different than thehuman universe. Since the human can't control/measure every variable, it's not deterministic.
measurablefunc•1h ago
Compilers preserve semantics. That is part of their contract. Whether the output has instructions in one order or another does not matter as long as the output is observationally/functionally equivalent. Article does not do a good job of actually explaining this & instead meanders around sources of irrelevant "stochasticity" like timestamps & build-time UUIDs & concludes by claiming that LLMs have solved the halting problem.
markatto•1h ago
It matters for things like verifiable builds.
measurablefunc•1h ago
You have to specify what exactly you're verifying.
adonovan•1h ago
Full determinism is also highly prized by compiler writers because it massively simplifies the task of reproducing and debugging problematic executions.
fragmede•1h ago
Thank you for reading!

I wrote "We have not remotely solved the halting problem in the formal sense", which does not read like a claim that LLMs have solved the halting problem to me, but I'm open to rewording it. How would you put it?

I added in a bit about compiler contract, wdyt?

measurablefunc•1h ago
We haven't solve it in the formal sense b/c it is formally unsolvable so hedging adds no semantic content. It's not a formal article so you can phrase things however you want but an uncritical reading will leave the reader confused about what exactly you were trying to explain.
Findecanor•21m ago
C and C++ compilers are limited to preserving semantics for data-race free code only, though. They are allowed to turn a single load into multiple loads, or even a store into multiple stores: things that won't affect anything if you have only one thread accessing memory but for multithreaded programs, changing compiler or just making seemingly unrelated changes and recompiling can make existing data-race bugs have effects or not.

Attempting to get consistent results from floating-point code is another rabbit hole. GCC and clang have various flags for "fast math" which can enable different optimisations that reduce precision.

Before SSE, fp on x86 was done by the "x87" FPU which always had 80-bit precision, even if the type in the source code was 32 or 64 bits — and it used to be accepted to sometimes get more precision than asked for. Java got its "strictfp" mode mainly because of x87.

measurablefunc•1m ago
Data races are undefined behavior¹ so in that case the compiler is still technically preserving semantics but if you use the proper primitives to remove undefined behavior (atomic operations, locks) for any shared state then the compiler will not generate code w/ undefined behavior & all modification will be serialized in some order. You can then further refine the code if you want the mutations to happen in a certain order. At the end of the day you must assume that the compiler will preserve your intended semantics otherwise we'd still be writing assembly b/c no high level specification would ever mean what it was intended to mean for the intended low-level executable machine model of the compiler.

¹https://cppreference.com/w/cpp/language/multithread.html

nu11ptr•1h ago
> The computer science answer: a compiler is deterministic as a function of its full input state. Engineering answer: most real builds do not control the full input state, so outputs drift.

To me that implies the input isn't deterministic, not the compiler itself

saghm•1h ago
You're not wrong but I think the point is to differentiate between the computer science "academic" answer and the engineering "pragmatic" answer. The former is concerned about correctly describing all possible behavior of the compiler, whereas the latter is concerned about what the actual experience is when using the compiler in practice.

You might argue that this is redefining the question in a way that changes the answer, but I'd argue that's also an academic objection; pragmatically, the important thing isn't the exact language but the intent behind the question, and for an engineer being asked this question, it's a lot more likely that the person asking has context for asking that cares about more than just the literal phrasing of "are compilers deterministic?"

jacquesm•30m ago
It matters a lot. For instance, many compilers will put time stamps in their output streams. This can mess up the downstream if your goal is a bit-by-bit identical piece of output across multiple environments.

And that's just one really low hanging fruit type of example, there are many more for instance selecting a different optimization path when memory pressure is high and so on.

a-dub•40m ago
> To me that implies the input isn't deterministic, not the compiler itself

or the system upon which the compiler is built (as well as the compiler itself) has made some practical trade offs.

the source file contents are usually deterministic. the order in which they're read and combined and build-time metadata injections often are not (and can be quite difficult to make so).

IanCal•1h ago
I’ve felt like a good response to the vibe coding thing is that customers, product managers, etc ask for features and don’t read the code. You don’t need to read the code of something to build a level of trust about what it does and whether that matches your expectations. It is not that wild that you can have a setup where you get an application and without reading the code decide if it solves your problem to your satisfaction.
system2•1h ago
I bet there will be strict companies that will ask not to vibe code ever. It will become a bigger problem as vibe coding gets more popular.
acedTrex•1h ago
There will absolutely be systems of the future that are entirely LLM written. Honestly they will probably be better quality than the standard offshore team output.

But lets all hope these are not vital systems we end up depending on.

Smalltalker-80•1h ago
Not if they're made by Anthropic...
drivingmenuts•1h ago
> . I’m AI-pilled enough to daily-drive comma.ai, and I still want deterministic verification gates around generated code. My girlfriend prefers when I let it drive because it’s smoother and less erratic than I am, which is a useful reminder that “probabilistic system” and “operationally better result” can coexist.

When did the girlfriend enter the discussion? Did I miss something?

DougMerritt•1h ago
It's not uncommon to have a regression test for compilers that are written in their own language (e.g. some C compilers): compile each new version with itself, then use that to compile itself again, then use the result on unit tests or whatever, which should yield the same results as before.

The point being that determinism of a particular form is expected and required in the instances where they do that.

(I'm not arguing for or against that, I'm simply saying I've seen it in real life projects over the years.)

einrealist•55m ago
If the output has problems, do you usually rerun the compilation with the same input (that you control)? I don't usually.

What is included in the 'verify' step? Does it involve changing the generated code? If not, how do you ensure things like code quality, architectural constraints, efficiency and consistency? It's difficult, if not (economically) impossible, to write tests for these things. What if the LLM does not follow the guidelines outlined in your prompt? This is still happening. If this is not included, I would call it 'brute forcing'. How much do you pay for tokens?

bandrami•10m ago
I thought to myself that I do this pretty frequently, but then I realized only if I'm going from make -j8 to make -j1. I guess parallelism does throw some indeterminancy into this
fragmede•5m ago
The time I was able to make -j 128 and it took 3 minutes to do what used to take an hour, I almost wet myself.
eru•28m ago
> This comes up now as “is vibecoding sane if LLMs are nondeterministic?” Again: do you want the CS answer, or the engineering answer?

Determinism would help you. With a bit of engineering, you could make LLMs deterministic: basically, fix the random seed for the PRNG and make sure none of the other sources of entropy mentioned earlier in the article contribute.

But that barely impact any of the issues people bring up with LLMs.

wat10000•14m ago
And determinism isn’t particularly helpful with compilers. We expect adherence to some sort of spec. A compiler that emits radically different code depending on how much whitespace you put between tokens could still be completely deterministic, but it’s not the kind of tool we want to be using.

Determinism is a red herring. What matters is how rigorous the relationship is between the input and the output. Compilers can be used in automated pipelines because that relationship is rigorous.

bandrami•11m ago
If you've got a fixed GPU that doesn't degrade at all during the process, I think? If you switch GPUs (even another one of the same model) or run it long enough the feed-forward of rounding will produce different results, right?
pizlonator•25m ago
Yes, yes they are.

Lots of engineering effort goes into making this be true.

TFA argues that you can't control the inputs perfectly, and so the behavior may differ if you fail to control the inputs. Yeah sure.

But the answer to the clickbaity question in the title is simply "Yes".

eichin•2m ago
Even the specific example in the article, the non-determinism was treated as a bug and was fixed (since by 2004 that was definitely a regression - we put a lot of work in, in the mid to late 1990s, to get bit level reproducibility - and even before that, those little details like timestamps were still deterministic variations, we had binary diff tools that could filter them out.)
nickelpro•23m ago
Dumb.

Compilers aren't deterministic in small ways, timestamps, encoding paths into debug information, etc. These are trivial, annoyances to reproducible build people and little else.

You cannot take these trivial reproducibility issues and extrapolate out to "determinism doesn't matter therefore LLMs are fine". You cannot throw a ball in the air, determine it is trivial to launch an object a few feet, and thus conclude a trip the moon is similarly easy.

The magnitude matters, not merely the category. Handwaving magnitude is a massive red flag a speaker has no idea what they're talking about.

groundzeros2015•17m ago
And that result of that magnitude is the paradigm of operation is just completely different. Good programmers create inputs, check outputs, and build up a mental model of the system. When the input -> output is not well defined you can't use those same skills.
bandrami•13m ago
If they weren't, then reproducible builds wouldn't be possible. The trick is being able to control the input tuple exactly.
pertymcpert•7m ago
GCC and LLVM consider it a bug if the compiler is non-deterministic. If re-running the compiler generates different output because of things like address differences for example then it's something that needs to be fixed. So yes they are deterministic.
overgard•3m ago
I feel like this is kind of missing the point of the argument around this. People love to say "Well you don't check your compiler output do you?" (never mind that some of us actually do for various reasons). When's the last time a compiler introduced a bug into your code? When's the last time an LLM introduced a bug into your code? There you go.
sarchertech•2m ago
If we’re talking about “can we ignore the code the way we mostly ignore assembly and treat prompts as the new high level language”, determinism isn’t the hard problem.

The real issue is prompt instability (chaos). A one word change to a prompt/spec will produce a drastically different program. Until that is solved there’s no world where we just check in the prompt and almost no one ever has to worry about the code.

FULU Bounties – Ring Video Doorbells

https://bounties.fulu.org/bounties/ring-video-doorbells
1•WaitWaitWha•42s ago•0 comments

Show HN: Turn Bilibili favorites into a personal RAG knowledge base

https://github.com/via007/bilibili-rag
1•via2026•5m ago•0 comments

Apple's AI Pendant Sounds Like a Watered-Down Humane AI Pin

https://gizmodo.com/apples-ai-pendant-sounds-like-a-watered-down-humane-ai-pin-2000723004
1•gnabgib•5m ago•0 comments

Riskiest CLO Funds Are Flashing a Warning Sign: Credit Weekly

https://www.bloomberg.com/news/articles/2026-02-21/riskiest-clo-funds-are-flashing-a-warning-sign...
1•zerosizedweasle•9m ago•0 comments

The cost isn't building or buying – it's what comes after

https://gobiraj.substack.com/p/ai-killed-the-saas-model-then-it
1•gobiraj•11m ago•0 comments

Chinese boxing robots win fans in San Francisco

https://restofworld.org/2026/chinese-robot-boxing-unitree-rek/
1•PaulHoule•14m ago•0 comments

Show HN: Public Domain Image Search

https://faenum.com
1•jlauf•15m ago•0 comments

Evolving a Modular Dev Experience in Emacs

https://poyo.co/note/20260202T150723/
1•minikomi•15m ago•1 comments

Regime-Declared Mathematics as Survivor Sets

https://zboralski.github.io/br/maths/index.html
1•o4c•16m ago•0 comments

Of the Greate Liberation of Websytes

https://elliotbonneville.com/the-internet-is-about-to-get-weird-and-beautiful/
1•elliotbnvl•17m ago•0 comments

Show HN: WordBulb – Interactive Word Cloud Generator You Can Use for Navigation

https://wordbulb.com/word-cloud-generator
1•rkj93•17m ago•0 comments

Why every AI video tool feels broke

https://www.openslop.ai/blog/why-every-ai-video-tool-feels-broken
1•umairnadeem123•18m ago•0 comments

Free, local-first barcode generator (No server uploads)

1•BarcodX•22m ago•0 comments

Experimenting a New Syntax to Write SVG (2022)

https://yuanchuan.dev/experimenting-a-new-syntax-to-write-svg
1•cristoperb•23m ago•0 comments

NASA's Artemis 2 rocket hit by new problem expected to bump moonshot into April

https://spaceflightnow.com/2026/02/21/nasas-artemis-2-rocket-hit-by-new-problem-expected-to-bump-...
3•bookmtn•25m ago•0 comments

Show HN: Nucleus - A Sovereign Control Plane for AI Agents

https://github.com/eidetic-works/mcp-server-nucleus
1•NucleusOS•26m ago•1 comments

Show HN: Residue – connect AI agent conversations with Git commits

https://residue.dev/
1•mrbutttons•27m ago•0 comments

No-circles: Read what they don't. Think what they can't

https://www.no-circles.com/
1•NamanChetwani•30m ago•1 comments

Linux Begins Seeing Early Preparations for PCIe 7.0

https://www.phoronix.com/news/Linux-Early-PCIe-Gen-7-Prep
1•snowhale•41m ago•0 comments

Show HN: Create edited videos with AI-generated scripts and your voice

https://github.com/derikvanschaik/videoai
1•dman_the2nd•43m ago•3 comments

Hackers expose vulnerabilities in Discord's age verification system

https://www.ibtimes.com/hackers-expose-discord-age-verification-system-issue-after-persona-fronte...
1•pabs3•45m ago•0 comments

Red Robin Died by Spreadsheet. Don't Make the Same Mistake

https://garryslist.org/posts/red-robin-died-by-spreadsheet-don-t-make-the-same-mistake
5•mooreds•49m ago•0 comments

Apple M5 Pro/Max and TSMC SOIC-MH 2.5D chiplet packaging

https://old.reddit.com/r/macbookpro/comments/1r7hd6d/explaining_m5_prosmaxs_new_soicmh_25d_packag...
2•walterbell•51m ago•0 comments

Remove Jira integration, issue-based triggers, and parent-issue rules

1•nishiohiroshi•54m ago•0 comments

US judge upholds $243M verdict against Tesla over fatal Autopilot crash

https://www.reuters.com/world/us-judge-upholds-243-million-verdict-against-tesla-over-fatal-autop...
12•raincole•58m ago•0 comments

Attention is all you need to bankrupt a university

https://hollisrobbinsanecdotal.substack.com/p/attention-is-all-you-need-to-bankrupt
4•HR01•1h ago•0 comments

Chroma-print – Rust library for styled terminal printing using ANSI escape codes

https://github.com/brysonbw/chroma-print
2•Brysonbw•1h ago•0 comments

HN-stories – Rust CLI to browse and open Hacker News stories from the terminal

https://github.com/brysonbw/hn-stories
1•Brysonbw•1h ago•1 comments

Show HN: ShuttleAI – One API for Claude Opus 4.6 and GPT-5.2

https://shuttleai.com/
1•tristandevs•1h ago•0 comments

The Internet Is Becoming a Dark Forest – and AI Is the Hunter

https://opennhp.org/blog/the-internet-is-becoming-a-dark-forest.html
3•windcbf•1h ago•3 comments