提交 2ed84d32 编写于 作者: A A. Unique TensorFlower 提交者: TensorFlower Gardener

change triton autotuning AutotunerUtil::AddResult non-ok status to a non-blocking LOG(WARNING)

PiperOrigin-RevId: 564420754
上级 5c00a18e
......@@ -134,15 +134,11 @@ static AutotuneResult* TryFindInCache(const AutotuneCacheKey& key) {
return TryFindInCache(key) != nullptr;
}
/*static*/ Status AutotunerUtil::AddResult(const AutotuneCacheKey& key,
AutotuneResult result) {
/*static*/ bool AutotunerUtil::AddResult(const AutotuneCacheKey& key,
AutotuneResult result) {
absl::MutexLock lock(&autotune_cache_mu);
auto [_, inserted] = autotune_cache.emplace(key, std::move(result));
if (!inserted) {
return absl::AlreadyExistsError(absl::StrCat(
"The key is already in the autotune cache: ", key.ToString()));
}
return OkStatus();
return inserted;
}
/*static*/ StatusOr<AutotuneResult> AutotunerUtil::Autotune(
......
......@@ -178,10 +178,10 @@ struct AutotunerUtil {
// Adds the result to the autotune cache.
//
// It is an error to call this, if the key is already present in the cache.
// Returns true if the entry is inserted.
//
// Normally, we don't have to use this low level method.
static Status AddResult(const AutotuneCacheKey& key, AutotuneResult result);
static bool AddResult(const AutotuneCacheKey& key, AutotuneResult result);
// Creates a RedzoneAllocator from a given config. If `force_stream` is
// provided, than it is used for checking redzones.
......
......@@ -712,8 +712,13 @@ Status Autotune(const AutotuneConfig& config, AutotunerCompileUtil& util,
DumpAutotunedFusions(config, result, fusion, fusion_id_for_dump));
}
TF_RETURN_IF_ERROR(AutotunerUtil::AddResult(
AutotunerUtil::GetKey(fusion, config), std::move(result)));
const AutotuneCacheKey key = AutotunerUtil::GetKey(fusion, config);
if (!AutotunerUtil::AddResult(key, std::move(result))) {
// In the context of model server, concurrent autotuning is expected and
// insertion of identical autotuning keys is accepted.
LOG(WARNING) << "AutotunerUtil::AddResult already existed: "
<< key.ToString();
}
fusion_id_for_dump += 1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册