[all-commits] [llvm/llvm-project] e92108: [mlir][sparse] Add `has_runtime_library` test op

Matthias Springer via All-commits all-commits at lists.llvm.org
Thu Mar 14 21:33:07 PDT 2024


  Branch: refs/heads/users/matthias-springer/has_runtime_lib
  Home:   https://github.com/llvm/llvm-project
  Commit: e921086ead7e5321d24cf6e7914de95d55434790
      https://github.com/llvm/llvm-project/commit/e921086ead7e5321d24cf6e7914de95d55434790
  Author: Matthias Springer <springerm at google.com>
  Date:   2024-03-15 (Fri, 15 Mar 2024)

  Changed paths:
    M mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
    M mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
    M mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_pack_d.mlir

  Log Message:
  -----------
  [mlir][sparse] Add `has_runtime_library` test op

This commit adds a new test-only op:
`sparse_tensor.has_runtime_library`. The op returns "1" if the sparse
compiler runs in runtime library mode.

This op is useful for writing test cases that require different IR
depending on whether the sparse compiler runs in runtime library or
codegen mode.

This commit fixes a memory leak in `sparse_pack_d.mlir`. This test case
uses `sparse_tensor.assemble` to create a sparse tensor SSA value from
existing buffers. This runtime library reallocates+copies the existing
buffers; the codegen path does not. Therefore, the test requires
additional deallocations when running in runtime library mode.

Alternatives considered:
- Make the codegen path allocate. "Codegen" is the "default" compilation
  mode and it is handling `sparse_tensor.assemble` correctly. The issue
  is with the runtime library path, which should not allocate.
  Therefore, it is better to put a workaround in the runtime library
  path than to work around the issue with a new flag in the codegen
  path.
- Add a `sparse_tensor.runtime_only` attribute to
  `bufferization.dealloc_tensor`. Verifying that the attribute can only
  be attached to `bufferization.dealloc_tensor` may introduce an
  unwanted dependency of `MLIRSparseTensorDialect` on
  `MLIRBufferizationDialect`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list