Skip to content

Commit 5e39b89

Browse files
iumitakgunGoogle-ML-Automation
authored andcommitted
[XLA:TPU] BitcastConvert updated for packed preds
PiperOrigin-RevId: 897306203
1 parent c598dd8 commit 5e39b89

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

xla/primitive_util.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ limitations under the License.
1919
#define XLA_PRIMITIVE_UTIL_H_
2020

2121
#include <array>
22+
#include <climits>
2223
#include <cstdint>
2324
#include <limits>
2425
#include <string>
@@ -696,7 +697,7 @@ inline constexpr int PrimitiveTypeBitWidth() {
696697
(IsSignedIntegralType(primitive_type) ? 1 : 0);
697698
}
698699
if constexpr (primitive_type == PRED) {
699-
return std::numeric_limits<NativeT>::digits;
700+
return std::numeric_limits<uint8_t>::digits;
700701
}
701702
if constexpr (IsMXType(primitive_type)) {
702703
return NativeT::kBits;
@@ -770,7 +771,7 @@ inline constexpr int BitWidth(PrimitiveType type) {
770771
// type is not an array type.
771772
inline constexpr int StorageBitWidth(PrimitiveType type) {
772773
if (type == PRED) {
773-
return 8;
774+
return sizeof(bool) * CHAR_BIT;
774775
}
775776
return BitWidth(type);
776777
}

xla/tests/bitcast_convert_test.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,6 @@ ENTRY main {
202202
}
203203

204204
TEST_F(BitcastConvertHloTest, FourPredToF32) {
205-
if (test::DeviceTypeIs({test::kTpu})) {
206-
GTEST_SKIP();
207-
}
208205
absl::string_view hlo_string = R"(
209206
HloModule bitcast_to_smaller
210207
@@ -225,9 +222,6 @@ ENTRY main {
225222
ROOT out = pred[10] bitcast-convert(p)
226223
}
227224
)";
228-
if (test::DeviceTypeIs({test::kTpu})) {
229-
GTEST_SKIP();
230-
}
231225
EXPECT_TRUE(RunAndCompare(hlo_string, ErrorSpec{1e-5, 1e-5}));
232226
}
233227

0 commit comments

Comments
 (0)