Skip to content

Commit

Permalink
PR #15706: Fix sporadic failure of test in PJRT C API tests
Browse files Browse the repository at this point in the history
Imported from GitHub PR #15706

This test would fail sometimes because the creation of the buffer would not complete before the transfer would start. This would mean that the final buffer had `{0,0,0,0}` instead of the expected `{41,42,43,44}`. Waiting for the creation of this buffer should solve this.
Copybara import of the project:

--
fc51fa8 by Shraiysh Vaishay <[email protected]>:

Fix sporadic failure of test in PJRT C API tests

This test would fail sometimes because the creation of the buffer
would not complete before the transfer would start. This would
mean that the final buffer had `{0,0,0,0}` instead of the expected
`{41,42,43,44}`. Waiting for the creation of this buffer should
solve this.

Merging this change closes #15706

COPYBARA_INTEGRATE_REVIEW=#15706 from shraiysh:fix_pjrt_test_failure fc51fa8
PiperOrigin-RevId: 659488482
  • Loading branch information
shraiysh authored and copybara-github committed Aug 5, 2024
1 parent c7c31e4 commit 881f508
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xla/pjrt/c/pjrt_c_api_gpu_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class PjrtCApiGpuTest : public PjrtCApiTestBase {

TEST_F(PjrtCApiGpuTest, CreateViewOfDeviceBuffer) {
// Prepares a device memory ptr on GPU.
std::unique_ptr<PJRT_Buffer, ::pjrt::PJRT_BufferDeleter> buffer =
create_buffer().first;
auto [buffer, buffer_future] = create_buffer();
TF_CHECK_OK(buffer_future.Await());
PJRT_Buffer_OpaqueDeviceMemoryDataPointer_Args device_buffer_ptr_args;
device_buffer_ptr_args.struct_size =
PJRT_Buffer_OpaqueDeviceMemoryDataPointer_Args_STRUCT_SIZE;
Expand Down

0 comments on commit 881f508

Please sign in to comment.