gen.py (11534:7106f550afad) gen.py (11639:2e8d4bd8108d)
1#! /usr/bin/python
2
3#
4# Copyright (c) 2015 Advanced Micro Devices, Inc.
5# All rights reserved.
6#
7# For use for simulation and test purposes only
8#

--- 219 unchanged lines hidden (view full) ---

228exec_template_nodt_nosrc = '''
229void
230$class_name::execute(GPUDynInstPtr gpuDynInst)
231{
232 Wavefront *w = gpuDynInst->wavefront();
233
234 typedef Base::DestCType DestCType;
235
1#! /usr/bin/python
2
3#
4# Copyright (c) 2015 Advanced Micro Devices, Inc.
5# All rights reserved.
6#
7# For use for simulation and test purposes only
8#

--- 219 unchanged lines hidden (view full) ---

228exec_template_nodt_nosrc = '''
229void
230$class_name::execute(GPUDynInstPtr gpuDynInst)
231{
232 Wavefront *w = gpuDynInst->wavefront();
233
234 typedef Base::DestCType DestCType;
235
236 const VectorMask &mask = w->get_pred();
236 const VectorMask &mask = w->getPred();
237
238 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
239 if (mask[lane]) {
240 DestCType dest_val = $expr;
241 this->dest.set(w, lane, dest_val);
242 }
243 }
244}

--- 4 unchanged lines hidden (view full) ---

249void
250$class_name::execute(GPUDynInstPtr gpuDynInst)
251{
252 Wavefront *w = gpuDynInst->wavefront();
253
254 typedef Base::DestCType DestCType;
255 typedef Base::SrcCType SrcCType;
256
237
238 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
239 if (mask[lane]) {
240 DestCType dest_val = $expr;
241 this->dest.set(w, lane, dest_val);
242 }
243 }
244}

--- 4 unchanged lines hidden (view full) ---

