k47
k47q.bsky.social
k47
@k47q.bsky.social
Eat the rich
how can we run 4 IPC with only two 512bits SIMD ALUs? that what's register renaming gives you. there's 118 G instructions, but only 81 G μops hits the backend
January 9, 2026 at 11:57 AM
wow, this chunk of full-width avx512 code is running at 4.2 instructions per cycle near the peak single core boost frequency
January 9, 2026 at 11:56 AM
the only interesting thing in this article is that the go compiler still cannot do even the most trivial if-conversion

skoredin.pro/blog/golang/...

meanwhile in the world of if-conversion/predication: research arxiv.org/pdf/2512.22390
January 8, 2026 at 3:24 PM
avx512 is absolutely fantastic

bit blending `(a & m) | (b & ~m)` is `vpxor, vpand, vpxor` sequence on avx2 but a single `vpternlogq` instruction on avx512

and on icelake/tigerlake cpus you can do two full width ternlogs every cycle
January 7, 2026 at 2:03 PM
každý den se nějaký čůrák za volantem najde.
margaras.k47.cz/@k47/statuse...
October 15, 2025 at 4:34 PM
fun fact: PHP manages memory using reference counting, but xml extensions for some reason implement their own reference counting on top of general reference counting.
github.com/php/php-src/...
#PHP
October 14, 2025 at 8:54 AM
if you just happen to write a very basic jit compiler (for PHP, lets say) that generates simple binary that's calling into opcode handlers, you are limited by throughput of call/ret instructions, which is not that good.
margaras.k47.cz/@k47/statuse...
#PHP
October 2, 2025 at 10:57 PM
if you want to write PHP from scratch, the first you have decide how you are going to manage memory
margaras.k47.cz/@k47/statuse...
#PHP
September 29, 2025 at 5:40 PM
to fight against despair i need a project

so what if i reimplemented php from scratch?

margaras.k47.cz/@k47/statuse...

#PHP
September 27, 2025 at 12:44 PM
August 30, 2025 at 9:56 AM
Podívejte, co plave na zdejších rybnících: Kachnička mandarinská. k47.cz/2025/kachnic...
August 8, 2025 at 12:43 PM
php references are hilarious. not even this simple loop is not guaranteed to terminate

for ($i = 0; $i < 100; $i++) {
$a = 0;
}

not if $a and $i are references to each other

$a = 0;
$i = &$a;

#PHP
July 3, 2025 at 5:12 PM
and there it is: GCC supports preserve_none attribute on x86

gcc.gnu.org/git/?p=gcc.g...

it's a feature precisely targeting tailcalling interpreters...

margaras.k47.cz/@k47/statuse...
June 28, 2025 at 3:07 PM
this is pretty interesting:

imagine you have an array of sorted integers

if you rotate each integer one bit to the right, you need single pass of 1-bit radix sort to make the sequence sorted again...

margaras.k47.cz/@k47/statuse...
June 24, 2025 at 3:26 PM
"I'm married to my job."

"So, what do you do?"

"Unemployed."
May 28, 2025 at 10:24 AM
PHP references are poison.

for example: what can we say about the type of variable $i?

for ($i = 0; $i < 1000; $i++) { f($i); }

one would expect that it can only be an integer, but no. function f can be something like this

function f(int &$arg) { $arg = "lol"; }

and then all bets are off.

#PHP
May 23, 2025 at 10:02 AM
error messages looks like this

ir_base[21].ops[1] insn reference (32825) is out of range
ir_base[21].ops[1] reference (32825) must be DATA
ir_base[21].ops[1] (32825) type is incompatible with...

reasonable if you just happen to be Dmitry Stogov, not if you are peasant like the rest of us

#PHP
April 13, 2025 at 12:29 PM
poking around in php jit is delightful. two key data types are declared like this:

typedef int32_t ir_ref;
typedef uintptr_t zend_jit_addr;

typesafety? never heard about it.

#PHP
April 13, 2025 at 12:27 PM
there's a little memory exhaustion attack againt #php for you: send this 21 byte json "[[[[[[[[[[1]]]]]]]]]]" and json_decode allocates 2160 bytes of memory. that's 100x amplification. 10MB malicious json that forces php to allocate 1GB of memory can be gzipped to 25 kB.
April 5, 2025 at 9:28 AM
It's time for a new version of phpmod.d - my library for painless #PHP extensions in D language.
github.com/kaja47/phpmo...

Summary here margaras.k47.cz/@k47/statuse...

Briefly: docs, debug build, multiple PHP versions, parity testing with PHP source, -fno-druntime, variadic functions and more.
April 3, 2025 at 6:31 PM
Wikipedické faktoidy #13 (válka, atentáty, konspirace, další války a hyperinflace) k47.cz/2025/wiki-fa...
Wikipedické faktoidy #13 (válka, atentáty, konspirace, další války a hyperinflace)
Nikdy nevím, kam mě putování wikipedií zavede. Začal jsem na stránce o klapkách na oči a přes seznam atentátů na Hitlera a lokální války, co vypukly těsně po skončení první světové války, jsem se…
k47.cz
March 31, 2025 at 8:58 PM
I'm preparing new version of phpmod.d library for simple development of native #PHP extensions (github.com/kaja47/phpmo...) and so it's time to recap news in the current one:
margaras.k47.cz/@k47/statuse...
GitHub - kaja47/phpmod.d: Write PHP extensions without unending misery of C, macros and PHP build system.
Write PHP extensions without unending misery of C, macros and PHP build system. - kaja47/phpmod.d
github.com
March 18, 2025 at 2:25 PM