Comments (8)
I don’t see how you can use simdutf without runtime dispatching. The implementations are system specific.
How would that work? How does the aarch64 implementation/kernel kicks in if you do not detect it?
from simdutf.
Ah, I really mean using a regular pointer for runtime dispatching instead of using an atomic, sorry for the confusion.
from simdutf.
@TerrorJack We use an atomic to ensure thread safety. We are open to changing this code, but one needs to prove that thread safety is maintained.
Honestly, a C++ platform that does not support atomics does not seem like a serious platform. Are you sure it is not supported?
from simdutf.
We are open to changing this code, but one needs to prove that thread safety is maintained.
Platforms that do support atomic
will continue to use it by default.
Honestly, a C++ platform that does not support atomics does not seem like a serious platform. Are you sure it is not supported?
I'm sure wasm32-wasi
doesn't have threads or atomics at the moment. The bundled libc
does not have pthread
, and the bundled libc++
does not ship anything threading related. And it is a serious platform! (well, at least serious enough for me to get paid.)
from simdutf.
Daniel, since the standard allows std::hardware_concurrency
to return 0, I wouldn't be worried about thread safety. ;)
I'd be happy if we end up with some macro definition that explicitly enables the use of bare pointers. However, by default we should assume <atomic>
is there.
from simdutf.
@TerrorJack It would nicer if we ended up with the following code:
#ifdef SIMDUTF_HAS_ATOMIC
template <typename T>
using simdutf::atomic = std::atomic;
#else
template <typaneme T>
using simdutf::atomic = dummy::atomic;
#endif
Where dummy::atomic
is a template providing the methods from std::atomic
we actually use.
from simdutf.
@WojciechMula IMHO adding dummy::atomic
logic would make the PR much more bloated. I'll let it sit for a bit longer to gather more opinions.
from simdutf.
@TerrorJack technically your solution is fine. However, there are too many ifdefs
--- five. :) There should be exactly one place in the code where we use an ifdef
. Please rethink your approach. It'd be fine if we introduce a new header file for atomics.
from simdutf.
Related Issues (20)
- add support for punycode HOT 2
- Assembler issues on old machines HOT 1
- Incorrect #define for icelake HOT 2
- Slow performance compared to v8 String::NewFromUtf8 HOT 8
- Add SVE support HOT 3
- Feature request: UTF8 Byte Length HOT 6
- Split out `simdutf::validate_utf8()` HOT 3
- Add support for Big Endian systems HOT 3
- Add support for WebAssembly SIMD128 HOT 2
- For short strings `convert_utf8_to_utf16le_with_errors` may sometimes cause buffer overflows by reading before the buffer when the input is not UTF-8 HOT 8
- Add Windows on ARM support HOT 3
- v3.2.1 build failure on arm64 macOS HOT 2
- Single-header version requires two files to be included HOT 7
- Compiling with clang on windows fails HOT 1
- Detect best implementation at compile time HOT 2
- `convert_valid_utf16_to_utf8` produces incorrect result HOT 1
- Excessive check for CLMUL on "Westmere" path HOT 8
- SIGILL on convert_utf8_to_utf16le HOT 26
- Implement latin 1 to UTF-8 "length" functions
- Compiler warning (level 2) C4146 with VS 2022 latest version HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simdutf.