Skip to content

Commit e87d751

Browse files
committed
Remove GenMC verbosity level settings from Miri, remove MIRI_LOG debug prints
1 parent e223cd9 commit e87d751

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
@@ -28,8 +28,6 @@ impl Default for GenmcParams {
2828
fn default() -> Self {
2929
Self {
3030
print_random_schedule_seed: false,
31-
quiet: true,
32-
log_level_trace: false,
3331
do_symmetry_reduction: false,
3432
}
3533
}
@@ -43,8 +41,6 @@ mod ffi {
4341
struct GenmcParams {
4442
// pub genmc_seed: u64; // OR: Option<u64>
4543
pub print_random_schedule_seed: bool,
46-
pub quiet: bool, // TODO GENMC: maybe make log-level more fine grained
47-
pub log_level_trace: bool,
4844
pub do_symmetry_reduction: bool,
4945
}
5046

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);
@@ -208,8 +191,6 @@ void MiriGenMCShim::handleThreadJoin(ThreadId thread_id, ThreadId child_id)
208191

209192
void MiriGenMCShim::handleThreadFinish(ThreadId thread_id, uint64_t ret_val)
210193
{
211-
MIRI_LOG() << "GenMC: handleThreadFinish: thread id: " << thread_id << "\n";
212-
213194
auto pos = incPos(thread_id);
214195
auto retVal = SVal(ret_val);
215196

@@ -232,9 +213,7 @@ void MiriGenMCShim::handleThreadKill(ThreadId thread_id) {
232213
MemOrdering ord, GenmcScalar old_val) -> LoadResult
233214
{
234215
auto pos = incPos(thread_id);
235-
MIRI_LOG() << "Received Load from Miri at address: " << address << ", size " << size
236-
<< " with ordering " << ord << ", event: " << pos << "\n";
237-
216+
238217
auto loc = SAddr(address);
239218
auto aSize = ASize(size);
240219
// `type` is only used for printing.
@@ -254,10 +233,6 @@ void MiriGenMCShim::handleThreadKill(ThreadId thread_id) {
254233
GenmcScalar rhs_value, GenmcScalar old_val)
255234
-> ReadModifyWriteResult
256235
{
257-
MIRI_LOG() << "Received Read-Modify-Write from Miri at address: " << address << ", size "
258-
<< size << " with orderings (" << loadOrd << ", " << store_ordering
259-
<< "), rmw op: " << static_cast<uint64_t>(rmw_op) << "\n";
260-
261236
auto pos = incPos(thread_id);
262237

263238
auto loc = SAddr(address);
@@ -294,14 +269,6 @@ void MiriGenMCShim::handleThreadKill(ThreadId thread_id) {
294269
MemOrdering success_store_ordering, MemOrdering fail_load_ordering,
295270
bool can_fail_spuriously) -> CompareExchangeResult
296271
{
297-
298-
MIRI_LOG() << "Received Compare-Exchange from Miri (value: " << expected_value << " --> "
299-
<< new_value << ", old value: " << old_val << ") at address: " << address
300-
<< ", size " << size << " with success orderings (" << success_load_ordering
301-
<< ", " << success_store_ordering
302-
<< "), fail load ordering: " << fail_load_ordering
303-
<< ", is weak (can fail spuriously): " << can_fail_spuriously << "\n";
304-
305272
auto pos = incPos(thread_id);
306273

307274
auto loc = SAddr(address);
@@ -342,10 +309,6 @@ void MiriGenMCShim::handleThreadKill(ThreadId thread_id) {
342309
MemOrdering ord, StoreEventType store_event_type)
343310
-> StoreResult
344311
{
345-
MIRI_LOG() << "Received Store from Miri at address " << address << ", size " << size
346-
<< " with ordering " << ord << ", is part of rmw: ("
347-
<< static_cast<uint64_t>(store_event_type) << ")\n";
348-
349312
auto pos = incPos(thread_id);
350313

351314
auto loc = SAddr(address);

genmc-sys/src_cpp/MiriInterface.hpp

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

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)