MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / operator()

Method operator()

src/backend/oneapi/kernel/transpose.hpp:66–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64 , IS32MULTIPLE_(IS32MULTIPLE)
65 , shrdMem_(shrdMem) {}
66 void operator()(sycl::nd_item<2> it) const {
67 const int shrdStride = TILE_DIM + 1;
68
69 const int oDim0 = out_.dims[0];
70 const int oDim1 = out_.dims[1];
71 const int iDim0 = in_.dims[0];
72 const int iDim1 = in_.dims[1];
73
74 // calculate strides
75 const int oStride1 = out_.strides[1];
76 const int iStride1 = in_.strides[1];
77
78 const int lx = it.get_local_id(0);
79 const int ly = it.get_local_id(1);
80
81 // batch based block Id
82 sycl::group g = it.get_group();
83 const int batchId_x = g.get_group_id(0) / blocksPerMatX_;
84 const int blockIdx_x = (g.get_group_id(0) - batchId_x * blocksPerMatX_);
85
86 const int batchId_y = g.get_group_id(1) / blocksPerMatY_;
87 const int blockIdx_y = (g.get_group_id(1) - batchId_y * blocksPerMatY_);
88
89 const int x0 = TILE_DIM * blockIdx_x;
90 const int y0 = TILE_DIM * blockIdx_y;
91
92 // calculate global in_dices
93 int gx = lx + x0;
94 int gy = ly + y0;
95
96 // offset in_ and out_ based on batch id
97 // also add the subBuffer offsets
98 const T *iDataPtr = iData_.get_pointer();
99 T *oDataPtr = oData_.get_pointer();
100 iDataPtr += batchId_x * in_.strides[2] + batchId_y * in_.strides[3] +
101 in_.offset;
102 oDataPtr += batchId_x * out_.strides[2] + batchId_y * out_.strides[3] +
103 out_.offset;
104
105 for (int repeat = 0; repeat < TILE_DIM; repeat += THREADS_Y) {
106 int gy_ = gy + repeat;
107 if (IS32MULTIPLE_ || (gx < iDim0 && gy_ < iDim1))
108 shrdMem_[(ly + repeat) * shrdStride + lx] =
109 iDataPtr[gy_ * iStride1 + gx];
110 }
111 it.barrier();
112
113 gx = lx + y0;
114 gy = ly + x0;
115
116 for (int repeat = 0; repeat < TILE_DIM; repeat += THREADS_Y) {
117 int gy_ = gy + repeat;
118 if (IS32MULTIPLE_ || (gx < oDim0 && gy_ < oDim1)) {
119 const T val = shrdMem_[lx * shrdStride + ly + repeat];
120 oDataPtr[gy_ * oStride1 + gx] =
121 conjugate_ ? getConjugate(val) : val;
122 }
123 }

Callers

nothing calls this directly

Calls 1

getConjugateFunction · 0.70

Tested by

no test coverage detected