HNHacker News
TopNewBestAskShowJobs

diamondlovesyou

247 karma · joined April 23, 2014

I work on compiler auto-vectorization and middle ends in general.

Contact me via email: dick at richard no-space c no-space diamond dot com

submissionscomments
diamondlovesyou··on How Zillow's homebuying scheme lost $881M
There isn't exactly a large market for homes at that price point. Plus at that price, a thorough DD is an order. So not unexpected that your home's value would be accurate.
diamondlovesyou··on Vectorization, dependencies and outer loop vectorization
This article focuses on loop vectorization, but another important area in this realm is vectorizing "straight-line code", sometimes called SLP vectorization. This sort of code often lives in loops too, and so usually also depends on much of the memory dependence analysis used for vectorizing successive iterations, but only uses it for finding memory accesses which are sequential within a single iteration. This is important for vectorizing loop reductions (ie summing each channel in every pixel in an image), or eg a 3d cross-product. The techniques are built around matching expression trees or DAGs together, but gets complicated because brute forcing the search isn't practical in even medium sized functions, among other reasons.

Source: I work for AMD on MSVC, currently focused on renovating it's SLP pass. I'm about to merge patch into MSVC which boosts 538.imagick_r on Zen3 by 25%, which I'm pretty proud of.

diamondlovesyou··on Adding HLSL and DirectX Support to Clang and LLVM
With the Physical Address Buffer extension, many of the pain points in this area aren't impossible anymore, even if Vulkan SPIR-V overall is still painfull vs CUDA/HIP/ROCM.
diamondlovesyou··on Apple M1 Ultra
Yes. AMD has had integrated CPU+GPU+cache-coherent HBM for a while. You can't buy these parts as a consumer though. And they're probably priced north of 20k$/each at volume, with the usual healthy enterprise-quality margins.
diamondlovesyou··on An Experience with Modafinil
Funny. The couple of times I took Modafinil, it might as well have been placebo. Absolutely no effect. I gave the pills away.

I have ADD, and am prescribed 60mg Adderall XR/day. OTOH, I have slept on 30mg Adderall XR a couple of times, so maybe I'm just "built differently" w.r.t. The Stimmies.

diamondlovesyou··on Wine on Wayland year-end update: improved functionality and stability
Due to the monopolistic nature of copyright/IP, there is no option to avoid it.

But technically, nobody pays for it. They pay to access an on-demand and at-will service which provides the content. The content itself is never bought (by the consumer, that is).

diamondlovesyou··on Do climate models predict extreme weather?
I address this mostly to this comment's siblings: the fact that you're upset about the lying bit only reinforces labster's point. I say this based on the comments thinking that the lie is actually meant to deceive, getting distracted with the word "lie" and its connotations, and missing the broader issue. The issue is that the general population can't be reasonably expected to understand how climate change works, and how statistics play out in climate change modeling. Unless the message is dead simple, the message will be lost.

What the "lie" "really" says is subtextural/etc: to those that need to hear it, it says what it needs to say to get them to understand what needs to be done (and, importantly, isn't wrong, just isn't the whole picture either); to those that already know the answer, you didn't need to hear the lie in the first place. There is no deceit.

Climate change needs participation from everyone, and, for better or worse, everyone includes a majority of, eh-hem, less-than brilliant people. We need them to understand regardless of our own righteousness.

diamondlovesyou··on Fixing stutters in Papers Please on Linux
> A well-designed interactive GUI application can absolutely interact with the filesystem on its main thread without any impact to responsiveness what-so-ever. You only need threads once you need more CPU time.

The "well-designed" argument here is a bit No True Scotsman, and absolutely not true. Consider a lagging NFS mount. Or old hard drives; a disk seek could take milliseconds!

Real time computing isn't about what is normal or average, it's about the worst case. Filesystem IO can block, therefore you must assume it will.

