@@ -47,10 +47,8 @@ limitations under the License.
4747#include " xla/stream_executor/device_address_allocator.h"
4848#include " xla/stream_executor/platform.h"
4949#include " xla/stream_executor/stream_executor.h"
50- #include " xla/stream_executor/stream_executor_memory_allocator .h"
50+ #include " xla/stream_executor/stream_executor_address_allocator .h"
5151#include " xla/tsl/lib/core/status_test_util.h"
52- #include " xla/tsl/platform/errors.h"
53- #include " xla/tsl/platform/statusor.h"
5452#include " xla/xla_data.pb.h"
5553
5654namespace xla {
@@ -145,15 +143,15 @@ TEST_F(GpuProfilerTest, CreateInputBuffersAndProfile) {
145143 ROOT c = s32[] constant(1)
146144 }
147145 )" ;
148- TF_ASSERT_OK_AND_ASSIGN (std::shared_ptr<HloModule> module ,
149- ParseAndReturnVerifiedModule (kHloModule ));
146+ ASSERT_OK_AND_ASSIGN (std::shared_ptr<HloModule> module ,
147+ ParseAndReturnVerifiedModule (kHloModule ));
150148 MockExecutable mock_executable (module , 1000 );
151149 auto profiler =
152150 GpuProfiler::Create (stream_exec_, ProfileOptions (), allocator_.get ());
153- TF_ASSERT_OK_AND_ASSIGN (std::unique_ptr<InputBuffers> buffers,
154- profiler->CreateInputBuffers (&mock_executable));
155- TF_ASSERT_OK_AND_ASSIGN (ProfileResult profile,
156- profiler->Profile (&mock_executable, *buffers));
151+ ASSERT_OK_AND_ASSIGN (std::unique_ptr<InputBuffers> buffers,
152+ profiler->CreateInputBuffers (&mock_executable));
153+ ASSERT_OK_AND_ASSIGN (ProfileResult profile,
154+ profiler->Profile (&mock_executable, *buffers));
157155 EXPECT_EQ (profile.duration , absl::Nanoseconds (1000 ));
158156 EXPECT_EQ (profile.output_buffer ->on_device_shape (),
159157 ShapeUtil::MakeShape (S32 , {}));
@@ -167,15 +165,15 @@ TEST_F(GpuProfilerTest, FailingExecutablesReturnStatus) {
167165 ROOT c = s32[] constant(1)
168166 }
169167 )" ;
170- TF_ASSERT_OK_AND_ASSIGN (std::shared_ptr<HloModule> module ,
171- ParseAndReturnVerifiedModule (kHloModule ));
168+ ASSERT_OK_AND_ASSIGN (std::shared_ptr<HloModule> module ,
169+ ParseAndReturnVerifiedModule (kHloModule ));
172170 MockExecutable mock_executable (module , /* duration_ns=*/ 0 ,
173171 /* should_fail=*/ true );
174172
175173 auto profiler =
176174 GpuProfiler::Create (stream_exec_, ProfileOptions (), allocator_.get ());
177- TF_ASSERT_OK_AND_ASSIGN (std::unique_ptr<InputBuffers> buffers,
178- profiler->CreateInputBuffers (&mock_executable));
175+ ASSERT_OK_AND_ASSIGN (std::unique_ptr<InputBuffers> buffers,
176+ profiler->CreateInputBuffers (&mock_executable));
179177 EXPECT_THAT (profiler->Profile (&mock_executable, *buffers),
180178 StatusIs (absl::StatusCode::kInternal ));
181179}
@@ -191,14 +189,14 @@ TEST_P(GpuProfilerTestWithRedzonePadding, CheckInputBuffers) {
191189 ROOT c = s32[] constant(1)
192190 }
193191 )" ;
194- TF_ASSERT_OK_AND_ASSIGN (std::shared_ptr<HloModule> module ,
195- ParseAndReturnVerifiedModule (kHloModule ));
192+ ASSERT_OK_AND_ASSIGN (std::shared_ptr<HloModule> module ,
193+ ParseAndReturnVerifiedModule (kHloModule ));
196194 MockExecutable mock_executable (module , 1000 );
197195 ProfileOptions options;
198196 options.redzone_padding_bytes = GetParam ();
199197 auto profiler = GpuProfiler::Create (stream_exec_, options, allocator_.get ());
200- TF_ASSERT_OK_AND_ASSIGN (std::unique_ptr<InputBuffers> buffers,
201- profiler->CreateInputBuffers (&mock_executable));
198+ ASSERT_OK_AND_ASSIGN (std::unique_ptr<InputBuffers> buffers,
199+ profiler->CreateInputBuffers (&mock_executable));
202200 TF_EXPECT_OK (profiler->CheckInputBuffers (*buffers));
203201}
204202
@@ -210,33 +208,33 @@ TEST_F(GpuProfilerTest, CheckOutputBufferWhenBuffersAreSame) {
210208 ProfileOptions options;
211209 auto profiler = GpuProfiler::Create (stream_exec_, options, allocator_.get ());
212210
213- TF_ASSERT_OK_AND_ASSIGN (auto stream, stream_exec_->CreateStream ());
211+ ASSERT_OK_AND_ASSIGN (auto stream, stream_exec_->CreateStream ());
214212 auto allocator =
215213 std::make_unique<stream_executor::StreamExecutorAddressAllocator>(
216214 stream_exec_);
217- TF_ASSERT_OK_AND_ASSIGN (ScopedShapedBuffer output,
218- CreateTestBuffer (allocator.get (), stream_exec_,
219- stream.get (), /* value=*/ 1 ));
220- TF_ASSERT_OK_AND_ASSIGN (ScopedShapedBuffer reference,
221- CreateTestBuffer (allocator.get (), stream_exec_,
222- stream.get (), /* value=*/ 1 ));
215+ ASSERT_OK_AND_ASSIGN (ScopedShapedBuffer output,
216+ CreateTestBuffer (allocator.get (), stream_exec_,
217+ stream.get (), /* value=*/ 1 ));
218+ ASSERT_OK_AND_ASSIGN (ScopedShapedBuffer reference,
219+ CreateTestBuffer (allocator.get (), stream_exec_,
220+ stream.get (), /* value=*/ 1 ));
223221 EXPECT_THAT (profiler->CheckOutputBuffer (output, reference, /* rtol=*/ 0.0 ),
224222 StatusIs (absl::StatusCode::kOk ));
225223}
226224
227225TEST_F (GpuProfilerTest, CheckOutputBufferWhenBuffersAreDifferent) {
228226 ProfileOptions options;
229227 auto profiler = GpuProfiler::Create (stream_exec_, options, allocator_.get ());
230- TF_ASSERT_OK_AND_ASSIGN (auto stream, stream_exec_->CreateStream ());
228+ ASSERT_OK_AND_ASSIGN (auto stream, stream_exec_->CreateStream ());
231229 auto allocator =
232230 std::make_unique<stream_executor::StreamExecutorAddressAllocator>(
233231 stream_exec_);
234- TF_ASSERT_OK_AND_ASSIGN (ScopedShapedBuffer output,
235- CreateTestBuffer (allocator.get (), stream_exec_,
236- stream.get (), /* value=*/ 1 ));
237- TF_ASSERT_OK_AND_ASSIGN (ScopedShapedBuffer reference,
238- CreateTestBuffer (allocator.get (), stream_exec_,
239- stream.get (), /* value=*/ 2 ));
232+ ASSERT_OK_AND_ASSIGN (ScopedShapedBuffer output,
233+ CreateTestBuffer (allocator.get (), stream_exec_,
234+ stream.get (), /* value=*/ 1 ));
235+ ASSERT_OK_AND_ASSIGN (ScopedShapedBuffer reference,
236+ CreateTestBuffer (allocator.get (), stream_exec_,
237+ stream.get (), /* value=*/ 2 ));
240238 EXPECT_THAT (profiler->CheckOutputBuffer (output, reference, /* rtol=*/ 0.0 ),
241239 StatusIs (absl::StatusCode::kInternal ));
242240}
@@ -245,15 +243,15 @@ TEST_F(GpuProfilerTest, CheckOutputBufferWithTupleShapeAreSame) {
245243 ProfileOptions options;
246244 auto profiler = GpuProfiler::Create (stream_exec_, options, allocator_.get ());
247245
248- TF_ASSERT_OK_AND_ASSIGN (auto stream, stream_exec_->CreateStream ());
246+ ASSERT_OK_AND_ASSIGN (auto stream, stream_exec_->CreateStream ());
249247 auto allocator =
250248 std::make_unique<stream_executor::StreamExecutorAddressAllocator>(
251249 stream_exec_);
252- TF_ASSERT_OK_AND_ASSIGN (
250+ ASSERT_OK_AND_ASSIGN (
253251 ScopedShapedBuffer output,
254252 CreateTupleTestBuffer (allocator.get (), stream_exec_, stream.get (),
255253 /* value1=*/ 1 , /* value2=*/ 2 ));
256- TF_ASSERT_OK_AND_ASSIGN (
254+ ASSERT_OK_AND_ASSIGN (
257255 ScopedShapedBuffer reference,
258256 CreateTupleTestBuffer (allocator.get (), stream_exec_, stream.get (),
259257 /* value1=*/ 1 , /* value2=*/ 2 ));
@@ -265,19 +263,19 @@ TEST_F(GpuProfilerTest, CheckOutputBufferWithTupleShapeAreDifferent) {
265263 ProfileOptions options;
266264 auto profiler = GpuProfiler::Create (stream_exec_, options, allocator_.get ());
267265
268- TF_ASSERT_OK_AND_ASSIGN (auto stream, stream_exec_->CreateStream ());
266+ ASSERT_OK_AND_ASSIGN (auto stream, stream_exec_->CreateStream ());
269267 auto allocator =
270268 std::make_unique<stream_executor::StreamExecutorAddressAllocator>(
271269 stream_exec_);
272- TF_ASSERT_OK_AND_ASSIGN (
270+ ASSERT_OK_AND_ASSIGN (
273271 ScopedShapedBuffer reference,
274272 CreateTupleTestBuffer (allocator.get (), stream_exec_, stream.get (),
275273 /* value1=*/ 1 , /* value2=*/ 2 ));
276- TF_ASSERT_OK_AND_ASSIGN (
274+ ASSERT_OK_AND_ASSIGN (
277275 ScopedShapedBuffer output_error_in_first_element,
278276 CreateTupleTestBuffer (allocator.get (), stream_exec_, stream.get (),
279277 /* value1=*/ 0 , /* value2=*/ 2 ));
280- TF_ASSERT_OK_AND_ASSIGN (
278+ ASSERT_OK_AND_ASSIGN (
281279 ScopedShapedBuffer output_error_in_second_element,
282280 CreateTupleTestBuffer (allocator.get (), stream_exec_, stream.get (),
283281 /* value1=*/ 1 , /* value2=*/ 3 ));
@@ -289,8 +287,8 @@ TEST_F(GpuProfilerTest, CheckOutputBufferWithTupleShapeAreDifferent) {
289287 StatusIs (absl::StatusCode::kInternal ));
290288}
291289
292- TEST_F (GpuProfilerTest, CheckScratchBytesArePopulatedUsingBufferAssignment ) {
293- constexpr absl::string_view kHloModule = R"(
290+ TEST_F (GpuProfilerTest, CheckScratchBytesArePopulated ) {
291+ constexpr absl::string_view kHloModule = R"hlo (
294292HloModule gemm_fusion_dot.1, is_scheduled=true, entry_computation_layout={(bf16[32,120,6,512]{3,2,1,0}, f32[3072,512]{1,0})->bf16[3840,512]{1,0}}, frontend_attributes={fingerprint_before_lhs="40f912baf5b53a4f75b1ba9b3442042f"}
295293
296294%wrapped_convert_computation (param_0: f32[3072,512]) -> bf16[3072,512] {
@@ -307,19 +305,19 @@ ENTRY %entry_computation (transpose.562: bf16[32,120,6,512], Arg_1.2: f32[3072,5
307305 %custom-call.1 = (bf16[512,3840]{0,1}, s8[26738688]{0}) custom-call(%wrapped_convert, %bitcast.1), custom_call_target="__cublas$lt$matmul", backend_config={"operation_queue_id":"0","gemm_backend_config":{"alpha_real":1,"beta":0,"dot_dimension_numbers":{"lhs_contracting_dimensions":["0"],"rhs_contracting_dimensions":["1"],"lhs_batch_dimensions":[],"rhs_batch_dimensions":[]},"alpha_imag":0,"precision_config":{"operand_precision":["DEFAULT","DEFAULT"],"algorithm":"ALG_UNSET"},"epilogue":"DEFAULT","lhs_stride":"1572864","rhs_stride":"11796480","grad_x":false,"grad_y":false,"damax_output":false},"force_earliest_schedule":false,"reification_cost":[]}
308306 %get-tuple-element = bf16[512,3840]{0,1} get-tuple-element(%custom-call.1), index=0
309307 ROOT %bitcast.2 = bf16[3840,512]{1,0} bitcast(%get-tuple-element)
310- })" ;
308+ })hlo " ;
311309 NVPTXCompiler compiler;
312- TF_ASSERT_OK_AND_ASSIGN (std::unique_ptr<HloModule> module ,
313- ParseAndReturnVerifiedModule (kHloModule ));
314- TF_ASSERT_OK_AND_ASSIGN (auto gpu_executable,
315- compiler.RunBackend (std::move (module ), stream_exec_,
316- GpuCompiler::CompileOptions ()));
310+ ASSERT_OK_AND_ASSIGN (std::unique_ptr<HloModule> module ,
311+ ParseAndReturnVerifiedModule (kHloModule ));
312+ ASSERT_OK_AND_ASSIGN (auto gpu_executable,
313+ compiler.RunBackend (std::move (module ), stream_exec_,
314+ GpuCompiler::CompileOptions ()));
317315 auto profiler =
318316 GpuProfiler::Create (stream_exec_, ProfileOptions (), allocator_.get ());
319- TF_ASSERT_OK_AND_ASSIGN (std::unique_ptr<InputBuffers> buffers,
320- profiler->CreateInputBuffers (gpu_executable.get ()));
321- TF_ASSERT_OK_AND_ASSIGN (ProfileResult profile,
322- profiler->Profile (gpu_executable.get (), *buffers));
317+ ASSERT_OK_AND_ASSIGN (std::unique_ptr<InputBuffers> buffers,
318+ profiler->CreateInputBuffers (gpu_executable.get ()));
319+ ASSERT_OK_AND_ASSIGN (ProfileResult profile,
320+ profiler->Profile (gpu_executable.get (), *buffers));
323321 EXPECT_EQ (profile.scratch_bytes , 26738688 );
324322}
325323
0 commit comments