got the configure vdevice call working

This commit is contained in:
Nicholas Young 2024-10-14 18:12:44 -07:00
parent 65d224db1a
commit 89370b7ff2

View file

@ -26,9 +26,9 @@ pub fn main() void {
var status: hlo.hailo_status = undefined; var status: hlo.hailo_status = undefined;
var vdevice : hlo.hailo_vdevice = undefined; var vdevice : hlo.hailo_vdevice = undefined;
var hef : hlo.hailo_hef = undefined; var hef : hlo.hailo_hef = undefined;
var device_params: hlo.hailo_vdevice_params_t = undefined; // std.mem.zeroInit(hlo.hailo_vdevice_params_t, .{}); var config_params: hlo.hailo_configure_params_t = undefined; // std.mem.zeroInit(hlo.hailo_vdevice_params_t, .{});
var network_group: hlo.hailo_configured_network_group = null; var network_group: hlo.hailo_configured_network_group = undefined;
const network_group_size : usize = 1; var network_group_size : usize = 1;
const input_vstream_params : [max_edge_layers]hlo.hailo_input_vstream_params_by_name_t = undefined; 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_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; const output_vstreams : [max_edge_layers]hlo.hailo_output_vstream = undefined;
@ -36,10 +36,11 @@ pub fn main() void {
var input_vstream_size : usize = max_edge_layers; var input_vstream_size : usize = max_edge_layers;
var output_vstream_size : usize = max_edge_layers; var output_vstream_size : usize = max_edge_layers;
// const net_ptr: [*c]usize = &network_group_size;
// @memset(&input_vstream_params, 0); // @memset(&input_vstream_params, 0);
// @memset(&output_vstream_params, 0); // @memset(&output_vstream_params, 0);
status = hlo.hailo_create_vdevice(null, &vdevice); status = hlo.hailo_create_vdevice(null, &vdevice);
assert(status == hlo.HAILO_SUCCESS); assert(status == hlo.HAILO_SUCCESS);
@ -48,12 +49,19 @@ pub fn main() void {
std.debug.print("vdevice inited, hef file created!\n", .{}); std.debug.print("vdevice inited, hef file created!\n", .{});
status = hlo.hailo_init_configure_params(hef, hlo.HAILO_STREAM_INTERFACE_PCIE, @ptrCast(&device_params)); status = hlo.hailo_init_configure_params_by_vdevice(hef, vdevice, &config_params);
assert(status == hlo.HAILO_SUCCESS); assert(status == hlo.HAILO_SUCCESS);
std.debug.print("Size of network_group: {any}\n", .{ @sizeOf(hlo.hailo_configured_network_group) });
std.debug.print("Init configure params complete\n", .{}); 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(vdevice != null);
assert(hef != null);
// assert(&config_params != null);
// assert(network_group != null); // configure inits this var
assert(network_group_size != 0);
status = hlo.hailo_configure_vdevice(vdevice, hef, &config_params, &network_group, &network_group_size);
assert(status == hlo.HAILO_SUCCESS); assert(status == hlo.HAILO_SUCCESS);
std.debug.print("Configure vdevice complete!\n", .{}); std.debug.print("Configure vdevice complete!\n", .{});