Skip to content

Commit 79ccc8b

Browse files
committed
Remove GenMC verbosity level settings from Miri, remove MIRI_LOG debug prints
1 parent 8a5e504 commit 79ccc8b

File tree

4 files changed

+7
-85
lines changed

4 files changed

+7
-85
lines changed

genmc-sys/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ impl Default for GenmcParams {
2626
fn default() -> Self {
2727
Self {
2828
print_random_schedule_seed: false,
29-
quiet: true,
30-
log_level_trace: false,
3129
do_symmetry_reduction: false,
3230
}
3331
}
@@ -41,8 +39,6 @@ mod ffi {
4139
struct GenmcParams {
4240
// pub genmc_seed: u64; // OR: Option<u64>
4341
pub print_random_schedule_seed: bool,
44-
pub quiet: bool, // TODO GENMC: maybe make log-level more fine grained
45-
pub log_level_trace: bool,
4642
pub do_symmetry_reduction: bool,
4743
}
4844

genmc-sys/src_cpp/MiriInterface.cpp

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,10 @@ auto MiriGenMCShim::createHandle(const GenmcParams &config)
7171
// FIXME(genmc): expose this setting to Miri
7272
conf->randomScheduleSeed = "42";
7373
conf->printRandomScheduleSeed = config.print_random_schedule_seed;
74-
if (config.quiet)
75-
{
76-
// logLevel = VerbosityLevel::Quiet;
77-
// TODO GENMC: error might be better (or new level for `BUG`)
78-
// logLevel = VerbosityLevel::Quiet;
79-
logLevel = VerbosityLevel::Error;
80-
}
81-
else if (config.log_level_trace)
82-
{
83-
logLevel = VerbosityLevel::Trace;
84-
}
85-
else
86-
{
87-
logLevel = VerbosityLevel::Tip;
88-
}
74+
75+
// FIXME(genmc): Add support for setting this from the Miri side.
76+
// FIXME(genmc): Decide on what to do about warnings from GenMC (keep them disabled until then).
77+
logLevel = VerbosityLevel::Error;
8978

9079
// FIXME(genmc): check if we can enable IPR:
9180
conf->ipr = false;
@@ -127,20 +116,14 @@ auto MiriGenMCShim::createHandle(const GenmcParams &config)
127116
const auto addr = access.getAddr();
128117
if (!driverPtr->initVals_.contains(addr))
129118
{
130-
MIRI_LOG() << "WARNING: TODO GENMC: requested initial value for address "
131-
<< addr << ", but there is none.\n";
132119
return SVal(0xCC00CC00);
133120
// BUG_ON(!driverPtr->initVals_.contains(addr));
134121
}
135122
auto result = driverPtr->initVals_[addr];
136123
if (!result.is_init)
137124
{
138-
MIRI_LOG() << "WARNING: TODO GENMC: requested initial value for address "
139-
<< addr << ", but the memory is uninitialized.\n";
140125
return SVal(0xFF00FF00);
141126
}
142-
MIRI_LOG() << "MiriGenMCShim: requested initial value for address " << addr
143-
<< " == " << addr.get() << ", returning: " << result << "\n";
144127
return result.toSVal();
145128
};
146129
driver->getExec().getGraph().setInitValGetter(initValGetter);
@@ -211,8 +194,6 @@ void MiriGenMCShim::handleThreadJoin(ThreadId thread_id, ThreadId child_id)
211194

212195
void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
213196
{
214-
MIRI_LOG() << "GenMC: handleThreadFinish: thread id: " << thread_id << "\n";
215-
216197
auto pos = incPos(thread_id);
217198
auto retVal = SVal(ret_val);
218199

@@ -228,9 +209,7 @@ void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
228209
MemOrdering ord, GenmcScalar old_val) -> LoadResult
229210
{
230211
auto pos = incPos(thread_id);
231-
MIRI_LOG() << "Received Load from Miri at address: " << address << ", size " << size
232-
<< " with ordering " << ord << ", event: " << pos << "\n";
233-
212+
234213
auto loc = SAddr(address);
235214
auto aSize = ASize(size);
236215
auto type = AType::Unsigned; // FIXME(genmc): get correct type from Miri(?)
@@ -249,10 +228,6 @@ void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
249228
GenmcScalar rhs_value, GenmcScalar old_val)
250229
-> ReadModifyWriteResult
251230
{
252-
MIRI_LOG() << "Received Read-Modify-Write from Miri at address: " << address << ", size "
253-
<< size << " with orderings (" << loadOrd << ", " << store_ordering
254-
<< "), rmw op: " << static_cast<uint64_t>(rmw_op) << "\n";
255-
256231
auto pos = incPos(thread_id);
257232

258233
auto loc = SAddr(address);
@@ -288,14 +263,6 @@ void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
288263
MemOrdering success_store_ordering, MemOrdering fail_load_ordering,
289264
bool can_fail_spuriously) -> CompareExchangeResult
290265
{
291-
292-
MIRI_LOG() << "Received Compare-Exchange from Miri (value: " << expected_value << " --> "
293-
<< new_value << ", old value: " << old_val << ") at address: " << address
294-
<< ", size " << size << " with success orderings (" << success_load_ordering
295-
<< ", " << success_store_ordering
296-
<< "), fail load ordering: " << fail_load_ordering
297-
<< ", is weak (can fail spuriously): " << can_fail_spuriously << "\n";
298-
299266
auto pos = incPos(thread_id);
300267

301268
auto loc = SAddr(address);
@@ -335,10 +302,6 @@ void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
335302
MemOrdering ord, StoreEventType store_event_type)
336303
-> StoreResult
337304
{
338-
MIRI_LOG() << "Received Store from Miri at address " << address << ", size " << size
339-
<< " with ordering " << ord << ", is part of rmw: ("
340-
<< static_cast<uint64_t>(store_event_type) << ")\n";
341-
342305
auto pos = incPos(thread_id);
343306

344307
auto loc = SAddr(address);

genmc-sys/src_cpp/MiriInterface.hpp

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -123,52 +123,23 @@ struct MiriGenMCShim : private GenMCDriver
123123
* */
124124
void handleOldVal(const SAddr addr, GenmcScalar value)
125125
{
126-
MIRI_LOG() << "handleOldVal: " << addr << ", " << value.value << ", " << value.extra
127-
<< ", " << value.is_init << "\n";
128-
// if (!value.is_init) {
129-
// // // TODO GENMC(uninit value handling)
130-
// // MIRI_LOG() << "WARNING: got uninitialized old value, ignoring ...\n";
131-
// // return;
132-
// MIRI_LOG() << "WARNING: got uninitialized old value, converting to dummy "
133-
// "value ...\n";
134-
// value.is_init = true;
135-
// value.value = 0xAAFFAAFF;
136-
// }
137-
138126
// TODO GENMC(CLEANUP): Pass this as a parameter:
139127
auto &g = getExec().getGraph();
140128
auto *coLab = g.co_max(addr);
141-
MIRI_LOG() << "handleOldVal: coLab: " << *coLab << "\n";
142129
if (auto *wLab = llvm::dyn_cast<WriteLabel>(coLab))
143130
{
144-
MIRI_LOG()
145-
<< "handleOldVal: got WriteLabel, atomic: " << !wLab->isNotAtomic()
146-
<< "\n";
147-
if (!value.is_init)
148-
MIRI_LOG() << "WARNING: TODO GENMC: handleOldVal tried to "
149-
"overwrite value of NA "
150-
"reads-from label, but old value is `uninit`\n";
151-
else if (wLab->isNotAtomic())
131+
if (value.is_init && wLab->isNotAtomic())
152132
wLab->setVal(value.toSVal());
153133
}
154134
else if (const auto *wLab = llvm::dyn_cast<InitLabel>(coLab))
155135
{
156136
if (value.is_init)
157137
{
158138
auto result = initVals_.insert(std::make_pair(addr, value));
159-
MIRI_LOG() << "handleOldVal: got InitLabel, insertion result: "
160-
<< result.first->second << ", " << result.second << "\n";
161139
BUG_ON(result.second &&
162140
(*result.first).second !=
163141
value); /* Attempt to replace initial value */
164142
}
165-
else
166-
{
167-
// LOG(VerbosityLevel::Error) <<
168-
MIRI_LOG() << "WARNING: TODO GENMC: handleOldVal tried set initial "
169-
"value, but old "
170-
"value is `uninit`\n";
171-
}
172143
}
173144
else
174145
{

src/concurrency/genmc/config.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ pub struct GenmcConfig {
99
}
1010

1111
impl GenmcConfig {
12-
fn set_log_level_trace(&mut self) {
13-
self.params.quiet = false;
14-
self.params.log_level_trace = true;
15-
}
16-
1712
/// Function for parsing command line options for GenMC mode.
1813
///
1914
/// All GenMC arguments start with the string "-Zmiri-genmc".
@@ -36,10 +31,7 @@ impl GenmcConfig {
3631
let Some(trimmed_arg) = trimmed_arg.strip_prefix("-") else {
3732
return Err(format!("Invalid GenMC argument \"-Zmiri-genmc{trimmed_arg}\""));
3833
};
39-
if trimmed_arg == "log-trace" {
40-
// TODO GENMC: maybe expand to allow more control over log level?
41-
genmc_config.set_log_level_trace();
42-
} else if trimmed_arg == "symmetry-reduction" {
34+
if trimmed_arg == "symmetry-reduction" {
4335
// TODO GENMC (PERFORMANCE): maybe make this the default, have an option to turn it off instead
4436
genmc_config.params.do_symmetry_reduction = true;
4537
} else {

0 commit comments

Comments
 (0)