不确定其他人是如何编译的。在 M2 Ultra 上,MSL 代码中存在相当多的错误:
ggml_metal_init: allocating
ggml_metal_init: found device: Apple M2 Ultra
ggml_metal_init: picking default device: Apple M2 Ultra
ggml_metal_init: default.metallib not found, loading from source
ggml_metal_init: loading '/Users/ggerganov/development/github/llama.cpp/ggml-metal.metal'
ggml_metal_init: error: Error Domain=MTLLibraryErrorDomain Code=3 "program_source:1073:11: error: pointer type must have explicit address space qualifier
float * cos_theta, float * sin_theta
^
program_source:1073:30: error: pointer type must have explicit address space qualifier
float * cos_theta, float * sin_theta
^
program_source:1079:9: error: use of undeclared identifier 'ramp_mix'
ramp_mix = rope_yarn_ramp(corr_dims[0], corr_dims[1], i0) * ext_factor;
^
program_source:1080:37: error: use of undeclared identifier 'ramp_mix'
theta = theta_interp * (1 - ramp_mix) + theta_extrap * ramp_mix;
^
program_source:1080:64: error: use of undeclared identifier 'ramp_mix'
theta = theta_interp * (1 - ramp_mix) + theta_extrap * ramp_mix;
^
program_source:1083:33: error: use of undeclared identifier 'logf'
mscale *= 1.0f + 0.1f * logf(1.0f / freq_scale);
^
program_source:1085:18: error: use of undeclared identifier 'cosf'
*cos_theta = cosf(theta) * mscale;
^
program_source:1086:18: error: use of undeclared identifier 'sinf'
*sin_theta = sinf(theta) * mscale;
^
program_source:1172:33: error: use of undeclared identifier 'n_orig_ctx'
rope_yarn_corr_dims(n_dims, n_orig_ctx, freq_base, beta_fast, beta_slow, corr_dims);
^
program_source:1223:57: error: explicit instantiation of 'kernel_rope' does not refer to a function template, variable template, member function, member class, or static data member
template [[host_name("kernel_rope_f32")]] kernel rope_t kernel_rope<float>;
^
program_source:1133:13: note: candidate template ignored: could not match 'void (const device void *, const device int32_t *, device float *, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, uint, uint3, uint3)' (aka 'void (const device void *, const device int *, device float *, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, unsigned int, uint3, uint3)') against 'void (const device void *, const device int32_t *, device float *, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, uint, uint3, uint3)' (aka 'void (const device void *, const device int *, device float *, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, unsigned int, uint3, uint3)')
kernel void kernel_rope(
^
program_source:1224:57: error: explicit instantiation of 'kernel_rope' does not refer to a function template, variable template, member function, member class, or static data member
template [[host_name("kernel_rope_f16")]] kernel rope_t kernel_rope<half>;
^
program_source:1133:13: note: candidate template ignored: could not match 'void (const device void *, const device int32_t *, device float *, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, uint, uint3, uint3)' (aka 'void (const device void *, const device int *, device float *, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, unsigned int, uint3, uint3)') against 'void (const device void *, const device int32_t *, device float *, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, uint, uint3, uint3)' (aka 'void (const device void *, const device int *, device float *, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, unsigned int, uint3, uint3)')
kernel void kernel_rope(
^
" UserInfo={NSLocalizedDescription=program_source:1073:11: error: pointer type must have explicit address space qualifier
float * cos_theta, float * sin_theta
^
program_source:1073:30: error: pointer type must have explicit address space qualifier
float * cos_theta, float * sin_theta
^
program_source:1079:9: error: use of undeclared identifier 'ramp_mix'
ramp_mix = rope_yarn_ramp(corr_dims[0], corr_dims[1], i0) * ext_factor;
^
program_source:1080:37: error: use of undeclared identifier 'ramp_mix'
theta = theta_interp * (1 - ramp_mix) + theta_extrap * ramp_mix;
^
program_source:1080:64: error: use of undeclared identifier 'ramp_mix'
theta = theta_interp * (1 - ramp_mix) + theta_extrap * ramp_mix;
^
program_source:1083:33: error: use of undeclared identifier 'logf'
mscale *= 1.0f + 0.1f * logf(1.0f / freq_scale);
^
program_source:1085:18: error: use of undeclared identifier 'cosf'
*cos_theta = cosf(theta) * mscale;
^
program_source:1086:18: error: use of undeclared identifier 'sinf'
*sin_theta = sinf(theta) * mscale;
^
program_source:1172:33: error: use of undeclared identifier 'n_orig_ctx'
rope_yarn_corr_dims(n_dims, n_orig_ctx, freq_base, beta_fast, beta_slow, corr_dims);
^
program_source:1223:57: error: explicit instantiation of 'kernel_rope' does not refer to a function template, variable template, member function, member class, or static data member
template [[host_name("kernel_rope_f32")]] kernel rope_t kernel_rope<float>;
^
program_source:1133:13: note: candidate template ignored: could not match 'void (const device void *, const device int32_t *, device float *, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, uint, uint3, uint3)' (aka 'void (const device void *, const device int *, device float *, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, unsigned int, uint3, uint3)') against 'void (const device void *, const device int32_t *, device float *, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, uint, uint3, uint3)' (aka 'void (const device void *, const device int *, device float *, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, unsigned int, uint3, uint3)')
kernel void kernel_rope(
^
program_source:1224:57: error: explicit instantiation of 'kernel_rope' does not refer to a function template, variable template, member function, member class, or static data member
template [[host_name("kernel_rope_f16")]] kernel rope_t kernel_rope<half>;
^
program_source:1133:13: note: candidate template ignored: could not match 'void (const device void *, const device int32_t *, device float *, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, uint, uint3, uint3)' (aka 'void (const device void *, const device int *, device float *, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, const constant float &, unsigned int, uint3, uint3)') against 'void (const device void *, const device int32_t *, device float *, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant int64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant uint64_t &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, uint, uint3, uint3)' (aka 'void (const device void *, const device int *, device float *, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant long &, const constant long &, const constant long &, const constant long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant unsigned long &, const constant int &, const constant int &, const constant int &, const constant float &, const constant float &, unsigned int, uint3, uint3)')
kernel void kernel_rope(
^
}