segmentation faults... oh boy

This commit is contained in:
Nicholas Young 2024-10-11 18:21:00 -07:00
parent ea1d173f24
commit 14c23be581

View file

@ -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);