Comments (6)
That fix is broken - it's truncating the value to 32-bits before taking the popcount.
Any reason you don't use the __builtin_popcountll()
fallback, the same as __MINGW32__
? I suspect that fallback could just be
#if !defined(__x86_64__)
return static_cast<int>(__builtin_popcountll(v));
#else
from astc-encoder.
I'm new to this, so I did it this way.
Your patch fixed the build issue too and look better.
Thanks!
from astc-encoder.
Thanks for confirming - I'll get that in for 4.9.
from astc-encoder.
If, before writing the patch, I had read what the popcnt instructions do, I would have suggested the following patch:
return static_cast<int>(_mm_popcnt_u32(static_cast<uint32_t>(v)) + _mm_popcnt_u32(static_cast<uint32_t>(v >> 32)));
:-)
from astc-encoder.
Patch against main branch:
--- Source/astcenc_vecmathlib_sse_4.h.orig 2024-05-07 09:59:55 UTC
+++ Source/astcenc_vecmathlib_sse_4.h
@@ -1307,7 +1307,11 @@ ASTCENC_SIMD_INLINE vfloat4 dot3(vfloat4 a, vfloat4 b)
*/
ASTCENC_SIMD_INLINE int popcount(uint64_t v)
{
+#if defined(__x86_64__)
return static_cast<int>(_mm_popcnt_u64(v));
+#else
+ return static_cast<int>(__builtin_popcountll(v));
+#endif
}
#endif // ASTCENC_POPCNT >= 1
from astc-encoder.
Fixed on main.
from astc-encoder.
Related Issues (20)
- Crash: Progress Callback not initialized for Single-Threaded alpha-weight-scaling-radius path HOT 1
- Builds for wrong-architecture on M1 macs HOT 3
- How to encode RGB+A with dual weight planes? HOT 4
- How to minimize heap/stack memory usage of multiple contexts on mobile platform? HOT 4
- Emscripten SAFE_HEAP reports unaligned access in compute_quantized_weights_for_decimation. HOT 13
- The png do not support to load HOT 6
- The alpha channel is painted black during compression HOT 7
- 4.8.0 has "possible loss of data warning" in astcenc_find_best_partitioning.cpp HOT 2
- Despite ASTCENC_INVARIANCE ON, results on M2/Neon (macOS, clang) differ from X86_64/AVX2 (Ubuntu, GCC) HOT 4
- KTX2 format support for output textures HOT 3
- ASTC encoder output is resulting in a flipped image. HOT 5
- Using -pp-premultiply with sRGB compression gives a brigher than expected output HOT 16
- NEON any/all could be faster ...
- I think maybe there's a simple mistake HOT 1
- Try NEON dot product for 8-32 widening. HOT 1
- Improve SIMD table abstraction HOT 1
- Name the application threads HOT 1
- clang 20 warns about both -ffp-model=precise and -ffp-contract=off being set. HOT 5
- bad performance on mac mini apple m2 HOT 2
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 astc-encoder.