Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Drop duplicate state in tuner / options cache which resulted in intermittent disagreements between tune and load from cache #576

Merged
merged 3 commits into from
Jul 23, 2018

Conversation

nicolasvasilache
Copy link
Contributor

@nicolasvasilache nicolasvasilache commented Jul 20, 2018

This PR supposedly addresses issue #523 (only supposedly because
there is no easy repro). The problem is conjectured to come from
the tuner keeping the best time/option in a private field whereas the
functions that interact with the cache files operate on the cache.
When multiple entries have the same runtime, it is conjectured (by @ftynse)
that the ordering of the cache entries do not match the private field.

In hindsight this can easily happen with thread/block sizes because once
the number of threads/blocks is one per loop element, one can increase the
values passed to mapping options but the same code will be generated after
tightening. It is not too much of a stretch to imagine that the same code
will occasionally have the same runtime.

This commit drops the private state and ensures we always fetch the
requires values from the options cache (under its lock).

@nicolasvasilache nicolasvasilache changed the title [Experimental] Debug apparent race condition on top1 Drop duplicate state in tuner / options cache which resulted in intermittent disagreements between tune and load from cache Jul 23, 2018
@nicolasvasilache nicolasvasilache force-pushed the pr/debug branch 4 times, most recently from 91583ba to c96b6ea Compare July 23, 2018 14:20
Copy link
Contributor

@ftynse ftynse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment about separation in commits

@@ -21,7 +21,6 @@
#include <vector>

namespace tc {
namespace polyhedral {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be done in the commit that moves functional.h

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, thanks

The functional abstraction is more generally useful than just in polyhedral
This commit supposedly addresses issue facebookresearch#523 (only supposedly because
there is no easy repro). The problem is conjectured to come from
the tuner keeping the best time/option in a private field whereas the
functions that interact with the cache files operate on the cache.
When multiple entries have the same runtime, it is conjectured (by @ftynse)
that the ordering of the cache entries do not match the private field.

In hindsight this can easily happen with thread/block sizes because once
the number of threads/blocks is one per loop element, one can increase the
values passed to mapping options but the same code will be generated after
tightening. It is not too much of a stretch to imagine that the same code
will occasionally have the same runtime.

This commit drops the private state and ensures we always fetch the
requires values from the options cache (under its lock).
@nicolasvasilache
Copy link
Contributor Author

CI passed, made a minor modif verified compilation locally, merging as is

@nicolasvasilache nicolasvasilache merged commit 6d24f99 into facebookresearch:master Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants