Merge pull request #36386 from ROCmSoftwarePlatform:google-upstream-pr-gpu_unrolling_test

PiperOrigin-RevId: 292641827
Change-Id: I6e5f6c4030de2a6b7566f7837cc97d8639378fe5
This commit is contained in:
TensorFlower Gardener 2020-01-31 16:48:44 -08:00
commit 0989420102

View File

@ -154,12 +154,21 @@ TEST_F(GpuUnrollingTest, DisabledUnrollUnfusedSine) {
auto hlo_module = auto hlo_module =
ParseAndReturnVerifiedModule(kUnfusedAddModule, config).ValueOrDie(); ParseAndReturnVerifiedModule(kUnfusedAddModule, config).ValueOrDie();
CompileAndVerifyIr(std::move(hlo_module), // Note: On ROCm side, we do bare minimal to make the test pass.
R"( // "sine" function is in different code generation path from nvptx: on
// ROCm platform, it get pulled in from ROCm-Device-Libs, whereas in
// Cuda, generated llvm IR is compiled PTX.
auto expected_ir = is_built_with_rocm_ ? R"(
; CHECK: __ocml_sin_f32
; CHECK-NOT: load float
)"
: R"(
; CHECK: load float ; CHECK: load float
; CHECK-NOT: load float ; CHECK-NOT: load float
} }
)", )";
CompileAndVerifyIr(std::move(hlo_module), expected_ir,
/*match_optimized_ir=*/true); /*match_optimized_ir=*/true);
} }
@ -179,12 +188,21 @@ TEST_F(GpuUnrollingTest, DisabledUnrollUnfusedCosine) {
auto hlo_module = auto hlo_module =
ParseAndReturnVerifiedModule(kUnfusedAddModule, config).ValueOrDie(); ParseAndReturnVerifiedModule(kUnfusedAddModule, config).ValueOrDie();
CompileAndVerifyIr(std::move(hlo_module), // Note: On ROCm side, we do bare minimal to make the test pass.
R"( // "cosine" function is in different code generation path from nvptx: on
// ROCm platform, it get pulled in from ROCm-Device-Libs, whereas in
// Cuda, generated llvm IR is compiled PTX.
auto expected_ir = is_built_with_rocm_ ? R"(
; CHECK: __ocml_cos_f32
; CHECK-NOT: load float
)"
: R"(
; CHECK: load float ; CHECK: load float
; CHECK-NOT: load float ; CHECK-NOT: load float
} }
)", )";
CompileAndVerifyIr(std::move(hlo_module), expected_ir,
/*match_optimized_ir=*/true); /*match_optimized_ir=*/true);
} }