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

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


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e8e8df4c1bf97f0674b2387175cdeb251a4e0d9c
      https://github.com/llvm/llvm-project/commit/e8e8df4c1bf97f0674b2387175cdeb251a4e0d9c
  Author: Matthias Springer <me at m-sp.org>
  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 (#85355)

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