Coder Social home page Coder Social logo

Comments (5)

lilongxian avatar lilongxian commented on May 29, 2024

我编译llama.cpp时也遇到类似的问题,我是在报错的.c文件中重新定义了报错函数的宏。我用的是ubuntu 虚拟机,编译后cpu运行都可以。

from inferllm.

zhaijunxiao avatar zhaijunxiao commented on May 29, 2024

我编译llama.cpp时也遇到类似的问题,我是在报错的.c文件中重新定义了报错函数的宏。我用的是ubuntu 虚拟机,编译后cpu运行都可以。

我也是Ubuntu虚拟机遇到了这个问题,能否贴一下定义的宏函数,可以的话,非常感谢。

from inferllm.

chenqy4933 avatar chenqy4933 commented on May 29, 2024

我编译llama.cpp时也遇到类似的问题,我是在报错的.c文件中重新定义了报错函数的宏。我用的是ubuntu 虚拟机,编译后cpu运行都可以。

@lilongxian 欢迎提一个 PR

from inferllm.

huixiao8973 avatar huixiao8973 commented on May 29, 2024

看了大家的解决方案,我也想了一个笨办法。

_mm256_fmadd_ps 是 AVX2 指令集,我的 CPU 不支持,只支持 AVX ,所以,把 _mm256_fmadd_ps 这个函数替换为 AVX 的函数。这个函数在 src/kern/optimized/x86/optimized_x86.h 中使用了两次。

目前的替换方案是:

// acc = _mm256_fmadd_ps(scale, p, acc);
__m256 tmp = _mm256_mul_ps(scale, p);
acc = _mm256_add_ps(tmp, acc);

目前编译通过了,运行示例也正常。大家看看这样有没有问题?以前没接触过相关的指令集函数。

from inferllm.

lilongxian avatar lilongxian commented on May 29, 2024

我在llama.cpp中遇到 _mm256_set_m128i函数报错时我的宏定义如下(llama.cpp中在ggml.c 、 k_quants.c中添加):

/* 编译报错error: incompatible types when initializing type ‘__m256i ... */
#define _mm256_set_m128i(v0, v1) _mm256_insertf128_si256(_mm256_castsi128_si256(v1), (v0), 1)
#define _mm256_setr_m128i(v0, v1) _mm256_set_m128i((v1), (v0))

希望能给遇到类似问题的同学带来一点帮助。
非常感谢 @chenqy4933 大牛专家贡献的 InferLLM c++版本,推理速度上明显比llama.cpp要快很多,代码结构简洁整齐,便于在此基础上改进与适配,和llama.cpp并驾齐驱,是目前尚且鲜有的大模型加速推理c++版本,未来在大模型开源社区发展潜力巨大,非常值得关注!

from inferllm.

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.