/tomo/pyhst

To get this branch, use:
bzr branch http://darksoft.org/webbzr/tomo/pyhst

« back to all changes in this revision

Viewing changes to hst_opencl/newtex.cl

  • Committer: Suren A. Chilingaryan
  • Date: 2017-12-20 15:28:19 UTC
  • Revision ID: csa@suren.me-20171220152819-byiryz4mmovcg8u2
New remmaping, small adjustment of configuration

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#define HST_NEWTEX4                             //!< Assymetric: process 4 projections and 64 bins during each step.
 
2
#define HST_NEWTEX_PROJ_MAJOR
2
3
 
3
4
//#define HST_SQUARE_PPT                                //!< NO. Little effect on performance (slighly reduces register usage, but doesn't affect computations as the loops are unrolled anyway)
4
5
//#define HST_FLOAT_LOOPS                               //!< NO. Use float loops to optimize register usage (mostly bad)
98
99
    const int bidx = get_group_id(0) * get_local_size(0);
99
100
    const int bidy = get_group_id(1) * get_local_size(1);
100
101
 
101
 
    const int proj_minor = tidx / 4;
 
102
 
 
103
#ifdef HST_NEWTEX_PROJ_MAJOR
 
104
# ifdef HST_NEWTEX4
 
105
    const int proj = tidy / 4;
 
106
    const int block = tidy % 4;
 
107
# else
 
108
    const int proj = tidy;
 
109
# endif
 
110
    const int xy_minor = tidx % 4;
 
111
    const int y_minor = xy_minor / 2;
 
112
    const int x_minor = xy_minor % 2;
 
113
 
 
114
    const int xy_major = tidx / 4;
 
115
    const int y_major = xy_major / 2;
 
116
    const int x_major = xy_major % 2;
 
117
#else
 
118
# ifdef HST_NEWTEX4
 
119
    const int block = tidy / 4;
 
120
    const int proj = tidx / 4;
 
121
# else
 
122
    const int proj = 4 * (tidy / 4) + (tidx / 4);
 
123
# endif 
102
124
    const int xy_minor = tidx % 4;
103
125
    const int y_minor = xy_minor / 2;
104
126
    const int x_minor = xy_minor % 2;
106
128
    const int xy_major = tidy % 4;
107
129
    const int y_major = xy_major / 2;
108
130
    const int x_major = xy_major % 2;
 
131
#endif
109
132
 
110
133
#if defined(HST_NEWTEX4)
111
 
    const int block = tidy / 4;
112
 
 
113
134
# ifdef SQUARE_PPT
114
135
    const int blocky = block/2;
115
136
    const int blockx = block%2;
123
144
 
124
145
    const int sidy = blocky * 4 + y_major * 2 + y_minor;
125
146
    const int sidx = blockx * 4 + x_major * 2 + x_minor;
126
 
 
127
 
    const int proj = proj_minor;
128
147
#else
129
148
    const int ridy = tidy;
130
149
    const int ridx = tidx;
131
150
 
132
151
    const int sidy = y_major * 2 + y_minor;
133
152
    const int sidx = x_major * 2 + x_minor;
134
 
 
135
 
    const int proj_major = tidy / 4;
136
 
    const int proj =  4 * proj_major + proj_minor;
137
153
#endif
138
154
 
139
155
    const float x = bidx + sidx + apos_off_x;
143
159
    const float axis = c_all[0].z;
144
160
#endif
145
161
 
 
162
 
146
163
#ifdef HST_CACHE_CONST
147
164
    const int tid = 16 * tidy + tidx;
148
165
    __local float2 w_trig[CACHE_BLOCK];
150
167
    __local float  w_ofst[CACHE_BLOCK];
151
168
# endif
152
169
 
 
170
 
153
171
    for (int pblock = 0; pblock < num_proj; pblock += CACHE_BLOCK) {
154
172
        const int pblock_end = min(CACHE_BLOCK, num_proj - pblock);
 
173
 
155
174
        if (tid < CACHE_BLOCK) {
156
175
            const int g_proj = pblock + tid;
157
176
            w_trig[tid] = (float2){ c_all[g_proj].x, c_all[g_proj].y };
159
178
            w_ofst[tid] = c_all[g_proj].z;
160
179
#endif
161
180
        }
 
181
 
162
182
        barrier(CLK_LOCAL_MEM_FENCE);
163
183
 
164
184
        for (int proje = proj; proje < pblock_end; proje += PROJ_STEP) {
165
185
            const float projf = pblock + proje + 0.5f;
 
186
 
166
187
# ifdef HST_NO_OFFSETS
167
188
            const float4 all = (float4){w_trig[proje].x, w_trig[proje].y, axis, 0};
168
189
# else
169
190
            const float4 all = (float4){w_trig[proje].x, w_trig[proje].y, w_ofst[proje], 0};
170
191
# endif
 
192
 
 
193
 
171
194
#else
172
195
# if defined(HST_FLOAT_LOOPS)
173
196
        for (float projf =  proj + 0.5f; projf < num_proj; projf += PROJ_STEP) {