HNHacker News
TopNewBestAskShowJobs

hsfzxjy

231 karma · joined February 9, 2021

github.com/hsfzxjy i.hsfzxjy.site
submissionscomments
hsfzxjy··on Show HN: Npunlock – Run custom C kernels for Intel NPUs
Seems that Intel prefer to provide a unified interface across different hardwares so hiding the low-level stuff is convenient. It was told by someone worked at Intel in another reddit thread.

https://www.reddit.com/r/ReverseEngineering/s/hv2N41pXO5

hsfzxjy··on Show HN: Npunlock – Run custom C kernels for Intel NPUs
I have added a prober program which can run specific tests on linux and generate reports. This should be a nice start.
hsfzxjy··on Show HN: Npunlock – Run custom C kernels for Intel NPUs
Let's play Doom on NPU!
hsfzxjy··on Show HN: Npunlock – Run custom C kernels for Intel NPUs
Yes. But WSL doesn't come with NPU passthrough, so I still can't test the hardware-specific behavior. Cross-compiling the project with WSL is plausible. I will try it and leave for the community to do verification.
hsfzxjy··on Show HN: Npunlock – Run custom C kernels for Intel NPUs
I have no access to other environment setting, so, sadly, that's the best I can do for now.

But based on my understanding, playing this on Linux or newer NPU generations might be possible. I have recorded my hypotheses in [0]. Verifying the hypotheses would require additional utility tools, which I am stilling crafting.

[0]: https://github.com/hsfzxjy/npunlock/blob/master/wiki/PORTING...

hsfzxjy··on Show HN: Npunlock – Run custom C kernels for Intel NPUs
Thanks! I can observe similar behaviors on my laptop. FP32 operations are sometimes siliently lowered to a sequence of (FP32->FP16)->(FP16 OP)->(FP16->FP32), causing precision loss. It further frustrated me during npunlock development. Changing custom SHAVE OP from FP16 -> FP32 also changes the blob structure, and I have to explore different binary patching strategy.

As for the interesting cost variance for reshape you've mentioned, I guess surrounding context is the cause. The NPU compiler might adjust the data layout to match successive OPs' requirements. But, yes, that's annoying~

Studying DPU is not my current priority, but I may dig it up in the future to understand its invocation descriptor, and hopefully to discover more interesting stuff. I hope this project ends up being useful to you!

hsfzxjy··on Show HN: Npunlock – Run custom C kernels for Intel NPUs
Author here. Feel free to ask any questions :)
hsfzxjy··on Show HN: Npunlock – Run custom C kernels for Intel NPUs
The main use is enabling developers to write their own NPU kernels according to their respective need, instead of picking workaround from what Intel provides in OpenVINO. I think the project would benefit three scenarios:

1. Implement uncommon NN operators.

2. Implement a high-precision (FP32, etc.) version of existing OpenVINO operators for numerically sensitive usage.

3. Implement a mega kernel that fuse several small kernels together to reduce SHAVE invocations, and potentially improve performance.

But most importantly, it gives you more control over the hardware you own. That control IMO should have been yours from day one you bought the machine.

hsfzxjy··on That XOR Trick (2020)
To derive "The XOR trick" I think both *associativity* and communitativity are needed.

That is, one should also prove a ^ (b ^ c) = (a ^ b) ^ c. Instinctive, but non-trivial.

hsfzxjy··on C++: terser (shorter) lambda == SHORTY (ab-use?)
Looks cursed to me.

But TIL dollar sign $ is also valid character for identifiers.

hsfzxjy··on Dev Fonts
I'm with you. Sometimes the symbols are ambiguous and totally unreadable.

An example is >>=, which is "inplace shr" in some languages, but "monad bind" in others. A unified ligature for >>= really confuses me.

hsfzxjy··on Typesetting Engines: A Programmer's Perspective
> CJK line breaking is awful

It's not true for Chinese. Chinese allows line breaks after any characters.

hsfzxjy··on FLUX1.1 a Prompt Like "IMG_1018.CR2"
I wonder whether it's relevant to this

https://news.ycombinator.com/item?id=42102506

