-
Notifications
You must be signed in to change notification settings - Fork 120
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
Vector indexing and insertion operations #509
Draft
HugoPeters1024
wants to merge
12
commits into
AccelerateHS:master
Choose a base branch
from
HugoPeters1024:vector-operations
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e6cd2eb
Vector indexing operations and empty vector constructor
HugoPeters1024 0c80d44
created empty vector lifted in Exp
HugoPeters1024 2c90dd5
Add implementation of empty vector and indexing
HugoPeters1024 74feaec
Add bounds check on vector index
HugoPeters1024 977669b
Fix vector creation (todo delete the prim const)
HugoPeters1024 dc7d849
implement interpreter and fix bugs
HugoPeters1024 3fe1e80
Remove vector create constant
HugoPeters1024 faa139b
add missing pattern match and module in cabal file
HugoPeters1024 0e250b8
Move vec operations to correct AST
HugoPeters1024 21d6dab
fix off by one errors
HugoPeters1024 ad1f995
style changes
HugoPeters1024 f9556e3
prevent memcpy using unsafe mutable coercion
HugoPeters1024 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,5 @@ | |
/docs/_build | ||
*.hi | ||
*.o | ||
|
||
hie.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{-# LANGUAGE ConstraintKinds #-} | ||
{-# LANGUAGE AllowAmbiguousTypes #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE FlexibleInstances #-} | ||
{-# LANGUAGE MonoLocalBinds #-} | ||
{-# LANGUAGE FunctionalDependencies #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
{-# LANGUAGE GADTs #-} | ||
{-# OPTIONS_GHC -fno-warn-orphans #-} | ||
-- | | ||
-- Module : Data.Array.Accelerate.Classes.Vector | ||
-- Copyright : [2016..2020] The Accelerate Team | ||
-- License : BSD3 | ||
-- | ||
-- Maintainer : Trevor L. McDonell <[email protected]> | ||
-- Stability : experimental | ||
-- Portability : non-portable (GHC extensions) | ||
-- | ||
module Data.Array.Accelerate.Classes.Vector where | ||
|
||
import GHC.TypeLits | ||
import Data.Array.Accelerate.Sugar.Vec | ||
import Data.Array.Accelerate.Smart | ||
import Data.Primitive.Vec | ||
|
||
|
||
|
||
instance (VecElt a, KnownNat n) => Vectoring (Exp (Vec n a)) (Exp a) where | ||
type IndexType (Exp (Vec n a)) = Exp Int | ||
vecIndex = mkVectorIndex | ||
vecWrite = mkVectorWrite | ||
vecEmpty = undef | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Remove
VecPac
andVecUnpack
? Those just get turned your new index and write instructions. We might as well also addVecShuffle
, corresponding to theshufflevector
instruction.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.
One of the more complicated things about VecPack and Unpack is the need to derive the tuple type. I got rather stuck trying to make changes to that whole pipeline, could you assist me on this live sometime?
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.
Ah, good point. Okay let's just shelve that for now.
I've been thinking how this vector support can be restructured after you mentioned you couldn't have a
Vec Node
(or any non-primitive thing), which is sort of a weird limitation for our language...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.
The two blocking constraints are
Prim Node
(which can be implemented I think). HoweverEltR Node ~ Node
is the culprit. Perhaps some unsafe coerceon from and to a flattened byte vector?