Stream: git-cranelift

Topic: cranelift / PR #1397 Add maximum threshold for number of ...


view this post on Zulip GitHub (Feb 19 2020 at 10:24):

nalmt opened PR #1397 from pathological_case_951 to master:

To fix this case (#951) that may take forever to compile:

function %a(){
ebb477777777:
}

We decide to define a maximum threshold for the number of blocks in functions.

Based on a large WASM program (https://github.com/mozilla/perf-automation/blob/master/benchmarks/wasm-misc/AngryBots.wasm),
its IR functions does not exceed 1414 blocks. A number 100 times greater (100,000 blocks) seems (currently) enough to define our maximum threshold.

To make this quick benchmark the cranelift-wasm/src/func_translator.rs file has been modified like this:

static mut MAX: usize = 0;

pub fn translate_from_reader<FE: FuncEnvironment + ?Sized>(...) {

    [...]

    builder.finalize();

    // the compiler is single threaded
    unsafe {
        if func.dfg.num_ebbs() > MAX {
            MAX = func.dfg.num_ebbs();
            println!("MAX {}", MAX);
        }
    }

    Ok(())
}

view this post on Zulip GitHub (Feb 19 2020 at 10:26):

bjorn3 submitted PR Review.

view this post on Zulip GitHub (Feb 19 2020 at 10:26):

bjorn3 submitted PR Review.

view this post on Zulip GitHub (Feb 19 2020 at 10:26):

bjorn3 created PR Review Comment:

const MAX_BLOCKS_IN_A_FUNCTION: u32 = 100_000;

view this post on Zulip GitHub (Feb 19 2020 at 11:07):

nalmt updated PR #1397 from pathological_case_951 to master:

To fix this case (#951) that may take forever to compile:

function %a(){
ebb477777777:
}

We decide to define a maximum threshold for the number of blocks in functions.

Based on a large WASM program (https://github.com/mozilla/perf-automation/blob/master/benchmarks/wasm-misc/AngryBots.wasm),
its IR functions does not exceed 1414 blocks. A number 100 times greater (100,000 blocks) seems (currently) enough to define our maximum threshold.

To make this quick benchmark the cranelift-wasm/src/func_translator.rs file has been modified like this:

static mut MAX: usize = 0;

pub fn translate_from_reader<FE: FuncEnvironment + ?Sized>(...) {

    [...]

    builder.finalize();

    // the compiler is single threaded
    unsafe {
        if func.dfg.num_ebbs() > MAX {
            MAX = func.dfg.num_ebbs();
            println!("MAX {}", MAX);
        }
    }

    Ok(())
}

view this post on Zulip GitHub (Feb 19 2020 at 11:24):

nalmt updated PR #1397 from pathological_case_951 to master:

To fix this case (#951) that may take forever to compile:

function %a(){
ebb477777777:
}

We decide to define a maximum threshold for the number of blocks in functions.

Based on a large WASM program (https://github.com/mozilla/perf-automation/blob/master/benchmarks/wasm-misc/AngryBots.wasm),
its IR functions does not exceed 1414 blocks. A number 100 times greater (100,000 blocks) seems (currently) enough to define our maximum threshold.

To make this quick benchmark the cranelift-wasm/src/func_translator.rs file has been modified like this:

static mut MAX: usize = 0;

pub fn translate_from_reader<FE: FuncEnvironment + ?Sized>(...) {

    [...]

    builder.finalize();

    // the compiler is single threaded
    unsafe {
        if func.dfg.num_ebbs() > MAX {
            MAX = func.dfg.num_ebbs();
            println!("MAX {}", MAX);
        }
    }

    Ok(())
}

view this post on Zulip GitHub (Feb 21 2020 at 12:47):

bnjbvr requested bnjbvr for a review on PR #1397.

view this post on Zulip GitHub (Feb 21 2020 at 12:58):

bnjbvr submitted PR Review.

view this post on Zulip GitHub (Feb 21 2020 at 12:58):

bnjbvr created PR Review Comment:

nit: since block numbers start at 0, there's an off-by-one here, and it will accept 100,000 blocks, but not 100,001, which is why the test had to contain the latter number. Can you use ">=" here instead, please?

view this post on Zulip GitHub (Feb 21 2020 at 12:58):

bnjbvr submitted PR Review.

view this post on Zulip GitHub (Feb 21 2020 at 12:58):

bnjbvr created PR Review Comment:

(and then you can adjust this number to be 100000.)

view this post on Zulip GitHub (Feb 23 2020 at 13:17):

nalmt updated PR #1397 from pathological_case_951 to master:

To fix this case (#951) that may take forever to compile:

function %a(){
ebb477777777:
}

We decide to define a maximum threshold for the number of blocks in functions.

Based on a large WASM program (https://github.com/mozilla/perf-automation/blob/master/benchmarks/wasm-misc/AngryBots.wasm),
its IR functions does not exceed 1414 blocks. A number 100 times greater (100,000 blocks) seems (currently) enough to define our maximum threshold.

To make this quick benchmark the cranelift-wasm/src/func_translator.rs file has been modified like this:

static mut MAX: usize = 0;

pub fn translate_from_reader<FE: FuncEnvironment + ?Sized>(...) {

    [...]

    builder.finalize();

    // the compiler is single threaded
    unsafe {
        if func.dfg.num_ebbs() > MAX {
            MAX = func.dfg.num_ebbs();
            println!("MAX {}", MAX);
        }
    }

    Ok(())
}

view this post on Zulip GitHub (Feb 23 2020 at 13:26):

nalmt updated PR #1397 from pathological_case_951 to master:

To fix this case (#951) that may take forever to compile:

function %a(){
ebb477777777:
}

We decide to define a maximum threshold for the number of blocks in functions.

Based on a large WASM program (https://github.com/mozilla/perf-automation/blob/master/benchmarks/wasm-misc/AngryBots.wasm),
its IR functions does not exceed 1414 blocks. A number 100 times greater (100,000 blocks) seems (currently) enough to define our maximum threshold.

To make this quick benchmark the cranelift-wasm/src/func_translator.rs file has been modified like this:

static mut MAX: usize = 0;

pub fn translate_from_reader<FE: FuncEnvironment + ?Sized>(...) {

    [...]

    builder.finalize();

    // the compiler is single threaded
    unsafe {
        if func.dfg.num_ebbs() > MAX {
            MAX = func.dfg.num_ebbs();
            println!("MAX {}", MAX);
        }
    }

    Ok(())
}

view this post on Zulip GitHub (Feb 23 2020 at 13:59):

nalmt requested bnjbvr for a review on PR #1397.

view this post on Zulip GitHub (Feb 24 2020 at 09:10):

bnjbvr submitted PR Review.

view this post on Zulip GitHub (Feb 24 2020 at 09:10):

bnjbvr merged PR #1397.


Last updated: Nov 22 2024 at 16:03 UTC