Skip to content

Commit

Permalink
Automated Code Change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 716914439
  • Loading branch information
tensorflower-gardener committed Jan 18, 2025
1 parent 9d1b4fa commit f1a3c9b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
4 changes: 0 additions & 4 deletions tensorflow/core/common_runtime/gpu/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -414,15 +414,11 @@ tf_cuda_cc_test(
tags = tf_cuda_tests_tags(),
deps = [
"//tensorflow/cc:cc_ops",
"//tensorflow/core:framework",
"//tensorflow/core:framework_internal",
"//tensorflow/core:lib",
"//tensorflow/core:lib_internal",
"//tensorflow/core:protos_all_cc",
"//tensorflow/core:test",
"//tensorflow/core:test_main",
"//tensorflow/core:testlib",
"//tensorflow/core/common_runtime:core_cpu",
"//tensorflow/core/common_runtime:core_cpu_internal",
"//tensorflow/core/common_runtime:direct_session_internal",
],
Expand Down
13 changes: 7 additions & 6 deletions tensorflow/core/common_runtime/gpu/gpu_allocator_retry_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#include "tensorflow/core/common_runtime/allocator_retry.h"

#include <memory>
#include <vector>

#include "tensorflow/core/common_runtime/allocator_retry.h"
#include "tensorflow/core/lib/core/notification.h"
#include "tensorflow/core/platform/env.h"
#include "tensorflow/core/platform/logging.h"
Expand Down Expand Up @@ -121,7 +122,7 @@ class GPUAllocatorRetryTest : public ::testing::Test {
GPUAllocatorRetryTest() {}

void LaunchConsumerThreads(int num_consumers, int cap_needed) {
barrier_.reset(new AlternatingBarrier(num_consumers));
barrier_ = std::make_unique<AlternatingBarrier>(num_consumers);
consumer_count_.resize(num_consumers, 0);
for (int i = 0; i < num_consumers; ++i) {
consumers_.push_back(Env::Default()->StartThread(
Expand Down Expand Up @@ -183,7 +184,7 @@ class GPUAllocatorRetryTest : public ::testing::Test {
TEST_F(GPUAllocatorRetryTest, RetrySuccess) {
// Support up to 2 allocations simultaneously, waits up to 1000 msec for
// a chance to alloc.
alloc_.reset(new FakeAllocator(2, 1000));
alloc_ = std::make_unique<FakeAllocator>(2, 1000);
// Launch 3 consumers, each of whom needs 1 unit at a time.
LaunchConsumerThreads(3, 1);
// This should be enough time for each consumer to be satisfied many times.
Expand All @@ -208,7 +209,7 @@ TEST_F(GPUAllocatorRetryTest, RetrySuccess) {
TEST_F(GPUAllocatorRetryTest, NoRetryFail) {
// Support up to 2 allocations simultaneously, waits up to 0 msec for
// a chance to alloc.
alloc_.reset(new FakeAllocator(2, 0));
alloc_ = std::make_unique<FakeAllocator>(2, 0);
// Launch 3 consumers, each of whom needs 1 unit at a time.
LaunchConsumerThreads(3, 1);
Env::Default()->SleepForMicroseconds(50000);
Expand All @@ -229,7 +230,7 @@ TEST_F(GPUAllocatorRetryTest, NoRetryFail) {
TEST_F(GPUAllocatorRetryTest, RetryInsufficientFail) {
// Support up to 2 allocations simultaneously, waits up to 1000 msec for
// a chance to alloc.
alloc_.reset(new FakeAllocator(2, 1000));
alloc_ = std::make_unique<FakeAllocator>(2, 1000);
// Launch 3 consumers, each of whom needs 2 units at a time. We expect
// deadlock where 2 consumers each hold 1 unit, and timeout trying to
// get the second.
Expand Down

0 comments on commit f1a3c9b

Please sign in to comment.