Skip to content

Incorporate type conversion into FunctionMatcher #233

@AmroAlJundi

Description

@AmroAlJundi

There are some preprocessing functions that require specific data types as inputs. For example, AMD reordering requires that the input CSR's row_ptr and col arrays be of type long. SparseBase has the capability to convert data types of arrays, however, type matching isn't checked at function-matching time, and it should be added to function matcher.

For instance, say you would like to AMD reorder a CSR<int, int, int> but AMD reordering is only available for CSR<long, long, %>, then function matcher wouldn't recognize this. It will call the AMD reordering with the CSR<int, int, int> and then inside the implementation function itself you need to either convert the input to the correct type, or throw an exception.

Currently, we handle this problem using two approaches:

  1. Type convert inside the implementation. Whe the CSR<int, int, int> is passed to the implementation function, we use our utility functions to do safe type conversion and carry out the preprocessing. If the conversion fails half-way an exception is thrown telling the user which types to use.
  2. Throw an exception directly. If the input types don't match the required types, we directly throw an exception informing the user of the mismatch, and the user can handle type mismatches themselves.

However, the solution we wish to have is to allow FunctionMatcher to carry out type conversion with the explicit permission of the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: soonHigh prioritystate: inactiveIssue is abandoned, but might become relavent at some pointtype: featureBrand new functionality, features, workflows, endpoints, etc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions