You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There appears to be a memory corruption bug with new_library_with_data.
Calling it results in all kinds of weird errors. Here are a few I've run into today while trying to figure out my problem:
"readFunctionPublicOrPrivateMetadata:4956: failed assertion `Invalid library file/data (unexpected end of file)'"
"Compiler encountered an internal error"
"Function main0 does not exist" when trying to get a function from the library. And main0 does get listed when calling function_names, so the function definitely did exist.
"assertion failed: !ptr.is_null()" (in metal-0.27.0/src/pipeline/render.rs:675:1)
Writing the exact same data to disk and using new_library_with_file instead works perfectly fine.
use metal;constBROKEN:bool = true;fnmain(){println!("Hello, world!");let device = metal::Device::system_default().unwrap();let data = std::fs::read("test.metallib").unwrap();let data_box = data.into_boxed_slice();let lib = ifBROKEN{
device.new_library_with_data(&data_box).unwrap()}else{
device.new_library_with_file("test.metallib").unwrap()};
std::mem::drop(data_box);let function = lib.get_function("main0",None).unwrap();let _pipeline = device.new_compute_pipeline_state_with_function(&function).unwrap();println!("Done");}
There appears to be a memory corruption bug with
new_library_with_data
.Calling it results in all kinds of weird errors. Here are a few I've run into today while trying to figure out my problem:
function_names
, so the function definitely did exist.Writing the exact same data to disk and using
new_library_with_file
instead works perfectly fine.Minimal reproducer that produces the failed assert inside the Metal driver with _with_data but not when using _with_file
The text was updated successfully, but these errors were encountered: