Skip to content

Commit 08a63c5

Browse files
steffenlarsenhdelan
authored andcommitted
[SYCL][NFC] Avoid warnings in SYCLSpecConstMaterializer and program_manager (intel#14770)
This commit avoids the following warnings in post-commit testing: * SYCLSpecConstMaterializer had a loop purely for debug printing. If `NDEBUG` is defined, the loop variable is unused, which causes a warning. To address this, the use of `LLVM_DEBUG` is moved to outside the full debug printing body. * In program_manager, debug printing now checks whether debug printing is enabled using `if constexpr`. This now means that `getFormatStr` is unused, which in turn causes a warning. This commit marks it as potentially unused to avoid this warning. --------- Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 17612cf commit 08a63c5

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

sycl-fusion/passes/kernel-fusion/SYCLSpecConstMaterializer.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -214,21 +214,23 @@ void SYCLSpecConstMaterializer::populateUses(Argument *A) {
214214
}
215215

216216
void SYCLSpecConstMaterializer::reportAndReset() {
217-
if (LoadsToTypes.empty()) {
218-
LLVM_DEBUG(dbgs() << "Did not find any loads from spec const buffer.\n");
219-
} else {
220-
LLVM_DEBUG(dbgs() << "Replaced: " << LoadsToTypes.size()
221-
<< " loads from spec const buffer.\n");
222-
LLVM_DEBUG(dbgs() << "Load to global variable mappings:\n");
223-
for (auto &LTT : LoadsToTypes) {
224-
LLVM_DEBUG(dbgs() << "\tLoad:\n");
225-
LLVM_DEBUG(LTT.first->dump());
226-
LLVM_DEBUG(dbgs() << "\tGlobal Variable:\n");
227-
LLVM_DEBUG(TypesAndOffsetsToBlob[LTT.second]->dump());
228-
LLVM_DEBUG(dbgs() << "\n");
217+
LLVM_DEBUG({
218+
if (LoadsToTypes.empty()) {
219+
dbgs() << "Did not find any loads from spec const buffer.\n";
220+
} else {
221+
dbgs() << "Replaced: " << LoadsToTypes.size()
222+
<< " loads from spec const buffer.\n";
223+
dbgs() << "Load to global variable mappings:\n";
224+
for (auto &LTT : LoadsToTypes) {
225+
dbgs() << "\tLoad:\n";
226+
LTT.first->dump();
227+
dbgs() << "\tGlobal Variable:\n";
228+
TypesAndOffsetsToBlob[LTT.second]->dump();
229+
dbgs() << "\n";
230+
}
229231
}
230-
}
231-
LLVM_DEBUG(dbgs() << "\n\n");
232+
dbgs() << "\n\n";
233+
});
232234

233235
// Reset the state.
234236
TypesAndOffsets.clear();

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ isDeviceBinaryTypeSupported(const context &C,
157157
return true;
158158
}
159159

160-
static const char *getFormatStr(sycl::detail::pi::PiDeviceBinaryType Format) {
160+
// getFormatStr is used for debug-printing, so it may be unused.
161+
[[maybe_unused]] static const char *
162+
getFormatStr(sycl::detail::pi::PiDeviceBinaryType Format) {
161163
switch (Format) {
162164
case PI_DEVICE_BINARY_TYPE_NONE:
163165
return "none";

0 commit comments

Comments
 (0)