float_normalization_test.cc
Google Test frameworkimports tsl/platform/statusor.h
SHA-256ee5470150d32cf6bcff8f6f6d49498c48d354dda8bea592c603ee707329a9207
MaleculeMd₂(In₂Pa)
Evidence
1/* Copyright 2018 The OpenXLA Authors.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is …
11:42… IND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14==============================================================================*/
15
16#include "xla/hlo/transforms/simplifiers/float_normalization.h"
17
18#include <cstdint>
19#include <memory>
20#include <optional>
21#include <string>
22#include <vector>
23
24#include <gtest/gtest.h>
25#include "absl/status/statusor.h"
26#include "absl/strings/string_view.h"
27#include "xla/hlo/ir/hlo_computation.h"
28#include "xla/hlo/ir/hlo_input_output_alias_config.h"
29#include "xla/hlo/ir/hlo_instruction.h"
30#include "xla/hlo/ir/hlo_module.h"
31#include "xla/hlo/ir/hlo_opcode.h"
32#include "xla/hlo/testlib/hlo_hardware_independent_test_base.h"
33#include "xla/hlo/testlib/pattern_matcher_gmock.h"
34#include "xla/hlo/testlib/test.h"
35#include "xla/hlo/testlib/test_helpers.h"
36#include "xla/service/float_support.h"
37#include "xla/service/hlo_creation_utils.h"
38#include "xla/service/hlo_verifier.h"
39#include "xla/service/pattern_matcher.h"
40#include "xla/shape.h"
41#include "xla/shape_util.h"
42#include "xla/tsl/platform/statusor.h"
43#include "xla/xla_data.pb.h"
44#include "tsl/platform/statusor.h"
45
46namespace xla {
⋯6 lines
156:14… F8E5M2, F8E5M2FNUZ, F8E8M0FNU));
157
158TEST_F(FloatNormalizationTest, NoopIfSupported) {
159 auto builder = HloComputation::Builder(TestName());
160 Shape f32_shape = ShapeUtil: …
177:49… (builder.Build());
178
179 EXPECT_FALSE(Normalize(module.get()));
180
181 EXPECT_EQ(computation->root_instruction(), add1);
182 EXPECT_EQ(add0->shape().element_type(), BF16);
183 EXPECT_EQ(add1->shape().element_type …
205:7… computation = module->AddEntryComputation(builder.Build());
206
207 EXPECT_TRUE(Normalize(module.get()));
208
209 EXPECT_EQ(computation->root_instruction()->opcode(), HloOpcode::kConvert);
210 EXPECT_EQ(computation …