-
Notifications
You must be signed in to change notification settings - Fork 40
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
Feature/raja vec #83
base: develop
Are you sure you want to change the base?
Feature/raja vec #83
Changes from all commits
290fb27
ef92cd4
ab57da5
e38062a
3a18563
1d6bbea
c3192c4
7179925
cdccd30
793fc36
0cd73e6
e37904a
1a909d0
1ae4806
b53e74d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,11 +20,53 @@ | |
#define DAXPY_DATA_SETUP \ | ||
Real_ptr x = m_x; \ | ||
Real_ptr y = m_y; \ | ||
Real_type a = m_a; | ||
const Real_type a = m_a; | ||
|
||
#define DAXPY_BODY \ | ||
y[i] += a * x[i] ; | ||
|
||
#define DAXPY_DATA_VEC_SETUP \ | ||
RAJA_INDEX_VALUE_T(I, Int_type, "I");\ | ||
using vector_t = RAJA::StreamVector<Real_type, 2>; \ | ||
RAJA::TypedView<Real_type, RAJA::Layout<1, Int_type, 0>, I> X(x, iend); \ | ||
RAJA::TypedView<Real_type, RAJA::Layout<1, Int_type, 0>, I> Y(y, iend); | ||
|
||
#define DAXPY_DATA_VEC_SETUP2 \ | ||
RAJA_INDEX_VALUE_T(I, Int_type, "I"); \ | ||
using vector_t = RAJA::StreamVector<Real_type,2>; \ | ||
RAJA::TypedView<Real_type, RAJA::Layout<1, Int_type, 0>, I> Xview(x, iend); \ | ||
RAJA::TypedView<Real_type, RAJA::Layout<1, Int_type, 0>, I> Yview(y, iend); \ | ||
RAJA::forall<RAJA::vector_exec<vector_t>> (RAJA::TypedRangeSegment<I>(ibegin, iend),\ | ||
[=](RAJA::VectorIndex<I, vector_t> i) { \ | ||
vector_t X(0), Y(0); \ | ||
for(int j = 0; j < i.size(); ++j) { \ | ||
X.set(j, *(x + (**i) + j)); \ | ||
Y.set(j, *(y + (**i) + j)); \ | ||
} \ | ||
Xview(i) = X; \ | ||
Yview(i) = Y; \ | ||
}); | ||
|
||
#define DAXPY_DATA_VEC_SETUP3 \ | ||
RAJA_INDEX_VALUE_T(I, Int_type, "I");\ | ||
using element_t = RAJA::StreamVector<Real_type,2>::element_type; \ | ||
element_t X[iend], Y[iend]; \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This really isn't the intended use. You are basically telling the compiler to hold the entire array X and Y in register at the same time. |
||
for(int i = 0; i < iend; ++i) { \ | ||
X[i] = x[i]; \ | ||
Y[i] = y[i]; \ | ||
} | ||
|
||
#define DAXPY_VEC_BODY \ | ||
Y(i) += a * X(i); | ||
|
||
#define DAXPY_VEC_BODY2 \ | ||
Yview(i) += a*Xview(i); | ||
|
||
#define DAXPY_VEC_BODY3 \ | ||
for(int i = 0;i < iend; ++i){ \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. going along with the last comment: the "i" index here should be over Real_types... so it should increment by the vector width |
||
Y[i] += a * X[i]; \ | ||
y[i] = Y[i]; \ | ||
} | ||
|
||
#include "common/KernelBase.hpp" | ||
|
||
|
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.
This flag should go in the scripts/lc-builds/XXX files. Also I think there is a architecture agnostic flag for (at least gnu and clang) like -march=native or something... in case the machine has SSE, AVX, AVX2 or AVX512, it will pick the best one.
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.
Yes, I saw the lc-builds file and this is where I have it now. Not sure how this slipped in..but thanks for the feedback!