Giter Club home page Giter Club logo

Comments (3)

ashvardanian avatar ashvardanian commented on May 22, 2024 1

Hi @Seedking! Thanks for your effort! It would great to have SimSIMD in xmake!

The 2 issues your are seeing are unrelated to each other.


For the second issue, there are a couple of ways to fix it. Either avoid native f16 support entirely, by overriding SIMSIMD_NATIVE_F16=0. The second option would be to find a better way to infer native f16 support here:

#if !defined(SIMSIMD_NATIVE_F16) || SIMSIMD_NATIVE_F16
/**
* @brief Half-precision floating-point type.
*
* - GCC or Clang on 64-bit ARM: `__fp16`, may require `-mfp16-format` option.
* - GCC or Clang on 64-bit x86: `_Float16`.
* - Default: `unsigned short`.
*/
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__ARM_ARCH) || defined(__aarch64__)) && \
(defined(__ARM_FP16_FORMAT_IEEE))
#if !defined(SIMSIMD_NATIVE_F16)
#define SIMSIMD_NATIVE_F16 1
#endif
typedef __fp16 simsimd_f16_t;
#elif ((defined(__GNUC__) || defined(__clang__)) && (defined(__x86_64__) || defined(__i386__)) && \
(defined(__SSE2__) || defined(__AVX512F__)))
typedef _Float16 simsimd_f16_t;
#if !defined(SIMSIMD_NATIVE_F16)
#define SIMSIMD_NATIVE_F16 1
#endif
#else // Unknown compiler or architecture
#define SIMSIMD_NATIVE_F16 0
#endif // Unknown compiler or architecture
#endif // !SIMSIMD_NATIVE_F16
#if !SIMSIMD_NATIVE_F16
typedef unsigned short simsimd_f16_t;
#endif

It would be amazing if you could submit a patch for the f16 resolution here. It would help me a lot, and will be immediately used in USearch and several databases.


For the first issue, I suspect something is wrong with the following Clang/GCC __attribute__:

__attribute__((target("arch=armv8.2-a+dotprod"))) //
inline static void
simsimd_cos_i8_neon(simsimd_i8_t const* a, simsimd_i8_t const* b, simsimd_size_t n, simsimd_distance_t* result) {

It works fine in my pipelines, so can you please share the hardware you are running on and the compiler version.

from simsimd.

waruqi avatar waruqi commented on May 22, 2024 1

I have added it to xmake-repo. xmake-io/xmake-repo#3409

native f16 will be disabled now if _Float16 does not exist.

        if not package:has_ctypes("_Float16") then
            package:add("defines", "SIMSIMD_NATIVE_F16=0")
        end

from simsimd.

Seedking avatar Seedking commented on May 22, 2024

thank you answer! i will try to add all your repo to xmake

from simsimd.

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.