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

Method operator()

src/backend/oneapi/kernel/lookup.hpp:55–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53 , nBBS1_(nBBS1)
54 , DIM_(DIM) {}
55 void operator()(sycl::nd_item<2> it) const {
56 sycl::group g = it.get_group();
57
58 int lx = it.get_local_id(0);
59 int ly = it.get_local_id(1);
60
61 int gz = g.get_group_id(0) / nBBS0_;
62 int gw = g.get_group_id(1) / nBBS1_;
63
64 int gx = g.get_local_range(0) * (g.get_group_id(0) - gz * nBBS0_) + lx;
65 int gy = g.get_local_range(1) * (g.get_group_id(1) - gw * nBBS1_) + ly;
66
67 const idx_t *idxPtr = indices_.get_pointer() + idxInfo_.offset;
68
69 int i = iInfo_.strides[0] *
70 (DIM_ == 0 ? trimIndex((int)idxPtr[gx], iInfo_.dims[0]) : gx);
71 int j = iInfo_.strides[1] *
72 (DIM_ == 1 ? trimIndex((int)idxPtr[gy], iInfo_.dims[1]) : gy);
73 int k = iInfo_.strides[2] *
74 (DIM_ == 2 ? trimIndex((int)idxPtr[gz], iInfo_.dims[2]) : gz);
75 int l = iInfo_.strides[3] *
76 (DIM_ == 3 ? trimIndex((int)idxPtr[gw], iInfo_.dims[3]) : gw);
77
78 const in_t *inPtr = in_.get_pointer() + (i + j + k + l) + iInfo_.offset;
79 in_t *outPtr =
80 out_.get_pointer() +
81 (gx * oInfo_.strides[0] + gy * oInfo_.strides[1] +
82 gz * oInfo_.strides[2] + gw * oInfo_.strides[3] + oInfo_.offset);
83
84 if (gx < oInfo_.dims[0] && gy < oInfo_.dims[1] && gz < oInfo_.dims[2] &&
85 gw < oInfo_.dims[3]) {
86 outPtr[0] = inPtr[0];
87 }
88 }
89
90 private:
91 write_accessor<in_t> out_;

Callers

nothing calls this directly

Calls 1

trimIndexFunction · 0.70

Tested by

no test coverage detected