Comments (4)
This is because of SVE basically where the size of SIMD vectors is not known at compile time but only at runtime. That's why none of the NSIMD constructs are constexpr. If you look at the headers you will see the use NSIMD_STRUCT
so that when compiling for SVE this macro will be __sizeless_struct
which is currently supported by Armclang and the Fujitsu compiler.
May I ask in which construct you need the size at compile time?
from nsimd.
I was defining a std::array
where the size is rounded up to the next vector size, as in:
constexpr size_t vsize = pack<double>().size();
constexpr size_t N = (2*order+1 + vsize - 1) / vsize * vsize;
array<T,N> tmp;
I am currently using sizeof(pack<double>) / size(double)
as a work-around.
from nsimd.
Ah ok, in this case maybe nsimd::max_len
will be of use to you (from nsimd.h
)
#if NSIMD_CXX >= 2014
template <NSIMD_CONCEPT_VALUE_TYPE T>
constexpr int max_len = max_len_t<T>::value;
#endif
The downside is that its value is huge (namely (2048 bits) / bits(T)
) for two reasons:
- it is the maximum size of an SVE vector according to the SVE standard and
- we wanted a common value for all architectures in case, by some matters of facts, this value is (most probably indirectly) used as a parameter to code that is executed on different architectures (eg. serialization of data, computations on heterogeneous environments via MPI...)
In any case be careful with sizeof(pack<T>)
as this code won't compile when you will target an SVE architecture. I don't know about Arm's plans but my guess is that you will find SVE everywhere in the near future including Apple's computers. (https://www.arm.com/blogs/blueprint/armv9)
from nsimd.
Thanks. I'm using the value only for a temporary array, so I don't have a need for an architecture-independent value.
from nsimd.
Related Issues (20)
- Performance different on X86 and ARM service HOT 2
- Vector<nsimd::pack<T>> HOT 4
- Support Reg Size /2 HOT 1
- NSIMD generates too much assembly HOT 5
- There is not ‘&’ bitwise operator for ’packl‘ type and no conversion of 'pack' and 'packl' type
- nsimd defines `i64` etc. in global namespace HOT 3
- Provide a C11 API for core
- NSIMD SVE intrinsics generates movprfx HOT 3
- Provide cbrt HOT 1
- Provide += operators etc.
- mask_for_loop_tail produces scalar code HOT 2
- Provide fabs, fmax, fmin HOT 2
- Use Sleef math functions to complete NSIMD
- Provide more "inline" operators such as copysign, isfinite, etc... HOT 2
- Implement a `flipsign` function HOT 1
- Compile nsimd-2.2 on the ARM server HOT 2
- Document "andnot"
- Calculate i32 horizontal sum in nsimd. HOT 3
- Feature request: allow logical arguments for if_else1 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 nsimd.