Alignas Array struct (#14920)
authorSyed Tousif Ahmed <syed.ahmed.emails@gmail.com>
Tue, 11 Dec 2018 01:53:33 +0000 (17:53 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 11 Dec 2018 01:58:03 +0000 (17:58 -0800)
commita97cf568a4cfb9bd298b77775589fc610da5b575
tree1f6bbf4fd001fca29d63b6fbbd2193e7e8bd9857
parent7e2b074219fad6d2b09b379423e83b2295b29df2
Alignas Array struct (#14920)

Summary:
This PR aligns the Array struct such that cuda vector performance improvements can be utilized.

I tested this by using it on our Philox header. Note how the vector store instruction gets used for cuda vector types and when using alignas on Array, vs when not using alignas on Array.

With cuda vector type (uint4, uint2, float4): https://godbolt.org/z/UaWOmR
With alignas: https://godbolt.org/z/Eeh0t5
Without alignas: https://godbolt.org/z/QT63gq
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14920

Differential Revision: D13406751

Pulled By: soumith

fbshipit-source-id: 685b1010ef1f576dde30c278b1e9b642f87c843d
aten/src/ATen/cuda/Array.h