Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve type safety of Idris API to XLA #273

Open
joelberkeley opened this issue May 21, 2022 · 1 comment
Open

Improve type safety of Idris API to XLA #273

joelberkeley opened this issue May 21, 2022 · 1 comment

Comments

@joelberkeley
Copy link
Owner

joelberkeley commented May 21, 2022

The Tensor backend is unscalable. Most apparently, it completely lack type safety. Rewrite the backend to make it type safe where possible.

Areas that come to mind:

  1. create named wrappers for [GC]AnyPtrs. These can be as simple as
    data XlaOp : Type where
        MkXlaOp : GCAnyPtr -> XlaOp
    
    though we may find it useful to embellish these with other features. See 3.
  2. wrap all foreign functions in Idris functions that capture the requirements of the functions. For example, functions that require a list and the length of that list can be wrapped to just require the list. Similarly, positive integers can be exposed as Nat then converted to Int when passed to FFI. For example, functions that require a list and the length of that list can be wrapped to just require the list. Similarly, positive integers can be exposed as Nat then converted to Int when passed to FFI
  3. capture XLA rules in types. For example,
    • each XlaOp can only be registered to one XlaBuilder
    • a computation cannot be re-used once it has been built (we may already have this due to michael messer's suggestion)
@joelberkeley
Copy link
Owner Author

This was partially completed in #274

@joelberkeley joelberkeley changed the title Rewrite Tensor backend Improve type safety of Idris API to XLA Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant