[all-commits] [llvm/llvm-project] 497050: [mlir][sparse] Fixes bug in VarSet ctor

wren romano via All-commits all-commits at lists.llvm.org
Mon Jul 31 14:28:16 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 497050c961bbd4c13ea7ac8d6e80b9d7dd51e7ec
      https://github.com/llvm/llvm-project/commit/497050c961bbd4c13ea7ac8d6e80b9d7dd51e7ec
  Author: wren romano <2998727+wrengr at users.noreply.github.com>
  Date:   2023-07-31 (Mon, 31 Jul 2023)

  Changed paths:
    M mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMap.cpp
    M mlir/lib/Dialect/SparseTensor/IR/Detail/Var.cpp

  Log Message:
  -----------
  [mlir][sparse] Fixes bug in VarSet ctor

Previously, the commented out code in the `DimLvlMap` ctor would result in `VarSet::add` raising an OOB error; which should be impossible because the ctor asserted `DimLvlMap::isWF` which ensures that all variables occuring in the map are within bounds for the ranks.

The root cause of that bug was the `VarSet` ctor using `SmallBitVector::reserve` which does not actually change the size of the bitvectors (hence the subsequent OOB).  This is corrected by using any of `SmallBitVector::resize`, the move-ctor, or the copy-ctor.  Since the default-initialized bitvectors being modified/overwritten have size zero, there shouldn't be any significant performance difference between these three implementations.

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D155999




More information about the All-commits mailing list