diamondlovesyou··on DIY Off-Grid Solar Power
What about summer? Those batteries also need to stay cool...
diamondlovesyou··on Stacking Up AMD MI200 versus Nvidia A100 Compute Engines
> Can those command graphs loop?

Not directly (barrier packets wait for 0 only, plus the queue packets aren't preserved), but kernels can write to any dispatch queue themselves, so you can get the same effect at the end of your "loop body".

> I know this interface is undocumented... but I've had an idea for a GPU-language akin to Java or Lisp memory-management. The gist is that kernel_X() can execute, but may fail in any new() or malloc() command.

Memory allocation isn't special and allocators can be layered: you can allocate memory ahead of time and then just run the allocation algorithms GPU side. I wrote a Rust framework which cross compiles code/MIR on demand; you can in theory have a Rust allocator and use it to allocate GPU/CPU memory from either GPU/CPU. The only part the GPU can't do (directly) is invoke syscalls, which you can probably guess is the part needed to allocate virtual memory from the OS.

But as long as your allocator has enough spare virtual memory, it shouldn't need to do a syscall. And if you /really/ needed the ability GPU side, technically with signals you can actually just ask the CPU to allocate the virtual memory on the GPU's behalf and have the GPU spin until the allocation is "complete". Or with compiler support: automatically make the workgroup/kernel async and resume execution by enqueuing another kernel, but that sort of thing is kinda hard :).

Btw, the Rust framework is here: https://github.com/geobacter-rs/geobacter. I mostly work on it in my spare time, a scarce resource these days, so I admit it has some scuff.

> In such a case, I'd want the compute-graph to loop: while (kernel_X fails due to out-of-memory){ garbage_collect(); try kernel_X() again}.

Pretty much. Even garbage collection can (theoretically lol) happen on the GPU.

diamondlovesyou··on Stacking Up AMD MI200 versus Nvidia A100 Compute Engines
I use LLVM directly. The LLVM AMDGPU target machine is supported by AMD and they use it internally in HIP/OpenCL.

I don't think OpenCL should be used going forward; it not really platform independent. And SPIR-V... kinda sucks tbh. Plus, where's my single source stuff (a la CUDA)?

diamondlovesyou··on Stacking Up AMD MI200 versus Nvidia A100 Compute Engines
Correct; Rocm/HIP/OpenCL are all built on HSA APIs, with a few AMD specific extensions.

