mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-12 20:27:06 +01:00
Merge branch 'develop' into feature/hirep
This commit is contained in:
@ -28,11 +28,11 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
#ifndef GRID_MATH_ARITH_H
|
||||
#define GRID_MATH_ARITH_H
|
||||
|
||||
#include <tensors/Tensor_arith_add.h>
|
||||
#include <tensors/Tensor_arith_sub.h>
|
||||
#include <tensors/Tensor_arith_mac.h>
|
||||
#include <tensors/Tensor_arith_mul.h>
|
||||
#include <tensors/Tensor_arith_scalar.h>
|
||||
#include "Tensor_arith_add.h"
|
||||
#include "Tensor_arith_sub.h"
|
||||
#include "Tensor_arith_mac.h"
|
||||
#include "Tensor_arith_mul.h"
|
||||
#include "Tensor_arith_scalar.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -89,7 +89,10 @@ class iScalar {
|
||||
const iScalar<vtype> &in) {
|
||||
vstream(out._internal, in._internal);
|
||||
}
|
||||
friend strong_inline void zeroit(iScalar<vtype> &that) {
|
||||
friend strong_inline void vbroadcast(iScalar<vtype> &out,const iScalar<vtype> &in,int lane){
|
||||
vbroadcast(out._internal,in._internal,lane);
|
||||
}
|
||||
friend strong_inline void zeroit(iScalar<vtype> &that){
|
||||
zeroit(that._internal);
|
||||
}
|
||||
friend strong_inline void prefetch(iScalar<vtype> &that) {
|
||||
@ -99,6 +102,9 @@ class iScalar {
|
||||
const iScalar<vtype> &in, int permutetype) {
|
||||
permute(out._internal, in._internal, permutetype);
|
||||
}
|
||||
friend strong_inline void rotate(iScalar<vtype> &out,const iScalar<vtype> &in,int rot){
|
||||
rotate(out._internal,in._internal,rot);
|
||||
}
|
||||
|
||||
// Unary negation
|
||||
friend strong_inline iScalar<vtype> operator-(const iScalar<vtype> &r) {
|
||||
@ -227,11 +233,19 @@ class iVector {
|
||||
vstream(out._internal[i], in._internal[i]);
|
||||
}
|
||||
}
|
||||
friend strong_inline void permute(iVector<vtype, N> &out,
|
||||
const iVector<vtype, N> &in,
|
||||
int permutetype) {
|
||||
for (int i = 0; i < N; i++) {
|
||||
permute(out._internal[i], in._internal[i], permutetype);
|
||||
friend strong_inline void vbroadcast(iVector<vtype,N> &out,const iVector<vtype,N> &in,int lane){
|
||||
for(int i=0;i<N;i++){
|
||||
vbroadcast(out._internal[i],in._internal[i],lane);
|
||||
}
|
||||
}
|
||||
friend strong_inline void permute(iVector<vtype,N> &out,const iVector<vtype,N> &in,int permutetype){
|
||||
for(int i=0;i<N;i++){
|
||||
permute(out._internal[i],in._internal[i],permutetype);
|
||||
}
|
||||
}
|
||||
friend strong_inline void rotate(iVector<vtype,N> &out,const iVector<vtype,N> &in,int rot){
|
||||
for(int i=0;i<N;i++){
|
||||
rotate(out._internal[i],in._internal[i],rot);
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,34 +338,41 @@ class iMatrix {
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend strong_inline void zeroit(iMatrix<vtype, N> &that) {
|
||||
for (int i = 0; i < N; i++) {
|
||||
for (int j = 0; j < N; j++) {
|
||||
zeroit(that._internal[i][j]);
|
||||
}
|
||||
}
|
||||
friend strong_inline void zeroit(iMatrix<vtype,N> &that){
|
||||
for(int i=0;i<N;i++){
|
||||
for(int j=0;j<N;j++){
|
||||
zeroit(that._internal[i][j]);
|
||||
}}
|
||||
}
|
||||
friend strong_inline void prefetch(iMatrix<vtype, N> &that) {
|
||||
for (int i = 0; i < N; i++)
|
||||
for (int j = 0; j < N; j++) prefetch(that._internal[i][j]);
|
||||
friend strong_inline void prefetch(iMatrix<vtype,N> &that){
|
||||
for(int i=0;i<N;i++)
|
||||
for(int j=0;j<N;j++)
|
||||
prefetch(that._internal[i][j]);
|
||||
}
|
||||
friend strong_inline void vstream(iMatrix<vtype, N> &out,
|
||||
const iMatrix<vtype, N> &in) {
|
||||
for (int i = 0; i < N; i++) {
|
||||
for (int j = 0; j < N; j++) {
|
||||
vstream(out._internal[i][j], in._internal[i][j]);
|
||||
}
|
||||
}
|
||||
friend strong_inline void vstream(iMatrix<vtype,N> &out,const iMatrix<vtype,N> &in){
|
||||
for(int i=0;i<N;i++){
|
||||
for(int j=0;j<N;j++){
|
||||
vstream(out._internal[i][j],in._internal[i][j]);
|
||||
}}
|
||||
}
|
||||
friend strong_inline void vbroadcast(iMatrix<vtype,N> &out,const iMatrix<vtype,N> &in,int lane){
|
||||
for(int i=0;i<N;i++){
|
||||
for(int j=0;j<N;j++){
|
||||
vbroadcast(out._internal[i][j],in._internal[i][j],lane);
|
||||
}}
|
||||
}
|
||||
|
||||
friend strong_inline void permute(iMatrix<vtype, N> &out,
|
||||
const iMatrix<vtype, N> &in,
|
||||
int permutetype) {
|
||||
for (int i = 0; i < N; i++) {
|
||||
for (int j = 0; j < N; j++) {
|
||||
permute(out._internal[i][j], in._internal[i][j], permutetype);
|
||||
}
|
||||
}
|
||||
friend strong_inline void permute(iMatrix<vtype,N> &out,const iMatrix<vtype,N> &in,int permutetype){
|
||||
for(int i=0;i<N;i++){
|
||||
for(int j=0;j<N;j++){
|
||||
permute(out._internal[i][j],in._internal[i][j],permutetype);
|
||||
}}
|
||||
}
|
||||
friend strong_inline void rotate(iMatrix<vtype,N> &out,const iMatrix<vtype,N> &in,int rot){
|
||||
for(int i=0;i<N;i++){
|
||||
for(int j=0;j<N;j++){
|
||||
rotate(out._internal[i][j],in._internal[i][j],rot);
|
||||
}}
|
||||
}
|
||||
|
||||
// Unary negation
|
||||
|
@ -146,14 +146,14 @@ class TensorIndexRecursion {
|
||||
}
|
||||
|
||||
template<class vtype,int N> inline static
|
||||
void pokeIndex(iVector<vtype,N> &ret, const iVector<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal,0)),N> &arg, int i)
|
||||
void pokeIndex(iVector<vtype,N> &ret, const iVector<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal[0],0)),N> &arg, int i)
|
||||
{
|
||||
for(int ii=0;ii<N;ii++){
|
||||
TensorIndexRecursion<Level-1>::pokeIndex(ret._internal[ii],arg._internal[ii],i);
|
||||
}
|
||||
}
|
||||
template<class vtype,int N> inline static
|
||||
void pokeIndex(iVector<vtype,N> &ret, const iVector<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal,0)),N> &arg, int i,int j)
|
||||
void pokeIndex(iVector<vtype,N> &ret, const iVector<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal[0],0)),N> &arg, int i,int j)
|
||||
{
|
||||
for(int ii=0;ii<N;ii++){
|
||||
TensorIndexRecursion<Level-1>::pokeIndex(ret._internal[ii],arg._internal[ii],i,j);
|
||||
@ -161,7 +161,7 @@ class TensorIndexRecursion {
|
||||
}
|
||||
|
||||
template<class vtype,int N> inline static
|
||||
void pokeIndex(iMatrix<vtype,N> &ret, const iMatrix<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal,0)),N> &arg, int i)
|
||||
void pokeIndex(iMatrix<vtype,N> &ret, const iMatrix<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal[0][0],0)),N> &arg, int i)
|
||||
{
|
||||
for(int ii=0;ii<N;ii++){
|
||||
for(int jj=0;jj<N;jj++){
|
||||
@ -169,7 +169,7 @@ class TensorIndexRecursion {
|
||||
}}
|
||||
}
|
||||
template<class vtype,int N> inline static
|
||||
void pokeIndex(iMatrix<vtype,N> &ret, const iMatrix<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal,0)),N> &arg, int i,int j)
|
||||
void pokeIndex(iMatrix<vtype,N> &ret, const iMatrix<decltype(TensorIndexRecursion<Level-1>::peekIndex(ret._internal[0][0],0)),N> &arg, int i,int j)
|
||||
{
|
||||
for(int ii=0;ii<N;ii++){
|
||||
for(int jj=0;jj<N;jj++){
|
||||
|
Reference in New Issue
Block a user