1.9 KiB
title, type, source, source_url, author, handle, post_id, date, archived, draft, tags, description, in_reply_to, parent_post_id
| title | type | source | source_url | author | handle | post_id | date | archived | draft | tags | description | in_reply_to | parent_post_id | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @NOTimothyLottes This is super cool, but why map a file and not just stdout? | archive | https://x.com/static_assert_0/status/1857867668289663108 | static_assert(false) | static_assert_0 | 1857867668289663108 | 2024-11-16 | 2026-08-25 | false |
|
@NOTimothyLottes This is super cool, but why map a file and not just stdout? | 1857803914604618029 |
Source
- URL: https://x.com/static_assert_0/status/1857867668289663108
- Author: static_assert(false) (@static_assert_0)
- Posted: 2024-11-16 19:25:44
Branch
1/ @static_assert_0 ^1857867668289663108
@NOTimothyLottes
This is super cool, but why map a file and not just stdout?
2/ @vodangkhoa873 ^1857882178463608868
@static_assert_0 @NOTimothyLottes
The writes can be done concurrently from many threads?
3/ @NOTimothyLottes ^1857884114403340408
@vodangkhoa873 @static_assert_0
Yes, one 'atomicAdd(atomAdr,1)&65535' to get the line number (window of 65536 max lines) then write the line individually. Only contention is on that atomicAdd CPU instruction which is as minimal as possible.
I do the atomic add instruction using simple inline ASM (below)
4/ @static_assert_0 ^1857885819274453195
@NOTimothyLottes @vodangkhoa873
I love this, but are you not able to get that codegen with intrinsics or just normal C?
5/ @NOTimothyLottes ^1857887943261827446
@static_assert_0 @vodangkhoa873
I've been hand rolling intrinsics CPU-side in GCC with inline asm since the dawn of support for that. So haven't kept up with the high-level-lang mess fire since.