Skip to content

Commit 3f0226c

Browse files
committed
Remove GenMC verbosity level settings from Miri, remove MIRI_LOG debug prints
1 parent 611f541 commit 3f0226c

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
@@ -72,21 +72,10 @@ auto MiriGenMCShim::createHandle(const GenmcParams &config)
7272
conf->randomScheduleSeed =
7373
"42"; // TODO GENMC: only for random exploration/scheduling mode in GenMC
7474
conf->printRandomScheduleSeed = config.print_random_schedule_seed;
75-
if (config.quiet)
76-
{
77-
// logLevel = VerbosityLevel::Quiet;
78-
// TODO GENMC: error might be better (or new level for `BUG`)
79-
// logLevel = VerbosityLevel::Quiet;
80-
logLevel = VerbosityLevel::Error;
81-
}
82-
else if (config.log_level_trace)
83-
{
84-
logLevel = VerbosityLevel::Trace;
85-
}
86-
else
87-
{
88-
logLevel = VerbosityLevel::Tip;
89-
}
75+
76+
// FIXME(genmc): Add support for setting this from the Miri side.
77+
// FIXME(genmc): Decide on what to do about warnings from GenMC (keep them disabled until then).
78+
logLevel = VerbosityLevel::Error;
9079

9180
// TODO GENMC (EXTRA): check if we can enable IPR:
9281
conf->ipr = false;
@@ -128,20 +117,14 @@ auto MiriGenMCShim::createHandle(const GenmcParams &config)
128117
const auto addr = access.getAddr();
129118
if (!driverPtr->initVals_.contains(addr))
130119
{
131-
MIRI_LOG() << "WARNING: TODO GENMC: requested initial value for address "
132-
<< addr << ", but there is none.\n";
133120
return SVal(0xCC00CC00);
134121
// BUG_ON(!driverPtr->initVals_.contains(addr));
135122
}
136123
auto result = driverPtr->initVals_[addr];
137124
if (!result.is_init)
138125
{
139-
MIRI_LOG() << "WARNING: TODO GENMC: requested initial value for address "
140-
<< addr << ", but the memory is uninitialized.\n";
141126
return SVal(0xFF00FF00);
142127
}
143-
MIRI_LOG() << "MiriGenMCShim: requested initial value for address " << addr
144-
<< " == " << addr.get() << ", returning: " << result << "\n";
145128
return result.toSVal();
146129
};
147130
driver->getExec().getGraph().setInitValGetter(initValGetter);
@@ -220,8 +203,6 @@ void MiriGenMCShim::handleThreadJoin(ThreadId thread_id, ThreadId child_id)
220203

221204
void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
222205
{
223-
MIRI_LOG() << "GenMC: handleThreadFinish: thread id: " << thread_id << "\n";
224-
225206
auto pos = incPos(thread_id);
226207
auto retVal = SVal(ret_val);
227208

@@ -237,9 +218,7 @@ void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
237218
MemOrdering ord, GenmcScalar old_val) -> LoadResult
238219
{
239220
auto pos = incPos(thread_id);
240-
MIRI_LOG() << "Received Load from Miri at address: " << address << ", size " << size
241-
<< " with ordering " << ord << ", event: " << pos << "\n";
242-
221+
243222
auto loc = SAddr(address);
244223
auto aSize = ASize(size);
245224
auto type = AType::Unsigned; // TODO GENMC: get correct type from Miri
@@ -258,10 +237,6 @@ void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
258237
GenmcScalar rhs_value, GenmcScalar old_val)
259238
-> ReadModifyWriteResult
260239
{
261-
MIRI_LOG() << "Received Read-Modify-Write from Miri at address: " << address << ", size "
262-
<< size << " with orderings (" << loadOrd << ", " << store_ordering
263-
<< "), rmw op: " << static_cast<uint64_t>(rmw_op) << "\n";
264-
265240
auto pos = incPos(thread_id);
266241

267242
auto loc = SAddr(address);
@@ -297,14 +272,6 @@ void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
297272
MemOrdering success_store_ordering, MemOrdering fail_load_ordering,
298273
bool can_fail_spuriously) -> CompareExchangeResult
299274
{
300-
301-
MIRI_LOG() << "Received Compare-Exchange from Miri (value: " << expected_value << " --> "
302-
<< new_value << ", old value: " << old_val << ") at address: " << address
303-
<< ", size " << size << " with success orderings (" << success_load_ordering
304-
<< ", " << success_store_ordering
305-
<< "), fail load ordering: " << fail_load_ordering
306-
<< ", is weak (can fail spuriously): " << can_fail_spuriously << "\n";
307-
308275
auto pos = incPos(thread_id);
309276

310277
auto loc = SAddr(address);
@@ -344,10 +311,6 @@ void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
344311
MemOrdering ord, StoreEventType store_event_type)
345312
-> StoreResult
346313
{
347-
MIRI_LOG() << "Received Store from Miri at address " << address << ", size " << size
348-
<< " with ordering " << ord << ", is part of rmw: ("
349-
<< static_cast<uint64_t>(store_event_type) << ")\n";
350-
351314
auto pos = incPos(thread_id);
352315

353316
auto loc = SAddr(address); // TODO GENMC: called addr for write, loc for read?

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)