Skip to content

Commit 6bd80e4

Browse files
committed
Address review comments
1 parent cf709bf commit 6bd80e4

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

third_party/intel/backend/driver.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ static inline T checkSyclErrors(const std::tuple<T, ze_result_t> tuple) {
3131
const auto code = std::get<1>(tuple);
3232
if (code != ZE_RESULT_SUCCESS) {
3333
throw std::runtime_error(parseZeResultCode(code));
34-
} else {
35-
return std::get<0>(tuple);
3634
}
35+
return std::get<0>(tuple);
3736
}
3837

3938
static PyObject *getDeviceProperties(PyObject *self, PyObject *args) {
@@ -131,15 +130,15 @@ compileLevelZeroObjects(uint8_t *binary_ptr, const size_t binary_size,
131130
struct BuildFlags {
132131
std::string build_flags_str;
133132

134-
const std::string LARGE_GRF_FLAG{"-cl-intel-256-GRF-per-thread"};
135-
const std::string SMALL_GRF_FLAG{"-cl-intel-128-GRF-per-thread"};
136-
const std::string AUTO_GRF_FLAG{"-cl-intel-enable-auto-large-GRF-mode"};
133+
const char *LARGE_GRF_FLAG{"-cl-intel-256-GRF-per-thread"};
134+
const char *SMALL_GRF_FLAG{"-cl-intel-128-GRF-per-thread"};
135+
const char *AUTO_GRF_FLAG{"-cl-intel-enable-auto-large-GRF-mode"};
137136

138137
BuildFlags(const char *build_flags) : build_flags_str(build_flags) {}
139138

140139
const std::string &operator()() const { return build_flags_str; }
141140

142-
int32_t n_regs() {
141+
int32_t n_regs() const {
143142
if (build_flags_str.find(LARGE_GRF_FLAG) != std::string::npos) {
144143
return 256;
145144
}
@@ -152,18 +151,18 @@ struct BuildFlags {
152151
return 0;
153152
}
154153

155-
const bool hasGRFSizeFlag() {
154+
const bool hasGRFSizeFlag() const {
156155
if (build_flags_str.find(LARGE_GRF_FLAG) != std::string::npos ||
157156
build_flags_str.find(SMALL_GRF_FLAG) != std::string::npos ||
158157
build_flags_str.find(AUTO_GRF_FLAG) != std::string::npos) {
159158
return true;
160-
} else {
161-
return false;
162159
}
160+
161+
return false;
163162
}
164163

165164
void addLargeGRFSizeFlag() {
166-
build_flags_str = build_flags_str.append(" " + LARGE_GRF_FLAG);
165+
build_flags_str = build_flags_str.append(" ").append(LARGE_GRF_FLAG);
167166
}
168167
};
169168

0 commit comments

Comments
 (0)