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

Vector indexing and insertion operations #509

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

HugoPeters1024
Copy link

@HugoPeters1024 HugoPeters1024 commented Oct 19, 2021

Description
Allow indexing into the existing Vec primitive to enable branchless, constant time, memory reads with runtime offsets. Especially useful for having a local chunk of memory during an Exp computation that doesn't have to live in global memory.

Motivation and context
This functionality will bring Accelerate closer to supporting BVH traversal for realtime (ray/path)tracing with complex scenes.

How has this been tested?
It has not, this PR is in development and should not be merged right now :}

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist
Go over all the following points, and put an x in all the boxes that apply. If you're unsure about any of these, don't hesitate to ask. We're here to help!

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • Merge in lock step with Implement the vector indexing operation accelerate-llvm#75

@tmcdonell tmcdonell marked this pull request as draft October 27, 2021 11:28
@HugoPeters1024 HugoPeters1024 changed the title Vector indexing operations and empty vector constructor [WIP] Vector indexing operations and empty vector constructor Oct 27, 2021
src/Data/Primitive/Vec.hs Outdated Show resolved Hide resolved
src/Data/Array/Accelerate/AST.hs Outdated Show resolved Hide resolved
@HugoPeters1024 HugoPeters1024 changed the title [WIP] Vector indexing operations and empty vector constructor Vector indexing operations and empty vector constructor Dec 8, 2021
-> OpenExp env aenv i
-> OpenExp env aenv s
-> OpenExp env aenv (Vec n s)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove VecPac and VecUnpack? Those just get turned your new index and write instructions. We might as well also add VecShuffle, corresponding to the shufflevector instruction.

Copy link
Author

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?

Copy link
Member

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...

Copy link
Author

@HugoPeters1024 HugoPeters1024 Dec 14, 2021

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). However EltR Node ~ Node is the culprit. Perhaps some unsafe coerceon from and to a flattened byte vector?

src/Data/Primitive/Vec.hs Outdated Show resolved Hide resolved
src/Data/Primitive/Vec.hs Outdated Show resolved Hide resolved
src/Data/Primitive/Vec.hs Show resolved Hide resolved
src/Data/Array/Accelerate/AST.hs Outdated Show resolved Hide resolved
@HugoPeters1024 HugoPeters1024 changed the title Vector indexing operations and empty vector constructor Vector indexing and insertion operations Jan 19, 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

Successfully merging this pull request may close these issues.

3 participants