HNHacker News
TopNewBestAskShowJobs

sharpneli

2,671 karma · joined October 4, 2010

Low level graphics programmer. Vulkan, DX12 etc. History with gpgpu stuff too.
submissionscomments
sharpneli··on Evidence of “modified gravity” in 150 galaxies bolsters dark matter alternative
http://backreaction.blogspot.com/2017/01/the-bullet-cluster-...

And same thing applies to LCDM. How does it explain bullet cluster, and several others, existing in the first place?

Disclaimer: I'm not a cosmologist even if I do have a background in physics. I do like following the field. It's just not quite so clear as you imply.

And if we go into things like superfluid dark matter then it doesn't really matter if its dark matter or some kind of modified gravity. One has bunch of equations and what matters is how they behave.

sharpneli··on Apple M1 foreshadows Rise of RISC-V
Yap. And ARM has the advantage of requiring a smaller frontend. Especially when one looks at wider decoders.

On the other hand if your ISA is the micro-ops directly then the instructions start to take ridiculous amounts of space. It's a balancing act between instruction size (to save instruction cache) and the complexity of decoding them.

And it's not just about being 1:1. It's also about how wide you can go. And variable length encodings simply are fundamentally more hard to parse in parallel fashion. That means a wider unit is harder to achieve, needing more space and power.

sharpneli··on Apple M1 foreshadows Rise of RISC-V
It took about 10 years for x86 to go to zero marketshare in servers into 80%+ in the 90's. Similar change in HPC market etc. So based on history the transition time is around 10 years, not tens of years.
sharpneli··on Apple M1 foreshadows Rise of RISC-V
And M1 does the same. All modern CPU's are really similar internally in that sense. ISA is just a frontend that gets translated into micro-ops that then get scheduled based on dependencies and available execution ports. Even the registers in ISA don't match the internal registers at all. ARM64 has 32 general purpose registers in ISA level. M1 seems to have 354 internally [Anandtech]

This is also the reason why the whole CISC and RISC debate in it's original form is outdated. The processors internally are all RISC. But the ISA can be more complex.

The x86 ISA makes the decoder harder to parallelize, so it takes more chip area compared to equivalent width for ARM64. And the wider you want to go the harder it becomes, whereas with ARM64 you just slap more decoders.

Another is the x86 memory model that restricts how stores can be issued into memory so that they're visible to other cores.

This is also a good thing for AMD. They could "just" make a Zen ARM CPU. Sure it would be a lot of work, but vast majority of the chip is shared.

sharpneli··on Apple M1 foreshadows Rise of RISC-V
> Nobody wanted the x86 ISA unless they needed it in systems which ran legacy applications.

It wasn't fast/efficient enough. If it had been faster or with better power consumption it would've been fine. There was a massive push to get Android studio to automatically compile X86 binaries for you etc.

But why would you put an Atom in your phone if it means it's slower and worse battery life? That's the reason it flopped. ISA change is a hindrance for switching, but it can be overcome. Even if Intel had sold Atom chips with ARM ISA and identical performance to the X86 variant it would have still flopped due to the poor performance and efficiency.

sharpneli··on California plan for wealth tax on anyone who spends 60 days a year in the state
Really? That’s more money than we use for the unemployed here in Finland. And they get healthcare, food and house.

SF is expensive for sure, but that expensive? Where is the money going to?

sharpneli··on Streaming Is Stalling: Can Music Keep Up in the Attention Economy?
The original post talked about this causing a lack of discovery for the new music. If the streamer doesn't pay and just uses non-copyrighted music no harm done to the streamer. It's still great fun. But the users don't get exposed to potentially interesting music content.

Why should the streamer pay for the privilege of being basically an advertisement platform for a commercial product? And they don't, and thus there is less discovery. Hence what is meant by the music industry shooting itself in the foot.

I personally listen mostly to music I listened as a teenager and early 20's. Sometimes I learn of something new and nice from my friends, but otherwise I find discovering new music quite hard.

A new game comes out: Tons of reviews and letsplays and whatnot. Looks interesting, I'll buy. New music comes out: Its advertised maybe in Spotify but that's it. Making a review or analysis is not possible (without paying extra), so I can't encounter it. And thus I won't listen it.

