Giter VIP home page Giter VIP logo

Comments (8)

lamyj avatar lamyj commented on June 11, 2024

A bit more additional info

#include <xtensor/xtensor.hpp>

int main()
{
    {
        xt::xtensor<double, 1> a{0., 1.};
        xt::xtensor<double, 1> b = a && 0.;
    }

    {
        xt::xtensor<bool, 1> a{false, true};
        //xt::xtensor<bool, 1> b = a && false;
    }

    return 0;
}

from xsimd.

drew-parsons avatar drew-parsons commented on June 11, 2024

It's a bug in neon64 then :p

from xsimd.

serge-sans-paille avatar serge-sans-paille commented on June 11, 2024

I confirm the following xsimd-only snippet works on x86-64 but not on aarch64

#include <xsimd/xsimd.hpp>

auto pain() {
  xsimd::batch<bool> x,y;
  return x && y;
}

I'll investigate, thanks for bringing that up!

from xsimd.

drew-parsons avatar drew-parsons commented on June 11, 2024

In that case it's worth noting that xsimd is passing its own tests on arm64,
for v11 in particular, as 11.1.0-1exp4,
https://ci.debian.net/data/autopkgtest/unstable/arm64/x/xsimd/38216389/log.gz
(from https://ci.debian.net/packages/x/xsimd/unstable/arm64/ )

Does that mean xsimd::batch<bool> is not being tested in the xsimd unit tests?

from xsimd.

serge-sans-paille avatar serge-sans-paille commented on June 11, 2024

@JohanMabille We currently don't have support for batch<bool>. We could alias to batch<uint8_t> or try to be smart, à la std::vector<bool>. The actual implementation would be generic for point-to-point operations, but rather complex for shuffles and the like. Likewise memory operations would be slightly more complex, so I advocate for an alias to batch<uint8_t>. What do you think?

from xsimd.

serge-sans-paille avatar serge-sans-paille commented on June 11, 2024

After some extra digging: we actually don't really support xsimd::batch<bool, A> because we try to outsmart the user and decide it should be an xsimd::batch_bool<T, A>. It's all linked to simd_return_type and if I recall correctly, that's something that got baked in for xtensor. @JohanMabille, any thoughts?

from xsimd.

drew-parsons avatar drew-parsons commented on June 11, 2024

armhf is also affected, apparently the same problem from neon, https://ci.debian.net/data/autopkgtest/unstable/armhf/x/xtensor/38875115/log.gz

from xsimd.

JohanMabille avatar JohanMabille commented on June 11, 2024

It's all linked to simd_return_type and if I recall correctly, that's something that got baked in for xtensor

Not only for xtensor, it is required to promote types when playing with mixed arithmetic (std::complex<double> and double for instance) and to allow operations on "equivalent" types (like std::complex and xtl::complex for instance).

batch<bool> should definitely not support the same operations as batch<other_arithmetic_type>. I know the following is valid in C++:

bool b1 = true, b2 = false;
bool res = b1 + b2;

but I find it ugly and we should definitely avoid this in xsimd.

Also batch_bool must be constructible from boolscalars, not integers (even if C++ allows implicit conversions, we should not encourgae them in the API), so that's another reason for not aliasing it to batch<uint8_t>.

We could imagine aliasing it to batch_bool<uint8_t>, but then it would feel inconsistent with the return type of batch<double> == batch<double> for instance.

This issue is definitely a bug in the definition of simd_return_type, but we also need to understand why batch<bool> is allowed on x86/x64 architectures. and I don't remember why we allowed register for bool on x86/x64 architecture.

from xsimd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.