removed unecessary pointer tomfoolery

This commit is contained in:
Nicholas Young 2024-10-14 19:25:15 -07:00
parent 61597754a9
commit 77d85c5c54

View file

@ -11,7 +11,6 @@ const hef_file = "yolov7.hef";
const max_edge_layers = 32; const max_edge_layers = 32;
pub fn main() void { pub fn main() void {
// var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); // var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
@ -36,10 +35,6 @@ 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(&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);
@ -56,37 +51,33 @@ pub fn main() void {
assert(vdevice != null); assert(vdevice != null);
assert(hef != null); assert(hef != null);
// assert(&config_params != null);
// assert(network_group != null); // configure inits this var
assert(network_group_size != 0); assert(network_group_size != 0);
status = hlo.hailo_configure_vdevice(vdevice, hef, &config_params, &network_group, &network_group_size); 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", .{});
std.debug.print("And your network group iiiiisssss: '{any}'\n", .{ network_group });
status = hlo.hailo_make_input_vstream_params(network_group, false, hlo.HAILO_FORMAT_TYPE_AUTO, status = hlo.hailo_make_input_vstream_params(network_group, false, hlo.HAILO_FORMAT_TYPE_AUTO,
&input_vstream_params[0], &input_vstream_size); &input_vstream_params, &input_vstream_size);
// What in the world. I guess that's what happens when C uses start-base pointers for arrays
assert(status == hlo.HAILO_SUCCESS); assert(status == hlo.HAILO_SUCCESS);
std.debug.print("Input vstream params initialized\n", .{}); std.debug.print("Input vstream params initialized\n", .{});
status = hlo.hailo_make_output_vstream_params(network_group, true, hlo.HAILO_FORMAT_TYPE_AUTO, status = hlo.hailo_make_output_vstream_params(network_group, true, hlo.HAILO_FORMAT_TYPE_AUTO,
&output_vstream_params[0], &output_vstream_size); &output_vstream_params, &output_vstream_size);
assert(status == hlo.HAILO_SUCCESS); assert(status == hlo.HAILO_SUCCESS);
std.debug.print("Output vstream params initialized\n", .{}); std.debug.print("Output vstream params initialized\n", .{});
assert(input_vstream_size <= max_edge_layers); assert(input_vstream_size <= max_edge_layers);
status = hlo.hailo_create_input_vstreams(network_group, &input_vstream_params, input_vstream_size, &input_vstreams[0]); status = hlo.hailo_create_input_vstreams(network_group, &input_vstream_params, input_vstream_size, &input_vstreams);
assert(status == hlo.HAILO_SUCCESS); assert(status == hlo.HAILO_SUCCESS);
std.debug.print("Input vstreams initialized\n", .{}); std.debug.print("Input vstreams initialized\n", .{});
status = hlo.hailo_create_output_vstreams(network_group, &output_vstream_params, output_vstream_size, &output_vstreams[0]); status = hlo.hailo_create_output_vstreams(network_group, &output_vstream_params, output_vstream_size, &output_vstreams);
assert(status == hlo.HAILO_SUCCESS); assert(status == hlo.HAILO_SUCCESS);
std.debug.print("Output vstreams initialized\n", .{}); std.debug.print("Output vstreams initialized\n", .{});
@ -95,11 +86,6 @@ pub fn main() void {
_ = hlo.hailo_release_input_vstreams(&input_vstreams, input_vstream_size); _ = hlo.hailo_release_input_vstreams(&input_vstreams, input_vstream_size);
_ = hlo.hailo_release_hef(hef); _ = hlo.hailo_release_hef(hef);
_ = hlo.hailo_release_vdevice(vdevice); _ = hlo.hailo_release_vdevice(vdevice);
std.debug.print("output vstream size is: {any}\n", .{output_vstream_size});
// write_to_hlo(_, alloc);
} }
fn write_to_hlo(input_stream: hlo.hailo_input_vstream, alloc: Allocator) bool { fn write_to_hlo(input_stream: hlo.hailo_input_vstream, alloc: Allocator) bool {