249void
250$class_name::execute(GPUDynInstPtr gpuDynInst)
251{
252 Wavefront *w = gpuDynInst->wavefront();
253
254 typedef Base::DestCType DestCType;
255 typedef Base::SrcCType SrcCType;
256
257 const VectorMask &mask = w->get_pred();
257 const VectorMask &mask = w->getPred();
258
259 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
260 if (mask[lane]) {
261 SrcCType src_val0 = this->src0.get<SrcCType>(w, lane);
262 DestCType dest_val = $expr;
263
264 this->dest.set(w, lane, dest_val);
265 }

--- 4 unchanged lines hidden (view full) ---

270
271exec_template_1dt_varsrcs = '''
272template<typename DataType>
273void
274$class_name<DataType>::execute(GPUDynInstPtr gpuDynInst)
275{
276 Wavefront *w = gpuDynInst->wavefront();
277
258
259 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
260 if (mask[lane]) {
261 SrcCType src_val0 = this->src0.get<SrcCType>(w, lane);
262 DestCType dest_val = $expr;
263
264 this->dest.set(w, lane, dest_val);
265 }

--- 4 unchanged lines hidden (view full) ---

270
271exec_template_1dt_varsrcs = '''
272template<typename DataType>
273void
274$class_name<DataType>::execute(GPUDynInstPtr gpuDynInst)
275{
276 Wavefront *w = gpuDynInst->wavefront();
277
278 const VectorMask &mask = w->get_pred();
278 const VectorMask &mask = w->getPred();
279
280 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
281 if (mask[lane]) {
282 CType dest_val;
283 if ($dest_is_src_flag) {
284 dest_val = this->dest.template get<CType>(w, lane);
285 }
286

--- 18 unchanged lines hidden (view full) ---

305$class_name<DataType>::execute(GPUDynInstPtr gpuDynInst)
306{
307 Wavefront *w = gpuDynInst->wavefront();
308
309 typedef typename Base::Src0CType Src0T;
310 typedef typename Base::Src1CType Src1T;
311 typedef typename Base::Src2CType Src2T;
312
279
280 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
281 if (mask[lane]) {
282 CType dest_val;
283 if ($dest_is_src_flag) {
284 dest_val = this->dest.template get<CType>(w, lane);
285 }
286

--- 18 unchanged lines hidden (view full) ---

305$class_name<DataType>::execute(GPUDynInstPtr gpuDynInst)
306{
307 Wavefront *w = gpuDynInst->wavefront();
308
309 typedef typename Base::Src0CType Src0T;
310 typedef typename Base::Src1CType Src1T;
311 typedef typename Base::Src2CType Src2T;
312
313 const VectorMask &mask = w->get_pred();
313 const VectorMask &mask = w->getPred();
314
315 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
316 if (mask[lane]) {
317 CType dest_val;
318
319 if ($dest_is_src_flag) {
320 dest_val = this->dest.template get<CType>(w, lane);
321 }

--- 17 unchanged lines hidden (view full) ---

339$class_name<DataType>::execute(GPUDynInstPtr gpuDynInst)
340{
341 Wavefront *w = gpuDynInst->wavefront();
342
343 typedef typename Base::DestCType DestT;
344 typedef CType Src0T;
345 typedef typename Base::Src1CType Src1T;
346
314
315 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
316 if (mask[lane]) {
317 CType dest_val;
318
319 if ($dest_is_src_flag) {
320 dest_val = this->dest.template get<CType>(w, lane);
321 }

--- 17 unchanged lines hidden (view full) ---

339$class_name<DataType>::execute(GPUDynInstPtr gpuDynInst)
340{
341 Wavefront *w = gpuDynInst->wavefront();
342
343 typedef typename Base::DestCType DestT;
344 typedef CType Src0T;
345 typedef typename Base::Src1CType Src1T;
346
347 const VectorMask &mask = w->get_pred();
347 const VectorMask &mask = w->getPred();
348
349 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
350 if (mask[lane]) {
351 DestT dest_val;
352 if ($dest_is_src_flag) {
353 dest_val = this->dest.template get<DestT>(w, lane);
354 }
355 Src0T src_val0 = this->src0.template get<Src0T>(w, lane);

--- 10 unchanged lines hidden (view full) ---

366
367exec_template_shift = '''
368template<typename DataType>
369void
370$class_name<DataType>::execute(GPUDynInstPtr gpuDynInst)
371{
372 Wavefront *w = gpuDynInst->wavefront();
373
348
349 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
350 if (mask[lane]) {
351 DestT dest_val;
352 if ($dest_is_src_flag) {
353 dest_val = this->dest.template get<DestT>(w, lane);
354 }
355 Src0T src_val0 = this->src0.template get<Src0T>(w, lane);

--- 10 unchanged lines hidden (view full) ---

366
367exec_template_shift = '''
368template<typename DataType>
369void
370$class_name<DataType>::execute(GPUDynInstPtr gpuDynInst)
371{
372 Wavefront *w = gpuDynInst->wavefront();
373
374 const VectorMask &mask = w->get_pred();
374 const VectorMask &mask = w->getPred();
375 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
376 if (mask[lane]) {
377 CType dest_val;
378
379 if ($dest_is_src_flag) {
380 dest_val = this->dest.template get<CType>(w, lane);
381 }
382

--- 11 unchanged lines hidden (view full) ---

394
395exec_template_2dt = '''
396template<typename DestDataType, class SrcDataType>
397void
398$class_name<DestDataType, SrcDataType>::execute(GPUDynInstPtr gpuDynInst)
399{
400 Wavefront *w = gpuDynInst->wavefront();
401
375 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
376 if (mask[lane]) {
377 CType dest_val;
378
379 if ($dest_is_src_flag) {
380 dest_val = this->dest.template get<CType>(w, lane);
381 }
382

--- 11 unchanged lines hidden (view full) ---

394
395exec_template_2dt = '''
396template<typename DestDataType, class SrcDataType>
397void
398$class_name<DestDataType, SrcDataType>::execute(GPUDynInstPtr gpuDynInst)
399{
400 Wavefront *w = gpuDynInst->wavefront();
401
402 const VectorMask &mask = w->get_pred();
402 const VectorMask &mask = w->getPred();
403
404 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
405 if (mask[lane]) {
406 DestCType dest_val;
407 SrcCType src_val[$num_srcs];
408
409 for (int i = 0; i < $num_srcs; ++i) {
410 src_val[i] = this->src[i].template get<SrcCType>(w, lane);

--- 329 unchanged lines hidden (view full) ---

740 base_class = 'SpecialInstNoSrc<%s>' % dest_type
741 elif num_srcs == 1:
742 base_class = 'SpecialInst1Src<%s>' % dest_type
743 else:
744 assert false
745
746 gen(brig_opcode, None, expr, base_class)
747
403
404 for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
405 if (mask[lane]) {
406 DestCType dest_val;
407 SrcCType src_val[$num_srcs];
408
409 for (int i = 0; i < $num_srcs; ++i) {
410 src_val[i] = this->src[i].template get<SrcCType>(w, lane);

--- 329 unchanged lines hidden (view full) ---

740 base_class = 'SpecialInstNoSrc<%s>' % dest_type
741 elif num_srcs == 1:
742 base_class = 'SpecialInst1Src<%s>' % dest_type
743 else:
744 assert false
745
746 gen(brig_opcode, None, expr, base_class)
747
748gen_special('WorkItemId', 'w->workitemid[src0][lane]')
748gen_special('WorkItemId', 'w->workItemId[src0][lane]')
749gen_special('WorkItemAbsId',
749gen_special('WorkItemAbsId',
750 'w->workitemid[src0][lane] + (w->workgroupid[src0] * w->workgroupsz[src0])')
751gen_special('WorkGroupId', 'w->workgroupid[src0]')
752gen_special('WorkGroupSize', 'w->workgroupsz[src0]')
753gen_special('CurrentWorkGroupSize', 'w->workgroupsz[src0]')
754gen_special('GridSize', 'w->gridsz[src0]')
750 'w->workItemId[src0][lane] + (w->workGroupId[src0] * w->workGroupSz[src0])')
751gen_special('WorkGroupId', 'w->workGroupId[src0]')
752gen_special('WorkGroupSize', 'w->workGroupSz[src0]')
753gen_special('CurrentWorkGroupSize', 'w->workGroupSz[src0]')
754gen_special('GridSize', 'w->gridSz[src0]')
755gen_special('GridGroups',
755gen_special('GridGroups',
756 'divCeil(w->gridsz[src0],w->workgroupsz[src0])')
756 'divCeil(w->gridSz[src0],w->workGroupSz[src0])')
757gen_special('LaneId', 'lane')
757gen_special('LaneId', 'lane')
758gen_special('WaveId', 'w->dynwaveid')
758gen_special('WaveId', 'w->dynWaveId')
759gen_special('Clock', 'w->computeUnit->shader->tick_cnt', 'U64')
760
761# gen_special('CU'', ')
762
763gen('Ret', base_class='SpecialInstNoSrcNoDest')
764gen('Barrier', base_class='SpecialInstNoSrcNoDest')
765gen('MemFence', base_class='SpecialInstNoSrcNoDest')
766

--- 40 unchanged lines hidden ---
759gen_special('Clock', 'w->computeUnit->shader->tick_cnt', 'U64')
760
761# gen_special('CU'', ')
762
763gen('Ret', base_class='SpecialInstNoSrcNoDest')
764gen('Barrier', base_class='SpecialInstNoSrcNoDest')
765gen('MemFence', base_class='SpecialInstNoSrcNoDest')
766

--- 40 unchanged lines hidden ---