Skip to content

Commit c4055a3

Browse files
trbauerigcbot
authored andcommitted
option parsing improvement, etc..
option parsing emits the malformed option
1 parent bd0a00d commit c4055a3

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

visa/Optimizer.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8041,9 +8041,12 @@ bool Optimizer::foldPseudoAndOr(G4_BB* bb, INST_LIST_ITER& ii)
80418041
int addrSubreg = 2;
80428042

80438043
G4_BB* perThreadBB = nullptr;
8044-
// load per-thread data, if any. per-thread data always start from r1
8044+
// Load per-thread data, if any. Per-thread data always start from r1
80458045
// this is a fixed size 8 inst (nop padded as necessary), which may be skipped
8046-
// by runtime if the local_id are auto-generated by HW
8046+
// by runtime if the local_id are auto-generated by HW.
8047+
//
8048+
// The size of this first block must be a multiple of 64B so that the
8049+
// forward start label is 64B aligned.
80478050
if (builder.needsToLoadLocalID())
80488051
{
80498052
int PTIS = kernel.getInt32KernelAttr(Attributes::ATTR_PerThreadInputSize);
@@ -8116,8 +8119,8 @@ bool Optimizer::foldPseudoAndOr(G4_BB* bb, INST_LIST_ITER& ii)
81168119
if (useInlineData)
81178120
{
81188121
// copy inline data GRF
8119-
// (W) mov (8) r4.0:ud r1.0
8120-
moveGRF((startGRF + numPerThreadGRF), startGRF);
8122+
// (W) mov (8) r4.0:ud r1.0:ud
8123+
moveGRF(startGRF + numPerThreadGRF, startGRF);
81218124
}
81228125

81238126
{

visa/Option.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ bool Options::parseOptions(int argc, const char* argv[])
7575
{
7676
if (argv[i] == NULL)
7777
{
78+
std::cerr << "INTERNAL ERROR: nullptr argv element\n";
7879
return false;
7980
}
8081
// If arg not defined in the .def file, exit with an error
@@ -96,7 +97,7 @@ bool Options::parseOptions(int argc, const char* argv[])
9697
}
9798
if (*end != 0) {
9899
parseError = true;
99-
std::cerr << argv[i] << ": malformed integer\n";
100+
std::cerr << it->first << ": " << argv[i] << ": malformed integer\n";
100101
return false;
101102
}
102103
val = x;
@@ -108,7 +109,7 @@ bool Options::parseOptions(int argc, const char* argv[])
108109
return false;
109110
if (val64 > (uint64_t)std::numeric_limits<uint32_t>::max()) {
110111
parseError = true;
111-
std::cerr << argv[i] << ": malformed integer (value too large for 32b)\n";
112+
std::cerr << it->first << ": " << argv[i] << ": malformed integer (value too large for 32b)\n";
112113
return false;
113114
}
114115
val = (uint32_t)val64;
@@ -134,7 +135,7 @@ bool Options::parseOptions(int argc, const char* argv[])
134135
i++;
135136
if (i >= argc) {
136137
const char *errorMsg = m_vISAOptions.getErrorMsg(vISAOpt);
137-
std::cerr << errorMsg << "\n";
138+
std::cerr << it->first << ": argument expected: " << errorMsg << "\n";
138139
return false;
139140
}
140141
switch (type) {
@@ -167,7 +168,7 @@ bool Options::parseOptions(int argc, const char* argv[])
167168
}
168169
i++;
169170
if (i >= argc) {
170-
std::cerr << "vISA option type ET_2xINT32 requires two integer arguments\n";
171+
std::cerr << it->first << ": vISA option type ET_2xINT32 requires two integer arguments\n";
171172
return false;
172173
}
173174
uint32_t lo32 = 0;

visa/include/VISAOptionsDefs.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ SPDX-License-Identifier: MIT
2424

2525
//=== Debugging options ===
2626
DEF_VISA_OPTION(vISA_DumpPasses, ET_BOOL, "-dumpPassesAll", UNUSED, false)
27-
// subsumes the above (should replace; 0 = none, 1 = some, 2 = all)
28-
DEF_VISA_OPTION(vISA_DumpPassesSubset, ET_INT32, "-dumpPassesSubset", UNUSED, 0)
27+
// subsumes the above (should replace; 0 = none, 1 = only when modifications are present, 2 = all)
28+
DEF_VISA_OPTION(vISA_DumpPassesSubset, ET_INT32, "-dumpPassesSubset",
29+
"0 means none; 1 means only when modifications happen; 2 means all passes", 0)
2930
// dump out dot file for debugging
3031
DEF_VISA_OPTION(vISA_DumpDot, ET_BOOL, "-dot", UNUSED, false)
3132
DEF_VISA_OPTION(vISA_DumpDotAll, ET_BOOL, "-dotAll", UNUSED, false)

0 commit comments

Comments
 (0)