Skip to content

Benchmark fast_ssa_liveness #100

Description

@vaivaswatha

The fast_ssa_liveness analysis introduced recently is quite complex. We need some benchmarking to justify its presence in pliron.

What to measure?

Considering that we can compile bzip2 through pliron, we can do the following:

  1. Instrument a "pass" that computes LivenessInfo for a module
  2. Collect all values in the module.
  3. Test liveness of every value at every program point
  4. Measure time for (1) and (3)
  5. Repeat over all modules.

Comparison

It may be worthwhile to implement a simpler liveness query system (such as Algorithm 6 in [1]).

Note: Any new liveness implementation only needs to implement the RegionLiveness trait. Liveness<T: RegionLiveness> will take care of the rest.

Further experiments:

  1. The paper discusses an optimization for reducible graphs when querying is_live_in_block. This is implemented in our code too. This optimization doesn't (seem to) hold for is_live_out_block. In practice, is_live_out_block seems to be the more useful one. So in some cases (such as when there are, say, only 2 successors), when it's a reducible CFG, we can fall back to live_out = Union_{succ in successors} { live_in (succ) } and see if that's faster than calling is_live_out_block.
  2. Data-structure choice can be experimented with too. MLIR (Liveness.cpp) seems to use SmallPtrSet which is hash-table based. LiveVariables in LLVM's codegen uses sparse-bit-vectors. We could experiment b/w the current hi_sparse_bitset and FxHashSet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions