Skip to content

Commit e963111

Browse files
jaro-sevciktensorflower-gardener
authored andcommitted
PR #8919: Turn the HLO verifier always on around float normalization on GPU
Imported from GitHub PR openxla/xla#8919 Currently, the GPU pipeline only turns the verifier around float normalization on only in debug. If float normalization generates ill-typed IR, the compiler can produce invalid code without anything failing. This patch turns the verification always on. Copybara import of the project: -- 8606a6b140091a099c541e1d48f6f685828c58d8 by Jaroslav Sevcik <jsevcik@nvidia.com>: Turn the HLO $verifier always on around float normalization on GPU -- e3dc564b580f5fa3e0663a87326451d0fab3db1c by Jaroslav Sevcik <jsevcik@nvidia.com>: Run verifier only once -- 13f4f25deb24250ed71775b514fad4de3071e2b8 by Jaroslav Sevcik <jsevcik@nvidia.com>: Add a context string to the verifier pass -- c97786e4024aa97062f0c48c117168d48360e318 by Jaroslav Sevcik <jsevcik@nvidia.com>: Only verify in non-debug builds Merging this change closes #8919 PiperOrigin-RevId: 605295966
1 parent aecc494 commit e963111

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

third_party/xla/xla/service/gpu/gpu_compiler.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,6 +1399,21 @@ absl::Status GpuCompiler::OptimizeHloPostLayoutAssignment(
13991399
pipeline.AddPass<HloCSE>(/*is_layout_sensitive=*/true,
14001400
/*only_fusion_computations=*/false,
14011401
/*ignore_control_dependencies=*/true);
1402+
1403+
#ifdef NDEBUG
1404+
// Verify the module in non-debug builds. For debug builds, the verifier
1405+
// already runs after every pass.
1406+
pipeline.AddPass<HloVerifier>(
1407+
std::make_unique<DefaultVerifierMetadata>(
1408+
HloVerifierOpts{}
1409+
.MakeLayoutSensitive()
1410+
.WithInstructionCanChangeLayout(
1411+
LayoutAssignment::InstructionCanChangeLayout)
1412+
.VerifyBroadcastDimensionsOrder()
1413+
.VerifyReshapeIsBitcast()),
1414+
"end-of-post-layout_assignment");
1415+
#endif // NDEBUG
1416+
14021417
TF_RETURN_IF_ERROR(pipeline.Run(hlo_module).status());
14031418

14041419
return absl::OkStatus();

0 commit comments

Comments
 (0)