Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
dzaima
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
33 ms
·
421.
▲
by
dzaima
2y ago
clang does have __builtin_rotateleft32 & co. gcc doesn't though. (but of course for both of those just doing the manual rotate should be fine like always)
422.
▲
by
dzaima
2y ago
Also a general problem is that HotSpot does not tolerate memory corruption, but for memory-unsafe languages you'd quite like to have an as-reasonable-as-possible debugging environment even if 60% of the heap was zeroed by bad code, whi
423.
▲
by
dzaima
2y ago
Perhaps there's an argument for having two debugging modes for compiled programs - the "basic" best-effort one that is what we already have, and a feature-complete one that requires tight runtime integration and cannot relate
424.
▲
by
dzaima
2y ago
But how do you get in the "debug it" mode? If you mark it as to-be-debugged ahead-of-time (e.g. adding a breakpoint) then it can indeed ahead-of-time set up exactly that spot to be debuggable from. If you just pause the VM at a ra
425.
▲
by
dzaima
2y ago
But they only allow you to look at it at certain points in time (unless requested more precisely ahead-of-time), and/or lose the ability to do a bunch of meaningful optimizations. Whereas compiled programs can be desired to be paused a
426.
▲
by
dzaima
2y ago
DWARF does contain turing-complete VM for doing unwinding, so theoretically it should already be possible to make a compiler that gives precise debug info everywhere, no new protocol necessary. But completely-reversible-anywhere optimizatio
427.
▲
by
dzaima
2y ago
Yeah, had edited my comment to expand a bit on that. Nevertheless, this is just one place where allocation of value objects may appear; and it looks like eliding allocations is still generally in the "optimization" category, rathe
428.
▲
by
dzaima
2y ago
With gcc & clang you can use __attribute__((always_inline)) to force-inline, even at -O0, giving an error if it's impossible.
429.
▲
by
dzaima
2y ago
Except even intrinsics aren't even that much of a guarantee - clang converts them to its internal operations and applies the same optimization passes over them as it does on its own autovectorized code; and there are no intrinsics for
430.
▲
by
dzaima
2y ago
With clang you can add "#pragma clang loop vectorize(assume_safety)" to a loop to reduce the burden of proof of vectorizability and to do it if at all possible, giving a warning when it fails to. gcc has "#pragma GCC ivdep&qu
431.
▲
by
dzaima
2y ago
Unfortunately, it doesn't look like there's much of a guarantee that value objects wouldn't result in heap allocations. https://openjdk.org/jeps/401 even contains: > So while many small value classes
432.
▲
by
dzaima
2y ago
This is determining the directly observable behavior rather than anything about microarchitectural specifics.
433.
▲
by
dzaima
2y ago
"way more" is 2 vs 4 ports (→5 for ≥alderlake); 1/cycle via shifts is probably good enough for most use-cases (though perhaps the more focused port pressure could be an issue with larger context). And with hard-coded immediat
434.
▲
by
dzaima
2y ago
x86 specifically is extra awful to decode because there's no easy way to tell the instruction length without doing a good portion of the decode process, so it ends up needing to attempt to decode at each byte offset. Valid lengths bein
435.
▲
by
dzaima
2y ago
Just take a guess at how the baby will be like and get everyone to pretend it already exists for the 8 months (and throw away the experience if mispredicted afterwards) :)
436.
▲
by
dzaima
2y ago
I'd perhaps put ARM vs RISC-V closer to like C# vs Java (or maybe JS vs Python) - on a high level rather similar, but a majority of the specifics don't really line up (especially at the uop level requiring dumping a bunch of previ
437.
▲
by
dzaima
2y ago
Here are the actual commits that all the fuss was about: https://android-review.googlesource.com/c/kernel/build/+/306... and those at https://android-review.googlesource.com/q/topic:
438.
▲
by
dzaima
2y ago
Here's some function list usage: for V0 here, branching on each potential character is inefficient; so an option is to do an array index-of among the characters, and pick out the respective function from a function list: https:/&
439.
▲
by
dzaima
2y ago
Basically any guarantee can be broken by an evil guaranteer. All this is saying is that this is a case of the user being required to uphold a guarantee, instead of the stdlib/language.
440.
▲
by
dzaima
2y ago
nit - Rust does allow memory leaks in safe code. https://doc.rust-lang.org/std/mem/fn.forget.html#safety
441.
▲
by
dzaima
2y ago
Oh cool! I've had a very unfinished unpublished SVG editor from a couple years ago with blender-ish controls that I started cleaning up a couple days ago; guess I don't need to anymore. Here are some things in mine that I've
442.
▲
by
dzaima
2y ago
This instruction at least is very trivial to emit - any sequence of bitwise logic ops over three inputs compiles to one ternlog always. This isn't at all a super-clever instruction, it's more a super-boring one. If anything, it si
443.
▲
by
dzaima
2y ago
As far as everything on uops.info goes, ternlog has the same throughput and latency as the two-operand logic instructions everywhere (with the mild exception of Zen 4 where it goes from 0.50 to 0.56 cycles/instr; which also shows as ha
444.
▲
by
dzaima
2y ago
The x86 instruction is named 'ternlog', and intrinsic - 'ternarylogic' though; while perhaps unfortunate, the title is appropriate. (and even then 'bitwise' already sort of takes place of what 'ternary
445.
▲
by
dzaima
2y ago
The k code at least isn't doing any heuristics for the iteration order, and is just doing a fold over the indices of zeroes in index-ascending order.
446.
▲
by
dzaima
2y ago
If there's information on input format, it is simple enough to trace through the following shapes, but it does force reading the code rather linearly. Operations which implicitly restrict the allowed shapes are unfortunately intentiona
447.
▲
by
dzaima
2y ago
Once you've learned the syntax of the language, long expressions like that are about as readable as however-many-dozen lines of JS/Python with 1-to-3-character variable names; i.e. some parts may be obvious if they're a commo
448.
▲
by
dzaima
2y ago
There a maximum error of 0.5 ulp for all of add/sub/mul/div/sqrt on all inputs (ok sin/cos & co typically have a couple ulp of error but close enough). And indeed it's well-understood that it can get proble
449.
▲
by
dzaima
2y ago
There is some magic that may somewhat help - delaying normalization to when it's actually necessary or the numbers get too large, and skipping steps if denominators are equal. But even then it'll be quite bad relative to floats, e
450.
▲
by
dzaima
2y ago
The meaningful difference with irrational computations on rationals vs floats is that in floats you have some inherent, expected, and well-understood imprecision that applies evenly over results of add/mul/div/sqrt/sin&#
More ›