gussmith23 / glenside

A pure, low-level tensor program representation enabling tensor program optimization via program rewriting. See the web demo at https://gussmith23.github.io/glenside-web-demo/
71 stars 10 forks source link

Use Rust's ndarray library more efficiently in the interpreter #8

Open gussmith23 opened 4 years ago

gussmith23 commented 4 years ago

We use ndarray as our tensor representation, but we don't use it very efficiently. Specifically, we copy data everywhere, for nearly every operation. The ndarray library is smart; it can do many of the operations we need to do without copying data, if only we understood how to use it well. There are also opportunities to contribute back to ndarray, if we find something we'd like to be able to do that they haven't yet implemented. From what little I've dug in their source code already, it seems like these opportunities might be abundant, and contributing shouldn't be too hard!

gussmith23 commented 4 years ago

@hypercubestart This one mostly involves taking a look at the ndarray library and using it more efficiently. I don't have a lot of good guidance here; we can talk in more detail later. Basically, this task involves getting to understand the library and how it works, and using it "more correctly" in Glenside. Specifically, avoiding data copies wherever possible!

gussmith23 commented 4 years ago

@hypercubestart Please add your notes on this whenever you can! Would like to document all of the issues we had before we move on to something else.

hypercubestart commented 4 years ago

crossposting from https://github.com/gussmith23/glenside/pull/59:

on hold for now...because of difficulty of getting lifetimes to work out. Ideally, we could use ArrayViews that reference owned arrays already in the hashmap, but Rust lifetimes don't permit this

gussmith23 commented 4 years ago

Thanks, sorry I didn't see that comment!! Many open issues and PRs haha