From 14c23be58128e54e1d741eeba82d01b266f2c4ee Mon Sep 17 00:00:00 2001 From: Nicholas Young Date: Fri, 11 Oct 2024 18:21:00 -0700 Subject: [PATCH] segmentation faults... oh boy --- src/main.zig | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main.zig b/src/main.zig index c2f93aa..20ca23a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -26,8 +26,9 @@ pub fn main() void { var status: hlo.hailo_status = undefined; var vdevice : hlo.hailo_vdevice = undefined; var hef : hlo.hailo_hef = undefined; - var device_params: hlo.hailo_vdevice_params_t = std.mem.zeroInit(hlo.hailo_vdevice_params_t, .{}); - var network_group: hlo.hailo_configured_network_group = undefined; + var device_params: hlo.hailo_vdevice_params_t = undefined; // std.mem.zeroInit(hlo.hailo_vdevice_params_t, .{}); + var network_group: hlo.hailo_configured_network_group = null; + const network_group_size : usize = 1; const input_vstream_params : [max_edge_layers]hlo.hailo_input_vstream_params_by_name_t = undefined; const output_vstream_params : [max_edge_layers]hlo.hailo_output_vstream_params_by_name_t = undefined; const output_vstreams : [max_edge_layers]hlo.hailo_output_vstream = undefined; @@ -35,8 +36,8 @@ pub fn main() void { var input_vstream_size : usize = max_edge_layers; var output_vstream_size : usize = max_edge_layers; - @memset(&input_vstream_params, 0); - @memset(&output_vstream_params, 0); + // @memset(&input_vstream_params, 0); + // @memset(&output_vstream_params, 0); status = hlo.hailo_create_vdevice(null, &vdevice); @@ -44,13 +45,19 @@ pub fn main() void { status = hlo.hailo_create_hef_file(&hef, hef_file); assert(status == hlo.HAILO_SUCCESS); + + std.debug.print("vdevice inited, hef file created!\n", .{}); status = hlo.hailo_init_configure_params(hef, hlo.HAILO_STREAM_INTERFACE_PCIE, @ptrCast(&device_params)); assert(status == hlo.HAILO_SUCCESS); - status = hlo.hailo_configure_vdevice(vdevice, hef, @ptrCast(&device_params), &network_group, 1); + std.debug.print("Init configure params complete\n", .{}); + + status = hlo.hailo_configure_vdevice(vdevice, hef, @ptrCast(&device_params), &network_group, @constCast(&network_group_size)); assert(status == hlo.HAILO_SUCCESS); + std.debug.print("Configure vdevice complete!\n", .{}); + status = hlo.hailo_make_input_vstream_params(network_group, true, hlo.HAILO_FORMAT_TYPE_AUTO, @constCast(&input_vstream_params), &input_vstream_size); assert(status == hlo.HAILO_SUCCESS);