Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Crash on long loops #22

@akokoshn

Description

@akokoshn

profiling_assignment_table call crash in case of huge assigment argument.

Issue observe on loop size ~ 200000 iteration.

Loop cpp example:

#include <cstddef>
[[circuit]] int func(const int num) {
    int x = 1;
    for (int i = 0; i < num; i++) {
        x++;
    }
    return x;
}

IR execution log:

_Z4funci:
 	%1:
 		icmp (0 %0 ) -> %2
 		br
 	%5:
 		phi (%9 0 ) -> %6
 		phi (%8 1 ) -> %7
 		add (%7 1 ) -> %8
 		add (%6 1 ) -> %9 // increment loop iterator, add var "var_2_35_witness" = 1 
 		icmp (%9 %0 ) -> %10
 		br
 		    Add new var: var_2_35_witness = 1 - incremented loop terator
 		phi (%9 0 ) -> %6
 		phi (%8 1 ) -> %7
 		add (%7 1 ) -> %8
 		add (%6 1 ) -> %9 // increment loop iterator, add var "var_2_71_witness" = 2
 		icmp (%9 %0 ) -> %10
 		br
 		    Add new var: var_2_71_witness = 2
 	%3:
 		phi (1 %8 ) -> %4
 		ret
 		    res = 3
 		    stack: [ var_0_0_public_input var_0_2_public_input var_0_33_witness var_0_3_public_input var_2_70_witness var_2_35_witness var_2_34_witness var_2_70_witness var_2_71_witness var_0_105_witness ]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions