-
Notifications
You must be signed in to change notification settings - Fork 84
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
Implement pieces of grenade using Accelerate #38
base: master
Are you sure you want to change the base?
Implement pieces of grenade using Accelerate #38
Conversation
Cool, interesting stuff. It's not really surprising that there's not a big gain there on a cpu, those bits of c vectorise well, so one wouldn't expect to be able to get much of a gain there. I'll have to install it and have a play. |
Oops. I just noticed some of my false starts made it into the PR, I'll take those out. My overall plan was to make a new typeclass to capture that a type can be run under accelerate, and then to implement that class for all layer types. I'll try and get the class fleshed out so that others can add instances. |
Currently, this is building on #36, and needs to be rebased/squashed. But, it now has a typeclass for |
So, I'm a bit stuck, at the moment. I'm trying to implement the
My guess is that the typeclass (or the Network instance of it), insufficiently describes the connection between the standard grenade shapes |
Yep, no worries. I will attempt to find some time this weekend to have a look into helping you out. |
|
||
import Data.Array.Accelerate | ||
|
||
type S sh = Array sh Double |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this can work.
The shapes in accelerate have to be formed with Z
and :.
(or DIM1
, DIM2
, DIM3
), while it looks like you're using grenade's shapes which hold their dependent type information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My intention here is to be using Data.Array.Accelerate.Shape
whenever Grenade.Core.Shape.Accelerate.S
is used. Do you see specific places where that's not true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realised that after my comment sorry.
I made some good progress in the last day or so. I'll push the results soon. |
I pushed up my latest changes. I thought that it was pretty close, but I think there are actually just type errors obscuring more type errors. I think the next step may be to create a version of |
In this latest set of changes, I'm running into trouble because I can't figure out how to make sure that |
@cpennington ooh, this is interesting! What is the status of this? Also, you may be interested in https://github.com/tmcdonell/accelerate-blas |
N.B. the hedgehog tests of accelerated networks still suffer from type issues when trying to compare the network results.
f85257a
to
ed63ef1
Compare
@tmcdonell: It's working, in general. I think it's at a point where other people could start adding (Looking back, it also looks like I still need to fill out the implementation of |
After more investigation, it appears I don't understand data families as well as I thought I did. In particular, I can't figure out how to write |
I've gotten past the GADT hurdle. Now I have a non-terminating type reduction... Types are fun/hard... I suspect it's because I'm using |
For im2col and col2im, accelerate doesn't seem to improve
benchmarks (using the llvm-native backend). It's not clear
to me if that's because my implementation is bad, or because
there's a bunch of overhead to using llvm that doesn't exist
in the existing C implementations.
My next priorities will be to implement the parts of grenade
that I need in my main project using accelerate, to see
if it improves the benchmarks in that project.