Skip to content

[Benchmark] Local data-flow benchmark #941

@ThomasHaas

Description

@ThomasHaas

I just want to share a simple benchmark that benchmarks our handling of local data flow.

#include <assert.h>
#include <dat3m.h>

#define N 100

int main()
{
    int r1 = 0;
    for (int i = 0; i < N+1; i++) {
        if (__VERIFIER_nondet_bool()) { break; }
        r1 += i;
    }

    // Intermediate variable "phi = r1" should act like a phi-node. 
    // We need to make the assignment more complex/convoluted so that Dartagnan does not propagate it away.
    // int phi = (r1 + r1) / 2;

    int r2 = 0;
    for (int i = 0; i < N; i++) {
        if (__VERIFIER_nondet_bool()) { break; }
        r2 += r1;
        // r2 += phi;
    }

    assert(r2 <= N*(N*(N+1))/2);
}

Verifying this benchmark takes 25-40 seconds on my machine. With the intermediary phi assignment, it takes < 10 seconds.
I think this benchmark (or variants thereof) can also be used to test different data-flow encodings.
Maybe someone is interested in making Dartagnan faster using this benchmark :)
For example, we could automatically insert the phi node as mentioned here #576, or somehow make the data-flow encoding smarter to better reuse values.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions