Open yIllusionSky opened 5 months ago
I used to have some similar issue in the past where all the bf16
kernels where missing. This was due to an outdated gcc/g++ toolchain (using version 12.0), using the latest version that comes with xcode (15.0) fixed it for me so maybe you could try this.
Fwiw here is much shorter example that would have triggered the issue.
fn main() -> Result<()> {
let device = Device::new_metal(0)?;
let a = Tensor::new(&[[0.0f32, 1.0, 2.0], [3.0, 4.0, 5.0]], &device)?;
let a = a.to_dtype(candle_core::DType::BF16)?;
let a = a.to_dtype(candle_core::DType::F16)?;
println!("{a}");
Ok(())
}
I used to have some similar issue in the past where all the
bf16
kernels where missing. This was due to an outdated gcc/g++ toolchain (using version 12.0), using the latest version that comes with xcode (15.0) fixed it for me so maybe you could try this. Fwiw here is much shorter example that would have triggered the issue.fn main() -> Result<()> { let device = Device::new_metal(0)?; let a = Tensor::new(&[[0.0f32, 1.0, 2.0], [3.0, 4.0, 5.0]], &device)?; let a = a.to_dtype(candle_core::DType::BF16)?; let a = a.to_dtype(candle_core::DType::F16)?; println!("{a}"); Ok(()) }
My Xcode version is 15.3. I just checked my GCC version with gcc -v and it is 15.0. I tried the code you provided and still encountered the error: 'Error: Metal error Error while loading function: "Function 'cast_f32_bf16' does not exist".' I have tried specifying dependencies with git and version 0.50, but neither worked.
@LaurentMazare would it make sense to compile the kernels into a metallib
file in a cargo build script? I'm running into an unrelated issue where a to_vec1
call after the first forward pass is very slow and it's been suggested it's due to the kernel compilation that needs to happen.
I made some modifications to the example code in llama3 for it to run locally, but I encountered an error during execution. I am using a MacBook with an M3 chip. Below is the Rust code (I have omitted some irrelevant parts):
When I execute cargo run, the following error occurs: