Skip to content

flag conflict -Ddynamic=false and -Dstatic_planning #469

@MirkoCalvi

Description

@MirkoCalvi

Description

For a correct codegeneration when you set -Dstatic_planning you should also set -Ddynamic=false, one exclude the other. I would consider to eliminate -Dstatic_planning and use the static tensor allocation as default method, and when -Ddynamic=false is set we use the dynamic allocation.

Pay also attention to TODO at line 106 in src/codegen/cg_v1/predict/predict.zig reported here:

    // Allocate output tensors for dynamic mode (only when NOT using plan-based execution)
    if (codegen_options.dynamic) {
        // TODO: When using plan-based execution, the PlanEmitter handles all tensor allocation
        // For now, we skip traditional output tensor allocation to avoid duplicates
        // In a complete implementation, we'd check if plan-based execution is enabled

        // Temporarily skip output tensor allocation to avoid conflicts with PlanEmitter
        // const output_tensors: []TensorZant = try IR_utils.getOutputs(tensorZantMap);
        // for (output_tensors) |*tz| {
        //     _ = try emit.ShapeEmitter.emit(writer, tz);
        //     const sanitized_name = try tz.getNameSanitized();
        //     const type_str = tz.ty.toString();
        //     try writer.print("    var tensor_{s} = Tensor({s}).fromShape(&allocator, &shape_tensor_{s}) catch return {d};\n", .{ sanitized_name, type_str, sanitized_name, templates.RC.INIT_ERROR });
        //     //since we are using dynamic inference  we also have to free the output_tensor so to avoid leaks, seee how I return the output tensor in writeReturn()
        //     try writer.print("    defer tensor_{s}.deinit();", .{sanitized_name});
        // }
    }

Update all the DOCS by consequence

Metadata

Metadata

Assignees

No one assigned

    Labels

    codegendocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions