HNHacker News
TopNewBestAskShowJobs

fluffything

2,917 karma · joined April 21, 2019

submissionscomments
fluffything··on Building Elixir from source segfaults on macOS on Apple Silicon while compiling
Wait what? We were using the old flang project just fine. I thought they just moved it in tree and keept developing it.
fluffything··on Building Elixir from source segfaults on macOS on Apple Silicon while compiling
GCC supports ARM targets and the macos platform. It took a couple of hours to add support for the new target triple to Rust, so it should take about the same work to add support to it for each of the GCC frontends (10x couple of hours ~ couple of days, maybe a week).

You don't need to implement neither hardware support nor OS support, just combine the two things that are already implemented, and fix a couple of incompatibilities, but not many (some parts of OS support will be x86 only and these would need fixing, but fixing these should be trivial since you can c&p from the arm+iOS code).

Why would it take months to add support for this to GCC? GCC's architecture would need to be really flawed for this to be true, i.e. , requiring you to re-implement a big chunk of hardware support for each OS, or full OS support for each new hardware. Given how many architectures and OSes GCC supports I just can't imagine this being true.

Unless by this work taking months, you mean "not doing anything the first 99% of the days, and doing all the work in the last couple of days". In that case, sure, this can take as long as you want.

fluffything··on Building Elixir from source segfaults on macOS on Apple Silicon while compiling
BLAS/LAPACK isn't that much of an issue, since Apple probably will need to ship their own implementation of this for Apple Silicon to get reasonable performance, and they can implement this in C, assembly, or whatever they want.

If they don't do that, then you can just use any "generic" C BLAS/LAPACK implementation, performance will be poor, but that's pretty much the only option if your hardware vendor doesn't support BLAS.

I guess people can write their own BLAS as well, but if you want to re-implement BLAS in 2020, then Fortran is probably not the best language to do that.

fluffything··on Building Elixir from source segfaults on macOS on Apple Silicon while compiling
This is incorrect, the LLVM project has an official Fortran compiler in tree called flang: https://github.com/llvm/llvm-project/tree/master/flang

It is quite hard to write portable Fortran code, but code that at least compiles with PGI should compile with that as well.

fluffything··on Optimizations in C++ Compilers
> Tail call removal. A recursive function that ends in a call to itself can often be rewritten as a loop, reducing call overhead and reducing the chance of stack overflow.

Most important: this optimization enables pipelined execution.

When people talk about a CPU executing an integer add instruction in ~1 cycle, what they actually mean is that the add has this latency when the CPU pipelines are full.

If you have an 11 stage pipeline... the add can often have a latency of ~11 cycles... if you write the _right_ code for it.

