frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Show HN: Compile the same source for GPUs and CPUs

https://github.com/ThrudTheBarbarian/xc
3•spacedcowboy•1w ago
I'm writing a language called xc and its compiler, xcc for the last 6 months or so (full disclosure: with a lot of help from Claude). I've finally got version 1 (actually v1.0.1) out, for Linux (x86-64 and arm64, including the Pi 5), macOS and Windows.

The idea: you write an ordinary loop, the compiler works out whether it can run in parallel, and it emits both a multi-core CPU version and GPU kernels (MSL, PTX, SPIR-V or WGSL, all generated by xcc itself without needing an SDK installed).

At run time the program measures each block on that machine and keeps the faster placement.

Examples:

- On an M3 Max a Mandelbrot block takes 13.7 ms on all 16 cores and 1.3 ms on the GPU

- On a Ryzen 9955HX's 2-CU integrated Radeon the GPU loses to the 32 CPU threads, so it stays on the CPU.

The compiler also reads plain old C via clang's front end and does the same thing to C loops, with no pragmas. Comparing xcc to OpenMP for both gcc and clang (with the helping hand of "#pragma omp parallel for" gives (times in ms):

                 xcc    gcc+omp  clang+omp
  mandel_deep    371    2170     2231
  mandelbrot     2.45   12.2     12.8
  md5            9.39   16.1     13.4
  md5_mask       8.17   12.1     13.4
  nbody          0.45   1.29     9.92
  perlin         5.87   4.38     7.05
  saxpy          2.26   2.18     2.32
Geometric mean: xcc is 2.1x faster than GCC+OpenMP and 3.0x faster than clang+OpenMP.

All the builds are checked to make sure they give the same result - no point having a benchmark that doesn't produce the same result! xcc has a notable win for nbody, because its vectorisation is better (across bodies) but perlin has been a bit of a bugbear throughout the leading-up-to-v1 timespan.

Platform-specific binary tarballs, the sources, OpenMP versions and method are on the site (linked from github), and there are Phoronix Test Suite profiles if you'd like to run them yourself.

It's only just made v1 so there's a few rough edges: C++ through clang is in-progress (but not official yet), and the Pi 5's GPU is slow. Not sure if that's the Pi or the code yet...

There's more to the language but I don't want this to be an essay! The real, honest-to-$deity cool thing is the automatic parallelising of standard C/xc loops and being able to run that code on the GPU with no boilerplate - "ARC for Algorithms" (what Objective-C's ARC did for memory management), it "just works".

Very keen to get feedback and fix any gaps. I think it's generally useful right now, but it is "v1" - Bug reports welcome as GitHub issues...

Toyota, Nissan, and Honda to standardize parts to lower costs

https://www.caranddriver.com/news/a74490092/toyota-nissan-honda-standardize-parts-lower-costs/
173•zdw•1h ago•85 comments

Pill to treat pancreatic cancer hailed as 'biggest breakthrough in decades'

https://www.theguardian.com/society/2026/nov/20/pill-pancreatic-cancer-breakthrough-daraxonrasib
839•rafaelc•1d ago•192 comments

Lean verification of the Riemann Hypothesis

https://leanprover-community.github.io/blog/posts/riemann-hypothesis/
931•g-b-r•15h ago•791 comments

Sandwich Simulator

https://stulle.app/
124•subdomain•5h ago•50 comments

Inkling-2-Mini in 5.4 GB Memory

https://github.com/ShinMegamiBoson/lookatmyquant
415•k__•11h ago•104 comments

Detonating a pile of lead azide

https://www.science.org/content/blog-post/detonating-huge-pile-lead-azide-really
578•beginning_end•16h ago•375 comments

Data Processing Incidents on Inference Providers

https://openrouter.ai/blog/announcements/data-processing-incidents-on-inference-providers/
76•sdko•3h ago•29 comments

Getting the mind to steer the body to steer you

https://notnottalmud.substack.com/p/getting-the-mind-to-steer-the-body
220•jger15•1d ago•69 comments

PcapAnalyzer – self-hosted pcap analyzer with 27 problem detectors

https://github.com/sebaandrada-cell/PcapAnalyzer
94•sebaandrada•7h ago•9 comments

My monitor was cutting my download speed by 75%

https://blog.tymscar.com/posts/studiodisplayethernet/
542•soheilpro•19h ago•262 comments

The Most Popular Car Colors in America

https://www.iseecars.com/most-popular-car-colors-study
18•cisc•3h ago•23 comments

Leonida – PC Recompilation of the Xbox Version of GTA 6

https://github.com/ItsNotRexed/Leonida
107•ebrahimh•5h ago•69 comments

Together.ai: Prompt Leakage for Requests

https://www.together.ai/blog/security-event-prompt-leakage-for-requests-in-june-and-july-of-2026
13•Fe2O3•2h ago•6 comments

Upload2Shell (CVE-2026-125396)

https://pwn.ai/upload2shell
101•f311a•11h ago•46 comments

The Mythology of Conscious AI

https://www.noemamag.com/the-mythology-of-conscious-ai/
19•Anon84•3h ago•48 comments

Pandex – Official European Law for AI Agents, over MCP

https://www.pandex.io
58•vasie•9h ago•10 comments

Shaping the Loops, Closing the Loops

https://revyl.com/blog/pattern-engineering/
19•based0x10•3d ago•8 comments

Split Radiance Cascades

https://www.jacktollenaar.top/articles/split-rc.html
6•ibobev•2d ago•0 comments

LLMs can read and write executables byte by byte from a hex dump

https://sgiannopoulos.github.io/blog/machine-code-programming/
224•fortran77•3d ago•143 comments

Advice for the next 100 Rust GUIs

https://linebender.org/blog/next-100-guis/
125•raphlinus•8h ago•32 comments

Why there are still no non-WebKit browsers on iOS

https://blog.mozilla.org/en/mozilla/internet-policy/apple-ios-browser-engine-rules/
535•lapcat•1d ago•284 comments

Tasklet (YC P26) Is Hiring Product and Agent Infra Engineers

https://tasklet.ai/careers
1•mayop100•8h ago

Show HN: Zero C# – C# without a runtime or GC

https://onurgumus.github.io/zero-csharp/index.html
147•reverseblade2•14h ago•104 comments

GnuPG Security Advisory for GPGME

https://lists.gnupg.org/pipermail/gnupg-announce/2026q4/000517.html
247•gdgghhhhh•21h ago•98 comments

Show HN: Compile the same source for GPUs and CPUs

https://github.com/ThrudTheBarbarian/xc
3•spacedcowboy•1w ago•0 comments

PostgreSQL Extensions in Go

https://jespino.github.io/gopgext/
133•valyala•12h ago•23 comments

Unit-testing in the Ü programming language

https://panzerschrek.github.io/U-00DC-Sprache-site/2026/11/18/unit-testing.html
9•Panzerschrek•2d ago•1 comments

Ask HN: I have been unemployed for 2y. 15 years of experience, US. What to do?

662•LetThingsBeDiff•1d ago•752 comments

Exponential Behavior in Magic: The Gathering

https://levineuwirth.org/essays/exponential-magic/
105•neuwirth•3d ago•68 comments

Verification files for the Lean proof of the Riemann Hypothesis

https://math.mit.edu/~drew/grh/
107•Bluestein•14h ago•38 comments