Skip to content

Commit

Permalink
[Mosaic][apply_vector_layout][NFC] Use LLVM_UNLIKELY in `TPU_ASSERT…
Browse files Browse the repository at this point in the history
…_*` macros

PiperOrigin-RevId: 609805325
  • Loading branch information
tlongeri authored and jax authors committed Feb 23, 2024
1 parent 3a69b80 commit 8a43140
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jaxlib/mosaic/dialect/tpu/transforms/apply_vector_layout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "llvm/ADT/SmallVectorExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
Expand Down Expand Up @@ -80,11 +81,11 @@ namespace mlir::tpu {
// because it's easier to debug from Python (particularly from OSS where symbols
// are removed)
#define TPU_ASSERT_IMPL(stream, cond) \
if (!(cond)) { \
if (LLVM_UNLIKELY(!(cond))) { \
(stream) << "Internal error: assert failed: " #cond; \
}
#define TPU_ASSERT_CMP_IMPL(stream, lhs, rhs, cmp) \
if (!((lhs)cmp(rhs))) { \
if (LLVM_UNLIKELY(!((lhs)cmp(rhs)))) { \
(stream) << "Internal error: assert failed: " #lhs " " #cmp " " #rhs " (" \
<< (lhs) << " vs. " << (rhs) << ")"; \
return failure(); \
Expand Down

0 comments on commit 8a43140

Please sign in to comment.