AMDGPU's command processor is exposed to you (the CP is what invokes "kernels" GPU side): create signals (essentially just an atomic u64 in host memory, with a few extra bells and whistles to support interrupts) and use those in one of the barrier packet types in a HSA device queue. With these (with one sad caveat that work packets can't have deps themselves :( ) you can enqueue most computation graphs and the CP will handle waiting for signals without any CPU involvement. Plus, GPU kernels can also concurrently write to this queue (though you can't create signals GPU side...)

AMDGPUs are like shared memory machines, which I think is really cool.

diamondlovesyou··on Stacking Up AMD MI200 versus Nvidia A100 Compute Engines
Machine learning isn't the only useful thing to run on "GPU"s (these can't do graphics workloads anymore; they're basically just vector processors).

AMD isn't attempting to complete on f16 perf. They're completing where Nvidia's perf is abysmal: f64.

Having programmed AMDGPUs at a lower level than HIP/Rocm, they are actually much better than Nvidia (and in fact I'm able to do cool things like pcie large bar/p2p even on RDNA1 GPUs) in terms of flexibility. The HIP/CUDA API (nevermind OpenCL) doesn't do them justice, CUDA's enormous ecosystem and vender lock-in notwithstanding.

diamondlovesyou··on Reading NFS at 25GB/s using FIO and libnfs
Presumably, with async you could queue all the `stat`-ops after the dir walk at once, leaving the total latency in the ball park of "dir walk"+"ping for file stat"+"ping remaining symlink stats if present". But I don't think `ls` does this.

Otherwise, yeah, you incur network latency on every file, plus, as you say, symlink "pings" if those are present. So its "dir walk"+"number of files"*"ping"+"symlinks"*"ping", which adds up.

Batching high-latency ops is one of the only cases where I like async.

diamondlovesyou··on Why I Have Settled on XChaCha20+Blake3 for AEAD
If this particular failure mode is so easy to crack, why is testing specifically for this failure mode not acceptable (ie via continuous integration testing)?
diamondlovesyou··on Beware of fast-math
(a+b)+c has two ops in LLVM: addition is a binop, meaning it has two "arguments", thus (a+b) and adding "c" are separate instructions. You can't directly add three or more values.
diamondlovesyou··on Notice of Stolen EVGA GeForce RTX 30-Series Graphics Cards
With a PCIe switch, you can run almost (obviously there are PCIe addressing limits, just to name one) any amount of GPUs per machine.

Source: my workstation has 10 GPUs in it. Two are plugged into the mobo. 8 are plugged in via two PCIe switches.

diamondlovesyou··on YouTube: filmmakers presumed guilty until maybe proven innocent
Here you go: https://www.youtube.com/watch?v=KTNKGK7hVhY
diamondlovesyou··on GPUs open the potential to forecast urban weather for drones and air taxis
I'm a level above an amatuer in this, having studied data assimilation in college (I was a Math major). Numerical errors are a given, errors in general too, actually, especially in the measurements used to train the hidden parameters (it is very similar to supervised ML). Data assimilation is a collection of techniques used to tackle that issue: 3dvar, 4dvar, kalman filter, extended kalman filter, ensemble kalman filter, particle filters, and so many others are used to find the most likely (minimum energy etc) hidden state (the mean and covariance) from a given set of measurements+associated covariances and then that resulting hidden state is used to run the model "forward" (generally in time). AIUI, DA was specifically developed for weather modeling. It is definitely true that weather modeling is a heavy employer in anycase. This is on top of the methods used to solve PDEs ie so that they are forward/backward stable etc.

The errors in the weather forecast are not the result of chaos: they are the result of the errors in the measurements (recorded in the observation covariance) and the sparsity of the measurements themselves vs the size of Earth, for example, and limitations in model resolution (consider a FEM grid over the entire surface of Earth). The effect of chaos just compounds these errors near bifurcations around fixed points.

Perturbations are not used in the way you think; think of Taylor series approximations around specific points of interest.

Anyway, I work on compilers/auto-vectorization now (lol), so I'll defer to The Expert, if such person wants to chime in.

diamondlovesyou··on Plants, heavy metals, and the lingering scars of World War I
TABITHA You've got to sign the land mine treaty, Toby.

TOBY Whoa... What happened to the nuance of diplomacy?

TABITHA Oh, sorry, the shoes are shined.

TOBY No we-we're there now, you-you can't go back.

TABITHA Sorry.

TOBY Right.

TABITHA 142 countries have signed it, 84 have ratified, 12 destroyed there entire stock.

TOBY Yes.

TABITHA You know who hasn't signed it? Us and Cuba.

TOBY You know who initiated it? Us. And the nations of the world rallied around it in yet another impressive display of American leadership.

TABITHA And then?

TOBY We bolted.

TABITHA Right.

TOBY And the reason we did is because we love anti-personnel land mines. We love 'em. And we think the government should be in the business of selling them, like the Post Office. In fact, the Post Office is the sales venue we've been considering.

TABITHA Toby. I-I got a...

TOBY It's Korea. Tabitha. There are 900,000 North Korean soldiers in the DMZ, and the only thing stopping them from walking into South Korea are 37,000 US troops, and about a million land mines along the border. We have said over and over that we would be thrilled to sign this treaty if we could have an exemption for South Korea and we have been rebuffed. Rebuffed... I say.

From The West Wing, Season 3 – Episode 16 – “The U.S. Poet Laureate”.

diamondlovesyou··on Leap Smear
> It makes me angry that programmers feel that they "own" the concept of time measurement enough to propose the abolition of leap seconds. The definition of unix time excluding leap seconds is really the origin of this nonsense, and it has always seemed to me that the obvious solution is computers should simply measure seconds since the epoch. Wikipedia describes this version as the "TAI-based variant" of Unix Time, and if we all used it, computers wouldn't even have to care about leap seconds, and conversion to standard time display could be done in userland, accounting for leap seconds in the process.

That's not fair to programmers: the definition of a leap second is up to an international organisation (IERS), and more importantly leap seconds added in 2020 couldn't have been known by anyone in the 1970s. Leap seconds are added only six months before they are to take effect, as per wiki (https://en.wikipedia.org/wiki/Leap_second): "Because the Earth's rotation speed varies in response to climatic and geological events, UTC leap seconds are irregularly spaced and unpredictable."

diamondlovesyou··on Tesla auto-pilot keeps confusing moon with traffic light then slowing down
Yeah. But that's not what the OG comment is suggesting. The use of Lidar here would rule out a light resembling a traffic signal by virtue of there being no laser reflection of that object: lidar would complement vision to rule out false positives.
diamondlovesyou··on To manage wildfire, California looks to what tribes have known all along
Oil is CO2 that was previously removed from the cycle. So carbon positive.
diamondlovesyou··on Robots that can walk are now striding to market
Presumably, after it also cleans itself, yeah. Humans do it all the time.
diamondlovesyou··on Firefox 80 and my confusion over its hardware accelerated video on Linux
ChromeOS is Linux.
diamondlovesyou··on U.S. eyes building nuclear power plants on the moon, Mars
Yes, but in sports you don't die if you fail.
diamondlovesyou··on A Nvidia Engineer Wrote a Vulkan Driver That Works on Older Raspberry Pi
Don't worry too much: I am a native speaker and I was taught the same in elementary school!
diamondlovesyou··on Technical reasons to choose FreeBSD over GNU/Linux
I will likely be downvoted for saying this, but fuck it.

This "copyleft is free (as in freedom)" claim bothers me. Copyleft is not free (as in freedom). Its more like free (but this gun pointed at your temple will shoot if you do not agree with The One True Philosophy). That doesn't sound like freedom to me; more like thinly veiled tyranny. (I suppose this is mostly the fault of the redefinition of a derivative work, but that's a separate issue).

My definition of freedom means that every individual has the right to their own One True Philosophy, whatever that may be. Wanna write your software in the nude (as in publicly)? Be my guest. Wanna write code for Dept. of Defense missiles (which probably should never, ever be public)? Go nuts, IDGAF. Etc, etc.

The GPL is a mistake for software development. I don't mean that just because of what I said above. It's a mistake because of its infectious nature. Whether or not you or I agree (or any reason, it doesn't matter), you must comply. Like a Borg drone, with no freedom. With a non-copyleft licence, any library will still be useful no matter the licence of the software it's linked to (well, except the aforementioned GPL-ed code). See libstdc++ for an example: if it really were vanilla GPL, nobody would use the STL (or at least, not GCC's STL)!

(Written on my Kubuntu workstation).

diamondlovesyou··on Disc rot is a challenge for both archivists and collectors (2017)
I dislike CD. My equipment is capable of 192khz/32bit (some only 24bit though), so CD are pretty much trash at 41khz. Better than MP3, solely due to the info MP3 throws away, but not great.

Tidal goes higher, to 96khz on master quality where available (the vast number of tracks are not master quality, sadly).

diamondlovesyou··on Leaving Prison at 72
Those crimes happened wayyyy before drugs were prohibited. Banning drugs doesn't stop them.

Drugs don't pose an intrinsic danger anymore than cars pose an intrinsic danger.

← PreviousPage 2 of 4Next →