hsfzxjy··on Character amnesia in China
Meanwhile, another trend among Chinese teenagers is the use of Pinyin initials to replace Chinese words. For example, 永远的神 (pinyin: Yǒngyuǎn de shén), a meme used to praise something, is often written as "yyds."

These teens have become accustomed to reading and writing sentences composed of such acronyms, and they even use them in real-life conversations—much to the annoyance of cultural conservatives. This phenomenon highlights how online communication can influence offline speech patterns.

hsfzxjy··on Tell HN: Moving Away from GitHub (2FA)
You may self-host a vaultwarden to serve TOTP and install a website extension. To login you just click the extension for code and no need for any mobile app.
hsfzxjy··on Linux boots in 4,76 days on Intel 4004
Truly. But at first sight I couldn't parse the comma as anything else except a delimiter :(
hsfzxjy··on Linux boots in 4,76 days on Intel 4004
I mistakenly think the guy took over a year to boot Linux/4004 due to the comma in the post title.

(I was aware that comma represents decimal point in some regions, just didn't get this in the first place.)

hsfzxjy··on Ask HN: What do you use for your personal blog?
Hexo for generation and hosted on Github Pages.

https://i.hsfzxjy.site

hsfzxjy··on Python’s Preprocessor
> `break rust;` causing the Rust compiler to emit an internal compiler error

Is this real?

hsfzxjy··on Show HN: Handwriter.ttf – Handwriting Synthesis with Harfbuzz WASM
You can run the demo locally following the Usage part. Currently the WASM shaper feature is not enabled in any browser, so the demo won't work in web pages.
hsfzxjy··on Show HN: Handwriter.ttf – Handwriting Synthesis with Harfbuzz WASM
The handwriting in fact consists of multiple "tiny black box" glyphs, similar to pixels in traditional rendering. The program takes the text (e.g., "Hello world") as input, and works out the (x, y) locations of these block boxes.
hsfzxjy··on Show HN: Handwriter.ttf – Handwriting Synthesis with Harfbuzz WASM
I didn't train the model myself. A pretrained model is adopted from another repo [0].

[0]: https://github.com/X-rayLaser/pytorch-handwriting-synthesis-...

hsfzxjy··on Show HN: Handwriter.ttf – Handwriting Synthesis with Harfbuzz WASM
The answer is "no why", just for fun :) Though I learned a lot about how to stuff an NN model in a WASM binary and some tricks to optimize performance.
hsfzxjy··on Show HN: Handwriter.ttf – Handwriting Synthesis with Harfbuzz WASM
The project must be tested in an application linked against libharfbuzz with WASM shaper enabled. Since it's not easy to build a library like this, I make a Docker image which contains both the ttf file and a modified gedit, so that anyone can test the project with a single command.
hsfzxjy··on Show HN: Handwriter.ttf – Handwriting Synthesis with Harfbuzz WASM
Yes. The program actually includes an ONNX runtime, which uses SIMD to accelerate NN inference.
hsfzxjy··on Show HN: Handwriter.ttf – Handwriting Synthesis with Harfbuzz WASM
You can't test it in a browser, since no browser at present is linked against libharfbuzz with WASM shaper. Instead, one can test it with a modified local program such as gedit in the demo.

As convenience, I built a Docker image that packs both the ttf file and the modified gedit together. You can try it out via `make run` as stated in the instructions.

hsfzxjy··on Show HN: Handwriter.ttf – Handwriting Synthesis with Harfbuzz WASM
This is just a project for fun, like llama.ttf.

WASM shaper is still experimental and not yet shipped in and products, not before more limitation carried out as I think. So I'm not too worried about it.

hsfzxjy··on Show HN: Handwriter.ttf – Handwriting Synthesis with Harfbuzz WASM
wasm has SIMD extension https://github.com/WebAssembly/simd/blob/master/proposals/si... . You can use them even in browsers (e.g. Chrome >= 91)
hsfzxjy··on Can a Rust binary use incompatible versions of the same library?
So both versions of log crate manage their own internal states within the same process? Would this lead to surprising results?
hsfzxjy··on By law, Chinese citizens must install the gov't spyware – ''anti-fraud'' app
It's not "enforced by law", but recommended.
Page 1 of 2Next →