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
@NOTimothyLottes
This is super cool, but why map a file and not just stdout?
2/ @vodangkhoa873
@static_assert_0 @NOTimothyLottes
The writes can be done concurrently from many threads?
3/ @NOTimothyLottes
@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
@NOTimothyLottes @vodangkhoa873
I love this, but are you not able to get that codegen with intrinsics or just normal C?
5/ @NOTimothyLottes
@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.