fluffything··on Moving from TypeScript to Rust / WebAssembly
Modules is pretty much the only OCaml feature I miss in Rust. I can work around functors with some effort in Rust, and hopefully GATs will make this even simpler (although I don't expect GATs to give Rust functors).
fluffything··on Linux kernel in-tree Rust support
You can pick whether you want to do this at run-time or compile-time. The default is compile-time.
fluffything··on Linux kernel in-tree Rust support
rust-lang/rust on github, go to issues, and click on the "easy" and/or "mentor" labels. That will show you all the easy tasks with a mentor available.

Just find one that you'd like to work on, write that you are going to work on it, and start doing the work, and asking lots of questions.

fluffything··on Linux kernel in-tree Rust support
Every time you compile a rust project after an initial compile, cargo does use "binary" dependencies (bitcode dependencies).

It is much better at this than C++.

For example, change a trait in your Rust library, and recompile the tests, and compare that with changing a type in, say, range-v3 (or any other C++ header-only library).

In C++, recompiles take pretty much the same time as clean builds (for range-v3, exactly the same time). In Rust, they are infinitely faster (100000x faster, depending on the project, but essentially almost instant, in contrast with initial compiles).

So for development at least I'll pick Rust over C++ every day. I only do an initial compile once, but I edit and recompile a lot, and that's the bottleneck that I really care about.

(Same with C btw, add a new API to a commonly use C header and re-compile, and you end up re-compiling the world, while from Rust, you just re-compile the part of the crate where the new API was added, and since no downstream crates use it, that's pretty much it - instant change).

fluffything··on Linux kernel in-tree Rust support
If it does compile, could you try reporting results for multiple Rust compiles (e.g. the current one, and the ones from 6,12,18,24 months ago) ? (If you can, maybe do the same for C, but I don't know how easy that is).
fluffything··on Linux kernel in-tree Rust support
> increasing the number of people paid to work on the Rust compiler by 10x would only mean hiring about 25 people.

Citation needed ?

I know at least 20 people being paid to work on the Rust compiler, which crank's your 10x number from 25 to 200. And this is only the people I can come up with from the top of my head.

fluffything··on Moving from TypeScript to Rust / WebAssembly
Does not really require you to drop to a lower-level language for performance, unless you really need to use assembly for something.

OCaml is great for the application level stuff, and also performs quite well in general. But for building fundamental parts of the stack in which perf is important (like the multi-threading runtime, the garbage collector, etc.) you need to drop down to C++, C, or Rust.

OCaml is definitely much nicer to use than C and C++. But I don't find it that much nicer to use than Rust TBH.

fluffything··on CUDA 11.0
No, you need to use Metal, or Vulkan + Molten VR, both of which suck for compute, but you don't have that much compute available on Apple hardware anyways, so it shouldn't matter that much.
fluffything··on CUDA 11.0
Google's Compute Cloud. You can play with a powerful GPU for 0.20$/hour, and you get 300$/year free I think.

Its quite easy to set up as well, basically a workstation that you can just connect to with remote desktop, but migrate the hardware it runs on.

fluffything··on CUDA 11.0
I don't even install them, just use containers.

docker and nvidia-docker work fine for me

fluffything··on Sweden: higher Covid-19 death rate while failing to collect on economic gains
A German college truly believes that this virus was created by Adolf Gates to enrich themselves with the pandemic while helping China destroy the German economy.
fluffything··on Sweden: higher Covid-19 death rate while failing to collect on economic gains
The data shows that these two do not balance each other out. Otherwise there would be no excess mortality, or it would be negative, i.e., less deaths. From just looking at this metric, we can't tell - but other metrics like car accidents per month per capita do show that this is the case.

One interesting thing is that COVID-19 lowers the mortality rate in the mid-to-long term. It disproportionately targets the weakest, so in the next couple of months and years, less people than the expected average will die, because the weakest are already dead, and that will lower the mortality rate per capita for one generation at least. At some point, it will hopefully raise again, and that too will be due to COVID-19, because the reason for that will be that we wouldn't have a recent-enough COVID-19-like event.

---

Point being, one should be careful when comparing mortality rates and absolute death counts. One needs to factor in both to get the full picture, and for rate, the period over which the rate is computed is very relevant.

fluffything··on Sweden: higher Covid-19 death rate while failing to collect on economic gains
> Apart from clear differences in how people act in public spaces when sick, and countries "count" differently.

The only solid metric for COVID-19 deaths is excess mortality, that is, the actual number of deaths - the statistically expected number of deaths (e.g. extrapolating from the last 2-5 years).

This metric is independent of testing capacity and malicious actors like politicians just outright lying to the public to try to save face. You can "hide" dead people, but doing so is much harder than hiding COVID-19 related deaths.

You can't conclude from this metric what the source of all these extra deaths are, but if they are not caused by COVID-19, every alternative explanation I can think of is even worse than a global pandemic.

https://ourworldindata.org/excess-mortality-covid

https://www.economist.com/graphic-detail/2020/04/16/tracking...

https://www.ft.com/content/a26fbf7e-48f8-11ea-aeb3-955839e06...

https://euromomo.eu/graphs-and-maps/

fluffything··on Exciting Days for ARM Processors
> Bitcode is architecture-dependent, you can’t just recompile it for a random target.

In general, you are correct. LLVM-IR is architecture dependent. Things like the size of a pointer, the size of an `int`, parts of the calling convention, or "architecture-specific defines in C code" have already been "hardcoded"/expanded into the generated IR.

In practice, you can easily re-compile x64 IR to arm64, as long as the IR does not use, e.g., "arch-specific" LLVM intrinsics (like explicitly using, e.g., NEON intrinsics). Apple does not let you ship this kind of bitcode to the AppStore, so if you want your software to use NEON on iOS, you need to call the opaque Apple math libraries, which they can just provide for a different architecture.

The other things you need to worry about is, e.g., calls to system libraries (e.g. you can't call a Windows API, generate IR for it, and then try to re-compile that IR for Linux, because that API will fail to link). In practice, if you provide the symbol, everything will work, and the system APIs for MacOSX, iPadOS, and iOS are quite similar.

The x86-macos IR won't be recompilable to Linux or windows, but can be made recompilable to arm-macos.

Note also that this is not the first time Apple does this with the AppStore. They silently migrated all apps from 32-bit ARM to 64-bit ARM, recompiling the software for you. This hints that they have additional capabilities to changing some architecture details in the AppStore's IR, like pointer-sizes (these Apps are not running in 32-bit compatibility mode in 64-bit CPUs, but are running as native 64-bit apps).

>Additionally, Mac AppStore apps are shipped without Bitcode.

The Apps themselves are shipped to users as binary blobs, but developers ship bitcode to the AppStore, which Apple has been recompiling for each new arm processor in their iphones (so on an iPhone 11 you get a different binary blob than on an iphone 6, but the developer didn't ship two blobs, nor they recompiled their App).

fluffything··on New Compute Engine A2 VMs–First Nvidia Ampere A100 GPUs in the Cloud
> Still not sure why competitors don't have their GPU's offered in cloud services.

AMD has many GPGPUs, but while they have kind of ok-ish raw numbers, their software stack makes quite poor use of them.

Users care about perf/$, and nvidia is king there. For deep-learning and other apps, hardware without software is useless.

fluffything··on New Compute Engine A2 VMs–First Nvidia Ampere A100 GPUs in the Cloud
What's the perf/$ ratio for these different instances ?

I've also read that the A100 can deliver 4x the performance on some DL workloads.

fluffything··on Exciting Days for ARM Processors
And on the Apple AppStore, developers ship LLVM-IR that can be compiled to different architectures (ppc64le, x86_64, arm64, etc.), instead of pre-compiled binaries.

So when Apple releases a new chip, it can just re-compile the LLVM-IR to it, to make use of newer features and compiler optimizations for that chip.

Basically, the only applications that have to do anything to transition to Arm on Apple are those that are not using the AppStore... which from the platform's perspective, is kind of their own fault.

fluffything··on Zettlr – FOSS markdown editor for personal knowledge management and publishing
I use typora to write markdown on macos and am very happy.

To sync, I use a git repository (you can set a watchpoint on macos and linux to any directory to invoke a command on changes, so I just invoke git and commit).

fluffything··on The World Doesn’t Need a New Gigantic Particle Collider
Why believe any model?

Just act completely random.

Don't wake up, and go to your job, under the assumption that you will get paid.

Don't avoid jumping down a 15 stories building under the assumption that you will die.

Don't breathe. Your model is biased towards breathing.

fluffything··on Xi-Editor Retrospective
https://thume.ca/2020/05/20/making-a-latency-tester/

> I have a multi core machine running at speeds well above my comprehension and you are saying they can't render simple 2d primitives at speed? That just blows my mind. What are they spending the time on?

Moving memory from RAM to the CPU, doing stuff in the CPU, moving the results back to RAM, moving those results from RAM to the GPU, etc.

The CPU is fast, but moving memory around is not, so the CPU and the GPU just end up doing nothing most of the time, waiting for memory most of the time.

---

Raph's blog (linked at the top), has a bunch of articles about rendering latency. But just google about typing latency, there are a couple of projects and tools that measure the time between a physical keystroke is pressed, and the letter being rendered on the screen (end-to-end). Beyond the memory copies, what usually happens is also: an interrupt is triggered on the CPU, the kernel might take some time to context switch to catch it, context switching requires saving all registers, and restoring them, and registers have exploded in size over time (e.g. with AVX-512 you need to save quite a bit of memory), then the kernel notifies the application, which needs to do something with the key press, like scheduling a render into a frame buffer, etc.

So there are just quite a bit of bounces from here to there in the system, most of which deal with memory latencies, and memory latencies is the part of the system that hasn't been getting much faster over the last 30 years.

fluffything··on Implementing the Exponential Function
And also quite useful in a wide range of numerical methods for PDEs like discontinuous Galerkin (and spectral methods in general).
fluffything··on There is now a European standard for measuring how easy it is to repair stuff
> I haven't had to change or repair any parts and it costs about half an iPhone, I think.

I've dropped the iphone dozens of times. I should stop doing that. I guess that if I had been more careful, i wouldn't have had to change anything, except for the battery (the old battery was "fine", ~65-70% capacity, but given that changing it takes 15 min and 20$, and makes the phone feel like brand new, it is a change that I happily do). Can you comment on the battery life of your 2014 HTC phone after 6 years of use? What kind of battery does it have ?

fluffything··on The World Doesn’t Need a New Gigantic Particle Collider
> What exactly do we gain from building better model of climate change? Knowing where it's going to hit us hard?

No? Models are useful for making predictions.

If somebody like the POTUS tells you that nuking thunderstorms would be great against climate change, you don't have to just take their word for it. You can input that into your climate change model, and it will tell you how much of an impact this will have, and whether the impact is good or bad.

The difference between a better model and a worse model is that the better model will agree better with reality.

A shitty model, like the one POTUS is using, might tell you that nuking all thunderstorms would be great. Then we go ahead and do it, and we all die.

A better model, like the mental model that every 14 year old child that starts studying physics and radiation has, might tell you that nuking thunderstorms is a pretty bad idea that would kill us all due to dozens of reasons.

Given that we cannot make accurate predictions today of what the weather tomorrow will look like. If you want to predict the 50 year impact of more subtle changes like, e.g., covering the Sahara with black mats, you need a pretty good model to get an output that isn't multiple orders of magnitude off.

So..... what do we expect from better climate change models? Avoiding the apocalypse to begin with. Worth every penny.

fluffything··on Xi-Editor Retrospective
Maybe the time is just not right for Xi yet.

I wish that after druid becomes production ready you'll pick it up again.

The coolest thing about Xi is that some have attempted to make it a vim replacement, others an emacs replacement, etc. I wish it becomes a framework that can be used to build better text editors in general.

fluffything··on Xi-Editor Retrospective
> 2d rendering used to be hella fast without the gpu. Right?

Define Hella fast.

If you want 16ms text rendering (~60 Hz) you pretty much need a GPU today. If you want 8ms (120Hz) text rendering, there is just no CPU that can handle it today with an OS running next to your text editor doing other stuff.

The whole point of Xi was being able to edit huge files (Tb size) on 8k displays at over 120 Hz, and being able to resize the screen and scroll, resize text, with great fonts, without any delay or sluggishness.

Xi delivered in some of those things, and druid delivers on some of the others.

But essentially, there is no system today where you press a key and that key appears on your screen in less than 8ms. Xi achieves ~16ms on the right platforms - not the fastest but much faster than most text editors.

The idea behind Xi was to preserve that as the editor got more features, like syntax highlightning, and it did.

← PreviousPage 10 of 31Next →