-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptionset.cpp
More file actions
282 lines (223 loc) · 8.34 KB
/
Copy pathoptionset.cpp
File metadata and controls
282 lines (223 loc) · 8.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
#include "optionset.h"
OptionSet::OptionSet(int rank, bool idxPara, bool idxTile, bool idxIntraOpt, bool idx2Tile, bool idxIdent, bool idxRar, bool idxPartTile, bool idxLbTile, int idxFuse, bool idxUnroll, int idxUnrollF, bool idxIsl, Matrix tileOpt, QWidget *parent)
:
QWidget(parent)
{
this->setFixedHeight(325);
QVBoxLayout *mainLayout = new QVBoxLayout();
layout = new QHBoxLayout();
this->rank = rank;
QVBoxLayout *vLayout = new QVBoxLayout();
vLayout->addStretch(2);
upArrow = new QPushButton();
upArrow->setObjectName("upArrow");
upArrow->setCursor(Qt::PointingHandCursor);
vLayout->addWidget(upArrow);
vLayout->addStretch(1);
QHBoxLayout *middleLay = new QHBoxLayout();
textRank = new QLabel(QString::number(rank+1));
textRank->setAlignment(Qt::AlignCenter);
middleLay->addWidget(textRank);
QFrame* line = new QFrame();
line->setFrameShape(QFrame::VLine);
line->setFrameShadow(QFrame::Sunken);
middleLay->addWidget(line);
QPushButton *deleteBtn = new QPushButton("");
deleteBtn->setCursor(Qt::PointingHandCursor);
deleteBtn->setObjectName("miniDelete");
middleLay->addWidget(deleteBtn);
vLayout->addLayout(middleLay);
vLayout->addStretch(1);
downArrow = new QPushButton();
downArrow->setObjectName("downArrow");
downArrow->setCursor(Qt::PointingHandCursor);
vLayout->addWidget(downArrow);
vLayout->addStretch(2);
QWidget *arrowsWidget = new QWidget();
arrowsWidget->setLayout(vLayout);
arrowsWidget->setFixedWidth(150);
checkPara = new QCheckBox("parallel");
checkPara->setCursor(Qt::PointingHandCursor);
checkPara->setChecked(idxPara);
checkIdent = new QCheckBox("identity");
checkIdent->setCursor(Qt::PointingHandCursor);
checkIdent->setChecked(idxIdent);
checkRar = new QCheckBox("rar");
checkRar->setCursor(Qt::PointingHandCursor);
checkRar->setChecked(idxRar);
checkIsl = new QCheckBox("isl");
checkIsl->setCursor(Qt::PointingHandCursor);
checkIsl->setChecked(idxIsl);
QHBoxLayout *unrollfLayout = new QHBoxLayout();
checkUnroll = new QCheckBox("unroll");
checkUnroll->setCursor(Qt::PointingHandCursor);
checkUnroll->setChecked(idxUnroll);
unrollfLayout->addWidget(checkUnroll);
unrollfLayout->addStretch();
textUnrollF = new QLabel("ufactor");
unrollfLayout->addWidget(textUnrollF);
spinUnrollF = new QSpinBox();
spinUnrollF->setValue(idxUnrollF);
spinUnrollF->setSuffix("x");
spinUnrollF->setCursor(Qt::PointingHandCursor);
unrollfLayout->addWidget(spinUnrollF);
updateUnrollF(idxUnroll);
groupAddiOpt = new QGroupBox(" Additional configuration");
QVBoxLayout *layoutAddiOpt = new QVBoxLayout();
groupAddiOpt->setLayout(layoutAddiOpt);
layoutAddiOpt->addWidget(checkPara);
layoutAddiOpt->addWidget(checkRar);
layoutAddiOpt->addWidget(checkIdent);
layoutAddiOpt->addWidget(checkIsl);
layoutAddiOpt->addLayout(unrollfLayout);
groupFuse = new QGroupBox(" Fusion");
QHBoxLayout *fuseLayout = new QHBoxLayout();
groupFuse->setMaximumHeight(75);
groupFuse->setLayout(fuseLayout);
comboFuse = new QComboBox();
comboFuse->addItem(QString("No"));
comboFuse->addItem(QString("Maximal"));
comboFuse->addItem(QString("Smart"));
comboFuse->setSizeAdjustPolicy(QComboBox::AdjustToContents);
comboFuse->setCursor(Qt::PointingHandCursor);
comboFuse->setEditable(true);
comboFuse->lineEdit()->setAlignment(Qt::AlignCenter);
comboFuse->lineEdit()->setReadOnly(true);
comboFuse->setCurrentIndex(idxFuse);
fuseLayout->addWidget(comboFuse);
textFuse = new QLabel("fuse");
fuseLayout->addWidget(textFuse);
fuseLayout->addStretch();
QWidget *widgetFuseAddi = new QWidget();
widgetFuseAddi->setFixedWidth(500);
QVBoxLayout *layoutFuseAddi = new QVBoxLayout();
widgetFuseAddi->setLayout(layoutFuseAddi);
layoutFuseAddi->addWidget(groupAddiOpt);
layoutFuseAddi->addWidget(groupFuse);
tileOpts = new TileOption(idxTile, idxIntraOpt, idx2Tile, idxPartTile, idxLbTile, tileOpt);
// ===========================
layout->addWidget(arrowsWidget);
layout->addStretch();
layout->addWidget(widgetFuseAddi);
layout->addStretch();
layout->addWidget(tileOpts);
// ===========================
mainLayout->addLayout(layout);
QFrame* line2 = new QFrame();
line2->setFrameShape(QFrame::HLine);
line2->setFrameShadow(QFrame::Sunken);
mainLayout->addWidget(line2);
setLayout(mainLayout);
// swap and delete event
connect(upArrow, SIGNAL(clicked()), this, SLOT(emitUpArrowClicked()));
connect(downArrow, SIGNAL(clicked()), this, SLOT(emitDownArrowClicked()));
connect(deleteBtn, SIGNAL(released()), this, SLOT(deleteObject()));
// Row changed
connect(checkPara, SIGNAL(released()), this, SLOT(emitSetChanged()));
connect(checkIdent, SIGNAL(released()), this, SLOT(emitSetChanged()));
connect(checkRar, SIGNAL(released()), this, SLOT(emitSetChanged()));
connect(checkIsl, SIGNAL(released()), this, SLOT(emitSetChanged()));
connect(checkUnroll, SIGNAL(released()), this, SLOT(emitSetChanged()));
connect(comboFuse, SIGNAL(currentIndexChanged(int)), this, SLOT(emitSetChanged()));
connect(tileOpts, SIGNAL(tileChanged()), this, SLOT(emitSetChanged()));
// de/activate unrollf
updateUnrollF(idxUnroll);
connect(checkUnroll, SIGNAL(stateChanged(int)), this, SLOT(updateUnrollF(int)));
}
// PUBLIC FUNCTIONS
bool OptionSet::getParaIdx(){
return checkPara->isChecked();
}
bool OptionSet::getTileIdx(){
return tileOpts->getTileIdx();
}
bool OptionSet::getIntraOptIdx(){
return tileOpts->getIntraOptIdx();
}
bool OptionSet::get2TileIdx(){
return tileOpts->get2TileIdx();
}
bool OptionSet::getIdentIdx(){
return checkIdent->isChecked();
}
bool OptionSet::getRarIdx(){
return checkRar->isChecked();
}
bool OptionSet::getPartTileIdx(){
return tileOpts->getPartTileIdx();
}
bool OptionSet::getLbTileIdx(){
return tileOpts->getLbTileIdx();
}
int OptionSet::getFuseIdx(){
return comboFuse->currentIndex();
}
bool OptionSet::getUnrollIdx(){
return checkUnroll->isChecked();
}
int OptionSet::getUnrollFIdx(){
return spinUnrollF->value();
}
bool OptionSet::getIslIdx(){
return checkIsl->isChecked();
}
unsigned long OptionSet::getNbTuples(){
if(!tileOpts->getTileIdx())
return 1;
return tileOpts->getNbTuples();
}
Matrix OptionSet::getTileOptions(){
return tileOpts->getTileOptions();
}
Matrix *OptionSet::getTileTuples(){
return tileOpts->getTileTuples();
}
// ==
void OptionSet::setRank(int n){
rank = n;
textRank->setText(QString::number(n+1));
}
void OptionSet::setParaIdx(bool val){
checkPara->setChecked(val);
}
void OptionSet::setIdentIdx(bool val){
checkIdent->setChecked(val);
}
void OptionSet::setRarIdx(bool val){
checkRar->setChecked(val);
}
void OptionSet::setFuseIdx(int val){
comboFuse->setCurrentIndex(val);
}
void OptionSet::setUnrollIdx(bool val){
checkUnroll->setChecked(val);
}
void OptionSet::setUnrollFIdx(int val){
spinUnrollF->setValue(val);
}
void OptionSet::setIslIdx(bool val){
checkIsl->setChecked(val);
}
void OptionSet::setTileOptions(int idxTile, int idxIntraOpt, int idx2Tile, int idxPartTile, int idxLbTile, Matrix opts){
delete tileOpts;
tileOpts = new TileOption(idxTile, idxIntraOpt, idx2Tile, idxPartTile, idxLbTile, opts);
layout->addWidget(tileOpts);
connect(tileOpts, SIGNAL(tileChanged()), this, SLOT(emitSetChanged()));
}
// PRIVATE SLOTS
void OptionSet::updateUnrollF(int n){
spinUnrollF->setEnabled(n);
textUnrollF->setEnabled(n);
}
void OptionSet::deleteObject(){
emit deleted(rank);
}
void OptionSet::emitUpArrowClicked(){
emit upClicked(rank);
}
void OptionSet::emitDownArrowClicked(){
emit downClicked(rank);
}
void OptionSet::emitSetChanged(){
emit setChanged();
}