Better HN
topnewbestaskshowjobs
Log inSign up

hsfzxjy

232 karma · joined Feb 9, 2021 (5y ago) · 84 submissions

github.com/hsfzxjy i.hsfzxjy.site
Submissions

comment 1mo ago · link · parent

I think `__slots__` should do the exact thing?

comment 2mo ago · link · parent

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

comment 2mo ago · link · parent

I have added a prober program which can run specific tests on linux and generate reports. This should be a nice start.

comment 2mo ago · link · parent

Let's play Doom on NPU!

comment 2mo ago · link · parent

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.

comment 2mo ago · link · parent

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...

comment 2mo ago · link · parent

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!

comment 2mo ago · link · parent

Author here. Feel free to ask any questions :)

comment 2mo ago · link · parent

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.

10.

Show HN: Npunlock – Run custom C kernels for Intel NPUs(github.com ↗)

67 points · by hsfzxjy · 2mo ago · 16 comments

comment 1y ago · link · parent

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.

12.

Show HN: VSCode-remote-glibc-patch – Patch legacy Linux to use VSCode Remote(github.com ↗)

5 points · by hsfzxjy · 1y ago · 1 comment

comment 1y ago · link · parent

Looks cursed to me.

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

14.

Cohesive Digests for Ints and Floats(i.hsfzxjy.site ↗)

2 points · by hsfzxjy · 1y ago · discuss

15.

Why does str implement AsRef<OsStr>?(old.reddit.com ↗)

1 points · by hsfzxjy · 2y ago · discuss

comment 2y ago · link · parent

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.

comment 2y ago · link · parent

> CJK line breaking is awful

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

comment 2y ago · link · parent

I wonder whether it's relevant to this

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

comment 2y ago · link · parent

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.

comment 2y ago · link · parent

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.

comment 2y ago · link · parent

Truly. But at first sight I couldn't parse the comma as anything else except a delimiter :(

comment 2y ago · link · parent

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.)

comment 2y ago · link · parent

Hexo for generation and hosted on Github Pages.

https://i.hsfzxjy.site

comment 2y ago · link · parent

> `break rust;` causing the Rust compiler to emit an internal compiler error

Is this real?

comment 2y ago · link · parent

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.

comment 2y ago · link · parent

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.

comment 2y ago · link · parent

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-...

comment 2y ago · link · parent

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.

comment 2y ago · link · parent

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.

comment 2y ago · link · parent

Yes. The program actually includes an ONNX runtime, which uses SIMD to accelerate NN inference.
123