BitNet icon indicating copy to clipboard operation
BitNet copied to clipboard

The CPU with ARM architecture failed to run `env_setup.py`.

Open Heht571 opened this issue 9 months ago • 1 comments

The CPU with ARM architecture failed to run env_setup.py. Make the following modifications:

  1. Change the code from
posix_memalign(&ptr, 64, size);
return ptr;

to

if posix_memalign(&ptr, 64, size) != 0:
    return nullptr;
  1. Change the code from
vec_c[{6}] += vec_v_left_{0}.val[0];
vec_c[{6}] += vec_v_right_{0}.val[0];
vec_c[{7}] += vec_v_left_{0}.val[1];
vec_c[{7}] += vec_v_right_{0}.val[1];

to

vec_c[{6}] = vaddq_s16(vec_c[{6}], vmovl_s8(vget_low_s8(vec_v_left_{0}.val[0])));
vec_c[{6}] = vaddq_s16(vec_c[{6}], vmovl_s8(vget_low_s8(vec_v_right_{0}.val[0])));
vec_c[{7}] = vaddq_s16(vec_c[{7}], vmovl_s8(vget_low_s8(vec_v_left_{0}.val[1])));
vec_c[{7}] = vaddq_s16(vec_c[{7}], vmovl_s8(vget_low_s8(vec_v_right_{0}.val[1])));
  1. Change the code from
const int8x16_t vec_zero = vdupq_n_s16(0x0000);

to

const int16x8_t vec_zero = vdupq_n_s16(0x0000);

After modification, it can be successful

Heht571 avatar Apr 28 '25 04:04 Heht571

https://github.com/microsoft/BitNet/issues/240

Benjamin-Wegener avatar Apr 28 '25 22:04 Benjamin-Wegener