sharpneli··on Jetbrains founders turn billionaires without VC help
Good point. So they simply were not able to ramp up faster than it took for the existing manufacturers to start catching up and leveraging their scale better.
sharpneli··on Jetbrains founders turn billionaires without VC help
One can perhaps think of this as Teslas blind spot. People living with California wages don’t necessarily see the difference in prices mattering that much.
sharpneli··on Pointers Are Complicated II, or: We need better language specs
> On your remark about char*, it is an universal type alias, but I don't think it is an universal provenance alias

C doesn't have a concept of provenance in this fashion, or alternatively the compiler must assume the pointers may alias. This is why we have the restrict keyword.

The only cases where the compiler can assume things do not alias are when pointers are to different types (except for char).

Naturally the compiler is allowed to prove that some pointers cannot alias and optimize based on that. But if it messes up it's a compiler bug pure and simply.

sharpneli··on Pointers Are Complicated II, or: We need better language specs
I'm pretty sure there is no UB in the second part. It's just LLVM bug. The pointer comparison is valid (pointer to and object and to an another object that's one past the end MAY compare equal). The write is valid.

Reads and writes to char* always alias everything. Unless the compiler can prove that no writes happened it has to emit a read. So if it "forgets" due to the uintptr_t cast where the char* came from then it must assume that it can be pretty much arbitrary and must emit a read.

sharpneli··on A preview of x64 emulation on Windows for ARM
Large part yes. But not The reason. It’s fast because of many things like that. TSO doesn’t affect single core perf much so it’s not really a factor there, and yet it’s blazingly fast. However the multicore perf is really great too.

I haven’t verified the exact numbers myself. And it will depend on the exact thing you’re running. It’s just on the order of low tens of percents.

TSO cannot be enabled outside of rosetta as it’s not exactly a good arm extension. Perhaps you could do some trickery but Apple likely prevents that.

However you can test it by making something where you know rosetta generates comparable arm assembly from the X86 one and just run comparison that way. Some sort of parallel lockfree algorithm would be the best candidate.

sharpneli··on A preview of x64 emulation on Windows for ARM
Having to appear worked that way does cause restrictions in multiprocessor case. ARM chips naturally do all of that too, with the memory model simply giving them way more freedom to reorder things.

One couldn’t do X86 version of M1, mostly because there is no way of making an instruction decoder that wide for it.

And the performance penalty of M1 when working in TSO mode strongly implies that yes the weaker memory model indeed plays a major role. Not the biggest, but definitely not insignificant. Tens of percents here and tens of percents there combined become a ridiculous perf boost.

sharpneli··on A preview of x64 emulation on Windows for ARM
It has to flush them. Because if another core sees the result of the atomic op it must also see everything else that the other core wrote before the op. While it can indeed first see no writes and then suddenly all it can never see just the atomic op and not the previous writes.

Without that the store buffers can be kept unflushed to, as an example, see if one can get a full cacheline or whatnot and only flush then.

The comment is correct that an X86 with heavy reordering backend will beat arm without one. However arm with one does handily beat X86 with one. Case in point: M1

sharpneli··on A preview of x64 emulation on Windows for ARM
Yeah they did. Substantially https://www.google.fi/amp/s/cbslocal.com/2018/01/31/despite-...

” Cell phone robberies and thefts from persons went down 50 percent in the first two years after the kill switch became mandatory on phones. In the past two years they fell again by another 8 percent, to a total of 1,754 last year.” 2018

Not only that. Perhaps most importantly it curbed the growth rate.

sharpneli··on A preview of x64 emulation on Windows for ARM
Another major difference is the memory model. In X86 other CPU’s must always see the writes of a core exactly in the right order. This limits the ability to reorder store ops significantly. ARM requires a memory barrier for this. This is a major reason why X86 emulation is so slow. One must basically issue a memory barrier after every store op.

M1 actually also implements the X86 memory model too in HW. It’s only usable for the rosetta applications and comes with perhaps 20% perf penalty. But it’s still way better than emulating it with barriers.

In C++ terms it pretty much means X86 is always seq_cst. With ARM one can actually get benefit of the different memory model options. As an example one can do an atomic access without having to flush the whole store buffer out, which is impossible in X86.

Due to the instruction coding and memory model for multicore I don’t really see X86 dominating anymore in the upcoming decades.

And as the modern OoO cores are so similar internally it’s not even a big deal in the end. AMD shouldn’t have any issues with producing a Zen arm core. Switch the inst decoder and that’s pretty much it (ton of design work for sure). Keep the X86 mem model optional for emulation and binary translation can be almost thought as just making X86 instructions into fixed width ahead of time.

sharpneli··on A preview of x64 emulation on Windows for ARM
> Already every mac available for purchase, even the Intel ones, requires online activation to wipe and reinstall the storage

There is a massive practical upside of this. It makes thefts worthless, or almost worthless as the only value is spare parts.

It worked like a charm for phones. Thefts of smarphones were rising very rapidly but then diminished as they become worthless to steal.

However it would be nice to be able to disable this for allowing usage in offline environment.

sharpneli··on EU countries team up for semiconductor push
Non-competes are illegal in California. That’s likely a big reason why it is so successful. As an example neither Intel not AMD would exist if non-competes would be allowed there. Iirc Nvidia too.
sharpneli··on UN votes to remove cannabis from strictest drug category
This was news for me. Thanks for pointing this out. Makes sense to have cocaine at Schedule I.

Still, having Cannabis at Schedule IV is funny.

sharpneli··on UN votes to remove cannabis from strictest drug category
So wait. According to UN cannabis was more strictly limited than cocaine?

Based on perusal on the drug categories before this change one could get prescription of cocaine but not cannabis. This is absolutely hilarious.

sharpneli··on TSMC and Google push chipmaking boundaries with 3D 'stacking'
That's why I tried to use it more as a methaphor. Because the whole point of explicit VLIW (EPIC was what Itanium folks called it) was to save that scheduling HW. But nowadays that piece of HW is relatively minor part. So it's no longer worth to save it in a general purpose CPU. As this thread is about general purpose CPU's for direct consumer use (not a controller in hard drive or whatnot, but a full fledged CPU you run arbitrary programs in) we're talking about chips like Itanium when it comes to VLIW.

I do not disagree that VLIW is a great for things like DSP where the power consumption is of the essence. One can get ridiculously high perf/watt by going explicit VLIW. I just don't see any way we'd see that approach in general purpose CPU's again.

GPU's do not need to reorder instructions to hide memory latency. It just happens on a different level. While a single threadgroup (as in that single instruction pointer that controls the SIMD unit) will not get reordered at all, one has multiple threadgroups in flight. So if one group stalls at a memory load the unit will just schedule a different threadgroup. Because one generally has tons of them in flight. It's all about throughput. One could think of this as an in order CPU (from viewpoint of a single thread) but with ridiculous amounts of hyperthreading (one thread stalls, we can pick an instruction from another thread but never one from the stalled thread).

sharpneli··on TSMC and Google push chipmaking boundaries with 3D 'stacking'
That's a great point to emphasize. Because memory access times are inherently more or less nondeterministic.

I consider it to be roughly as important as being able to reorder instructions across non statically determined branches and function calls. And both of these expose the fundamental weakness in explicit VLIW, if it's essentially nondeterministic it cannot be taken advantage of.

Then we naturally have some other benefits, like hyperthreading. Which basically is just compiling two instruction streams together on the fly.

sharpneli··on TSMC and Google push chipmaking boundaries with 3D 'stacking'
The current CPU's already are VLIW in a fashion. Its just that they have a hardware jitter for it. That's what superscalar OoO CPU basically is, a piece of HW that generates VLIW instructions based on the normal instructions that come in. A superscalar execution port is basically just one subinstruction in VLIW. Explicit VLIW only helps you to save that piece of silicon from the chip. And it's not that much in the grand scheme of things. It used to be, but not anymore.

Static compile time VLIW means one cannot really make it wider anymore, or narrower. Dynamically doing it on runtime means a cheaper and smaller core can just be narrower. Remove an instruction slot for one integer ALU? Fine, no issues. Everything still works, albeit slower by that much. Make a beefier chip? Perfect, it got faster by the amount of instruction level parallelism that was available.

In addition a compiler cannot really see across function boundaries (except if it's statically determinable). A jitter can. Modern chips have reordering window of hundreds of instructions, M1 apparently goes up to over 600. That's quite a lot of stuff there that it can dynamically reorder across. A compiler might not have noticed that due to some weird dynamic call that was not visible during compilation time there is now an FPU instruction that could be inserted here, an OoO processor can.

Due to that explicit VLIW is basically dead outside of some highly specific applications, like DPS and whatnot.

In a similar fashion ridculously wide vector units were obsoleted by the approach pioneered by GPU's. Just add few things to allow masking based on branches and you get SIMT approach. Write as if it was scalar code and it'll run on HW that has vector lengths going from none at all up to whatever, NVidia has 32 wide vector units as an example.

sharpneli··on Artificial diamonds creation process generating lonsdaleite
It depends. In case of Artificial leather it refers clearly not to lab grown animal skin but to a completely different product that just tries to emulate leather.

So the word is used in different contexts. And De Beers is more than willing to use the term artificial diamond. They can claim that they're not lying, but they're also very happy that it's also easy for customers to think its artificial in the fake sense, not in the man-made sense.

sharpneli··on AMD Radeon RX 6800 and RX 6800 XT Review
> It does, but you can always disassemble the DXBC and see what happened to your HLSL code.

And you can always disasm X86 code and see what -ffast-math did. Doesn't mean that everyone would be fine with just mandating it everywhere with no option to disable it.

Even then the DX functional spec gives some leeway. As an example if you write x*y+z it will compile it into mad instruction. And that's just specified as that the precision must not be worse as the worst possible ordering of separate instructions. So which it is? Depends on the vendor. This is completely fine for graphics, but not fine for all workloads.

> No need for manual shenanigans with command queues

Unless you do access same buffer from multiple places in a way that's still spec conformant, just in a way that the DX11 implementation cannot detect.

sharpneli··on AMD Radeon RX 6800 and RX 6800 XT Review
Compiler does the reordering. Not the GPU itself. Even in OoO CPU’s the ordering by HW doesn’t affect FP results. As a rule of thumb shaders in graphics are compiled as if one had passed -ffast-math to the compiler. Works perfectly in most cases, but not everywhere.

Nowadays MS has actually published the spec for DX that was closed previously. See https://microsoft.github.io/DirectX-Specs/d3d/archive/D3D11_... for differences of strict IEEE behaviour. In Cuda and OpenCL one can get way closer. As an example for performance reasons one might want to flush denorms to zero. But DX mandates that. So no denormals for you. In CL and Cuda they’re usable by default.

As for the command queues. I’ve often used them in Cuda. Just to get overlap between kernel executions. In DX12 one can do that by omitting barriers. DX11 allows no such feat.

sharpneli··on AMD Radeon RX 6800 and RX 6800 XT Review
Basic fp ops like +-*/ are fine generally. It's more about the ability to prevent reodering of instructions (so that Kahan summation etc is not screwed up), and having well defined spec for the precision of things like transcendental functions. HLSL is bit better at controlling this than GLSL is.

It has also improved greatly. Using workgroup shared memory is now a thing. And also one can use subgroup ops that have been in Cuda for years.

Some of the other things like commandqueues are in Vulkan and DirectX12. But oh boy those are pain to program in compared to OpenCL or Cuda. Usability matters too.

sharpneli··on AMD Radeon RX 6800 and RX 6800 XT Review
That's just compute shaders in DirectX. They also support compute shaders in Vulkan and OpenGL.

It's not exactly the same as Cuda and OpenCL. Especially the numerical precision requirements are way off on graphics apis. And by way off I mean they're not always even specified what they should be.

sharpneli··on Valve Is Working on Another Extension to Help in Direct3D-over-Vulkan
Quick perusal of the extension would indicate that it’s main purpose is to help emulate dx12 more efficiently.

DX12 doesn’t have descriptorsets like Vulkan. It has descriptorheaps that are bit different. This extension basically makes them quite similar. First of all the descriptors can be stored into the same place (In Vulkan the descriptors are strongly typed.). With this an image or buffer etc can use same descriptor in a set, like DX12. In addition the CPU only heap is exposed in this, allowing the platform to directly implement DX12 heaps with desc sets.

Don’t really think this would help with DX11 at all. But it would make the mess that is DX12 binding model more tolerable to emulate.

Still not sure how would they emulate the root parameters to their full extent though.

sharpneli··on Fast Inverse Square Root
Linux is written in C. In C99 and later type punning trough unions is well defined operation. No issues there.

It’s C++ that’s lacking this feature. Not C.

← PreviousPage 5 of 21Next →