From 56a660da4b282c4630d038d1471efba2f12d19e4 Mon Sep 17 00:00:00 2001 From: Niklas Vangerow Date: Mon, 27 Oct 2025 12:22:17 -0700 Subject: [PATCH] Migrate cpu_gpu_fusion_test to use PjRt. PiperOrigin-RevId: 824627421 --- third_party/xla/xla/tests/BUILD | 6 +++++- third_party/xla/xla/tests/cpu_gpu_fusion_test.cc | 11 +++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/third_party/xla/xla/tests/BUILD b/third_party/xla/xla/tests/BUILD index 6d6bbb5287a..85036fbd350 100644 --- a/third_party/xla/xla/tests/BUILD +++ b/third_party/xla/xla/tests/BUILD @@ -3121,9 +3121,13 @@ xla_test( "gpu", "interpreter", ], + tags = [ + "test_migrated_to_hlo_runner_pjrt", + ], deps = [ ":client_library_test_runner_mixin", - ":hlo_test_base", + ":hlo_pjrt_interpreter_reference_mixin", + ":hlo_pjrt_test_base", ":literal_test_util", ":xla_internal_test_main", # fixdeps: keep "//xla:array2d", diff --git a/third_party/xla/xla/tests/cpu_gpu_fusion_test.cc b/third_party/xla/xla/tests/cpu_gpu_fusion_test.cc index 5e41066abf3..5163b9842d8 100644 --- a/third_party/xla/xla/tests/cpu_gpu_fusion_test.cc +++ b/third_party/xla/xla/tests/cpu_gpu_fusion_test.cc @@ -52,7 +52,8 @@ limitations under the License. #include "xla/stream_executor/platform.h" #include "xla/stream_executor/stream_executor_memory_allocator.h" #include "xla/tests/client_library_test_runner_mixin.h" -#include "xla/tests/hlo_test_base.h" +#include "xla/tests/hlo_pjrt_interpreter_reference_mixin.h" +#include "xla/tests/hlo_pjrt_test_base.h" #include "xla/tests/literal_test_util.h" #include "xla/tsl/platform/env.h" #include "xla/tsl/platform/statusor.h" @@ -74,7 +75,8 @@ const float test_float_vals[3][test_width][test_height] = { // Test whether fusion operations are emitted with no errors and compute // accurate outputs. -class CpuGpuFusionTest : public HloTestBase { +class CpuGpuFusionTest + : public HloPjRtInterpreterReferenceMixin { protected: template void TestElementwise2D( @@ -155,7 +157,7 @@ class CpuGpuFusionTest : public HloTestBase { bool ComputeElementwiseAnswerCompare(ComparisonDirection direction, absl::Span xs); DebugOptions GetDebugOptionsForTest() const override { - DebugOptions debug_options = HloTestBase::GetDebugOptionsForTest(); + DebugOptions debug_options = HloPjRtTestBase::GetDebugOptionsForTest(); debug_options.add_xla_disable_hlo_passes("layout-assignment"); return debug_options; } @@ -884,7 +886,8 @@ TEST_F(CpuGpuFusionTest, Clamp2D) { } class FusionClientLibraryTest - : public ClientLibraryTestRunnerMixin {}; + : public ClientLibraryTestRunnerMixin< + HloPjRtInterpreterReferenceMixin> {}; TEST_F(FusionClientLibraryTest, ManyLayoutTransformations) { // On the GPU backend, it's possible to have too many transposes within one