daphne-project/daphne

Connect `hasSpecialValue`-kernel to DaphneDSL

开放

#960 创建于 2025年4月18日

 (0 条评论) (0 个反应) (0 位负责人)C++ (84 个派生)auto 404
good first issue

仓库指标

星标
 (80 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Motivation: Finding out if a matrix contains any special values (e.g., nan, inf, or any other value that is special in some context, say 42) is an important task and whether a matrix contains a certain special value can be seen as an interesting data characteristic. DAPHNE implements a hasSpecialValue-kernel that finds out if a given matrix contains a given special value, whereby it behaves nan-safe. So far, this kernel has not been connected to DaphneDSL yet. Hence, DAPHNE users cannot use it.

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

  • Have a look at the kernel in src/runtime/local/kernels/hasSpecialValue.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 HasSpecialValue in src/ir/daphneir/DaphneOps.td. See also the MLIR documentation.
  • Add a DaphneDSL built-in function hasSpecialValue that generates a HasSpecialValue 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/HasSpecialValueTest.cpp.

贡献者指南