daphne-project/daphne

Connect `numDistinctApprox`-kernel to DaphneDSL

開放

#958 建立於 2025年4月18日

 (0 則留言) (0 個反應) (0 位負責人)C++ (84 個分叉)auto 404
good first issue

倉庫指標

星標
 (80 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Motivation: The number of distinct values in a matrix is an interesting data characteristic that can be used in multiple ways. As calculating the exact number of distinct values can be quite costly, DAPHNE implements a numDistinctApprox-kernel that uses the k-minimum values approach to approximate the number of distinct values. So far, this kernel has not been connected to DaphneDSL yet. Hence, DAPHNE users cannot use it.

Task: Connect the numDistinctApprox-kernel to DaphneDSL. To this end you should:

  • Have a look at the kernel in src/runtime/local/kernels/numDistinctApprox.h.
  • Make sure that it gets instantiated/precompiled for a couple of relevant combinations of data types (e.g., DenseMatrix and CSRMatrix) and value types (e.g., double and int64_t) in src/runtime/local/kernels.json.
  • Add a DaphneIR operation NumDistinctApproxOp in src/ir/daphneir/DaphneOps.td. See also the MLIR documentation.
  • Add a DaphneDSL built-in function numDistinctApprox that generates a NumDistinctApproxOp in the IR in src/parser/daphnedsl/DaphneDSLBuiltins.cpp.
  • Add script-level test cases for the new DaphneDSL built-in function in test/api/cli/operations/. See the guidelines on testing in DAPHNE. Unit tests for the kernel do already exist in test/runtime/local/NumDistinctApproxTest.cpp.

貢獻者指南