Convert absl string_view constants to const, rather than constexpr.

MSVC fails to compile such variables with:
error C2131: expression did not evaluate to a constant

PiperOrigin-RevId: 293408611
Change-Id: Ie42a085fce1540ed2da7739b6875e5f2e4e5411a
This commit is contained in:
Gunhan Gulsoy 2020-02-05 11:12:33 -08:00 committed by TensorFlower Gardener
parent b3eb3455ed
commit 293a2be20b
2 changed files with 16 additions and 16 deletions

View File

@ -208,7 +208,7 @@ TEST_F(CallInlinerTest, CallToOutfeedComputationIsInlined) {
} }
TEST_F(CallInlinerTest, InlineSingleUseCalleesOnly) { TEST_F(CallInlinerTest, InlineSingleUseCalleesOnly) {
constexpr absl::string_view hlo_string = R"( const absl::string_view hlo_string = R"(
HloModule inline_module HloModule inline_module
a { a {

View File

@ -4094,7 +4094,7 @@ ENTRY main {
TEST_P(HloEvaluatorBf16Test, Bitcast) { TEST_P(HloEvaluatorBf16Test, Bitcast) {
// Regression test for b/114735354. // Regression test for b/114735354.
constexpr absl::string_view hlo_text_base = R"( const absl::string_view hlo_text_base = R"(
HloModule Bitcast HloModule Bitcast
ENTRY main { ENTRY main {
@ -4121,7 +4121,7 @@ ENTRY main {
// Check that s32 under/overflow doesn't trigger a ubsan failure. // Check that s32 under/overflow doesn't trigger a ubsan failure.
TEST_F(HloEvaluatorTest, Int32Overflow) { TEST_F(HloEvaluatorTest, Int32Overflow) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule Test HloModule Test
ENTRY main { ENTRY main {
@ -4150,7 +4150,7 @@ ENTRY main {
} }
TEST_F(HloEvaluatorTest, GetDimensionSize) { TEST_F(HloEvaluatorTest, GetDimensionSize) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule Test HloModule Test
ENTRY main { ENTRY main {
@ -4184,7 +4184,7 @@ ENTRY main {
// Check that we get a useful error if we pass inputs of the wrong shape. // Check that we get a useful error if we pass inputs of the wrong shape.
TEST_F(HloEvaluatorTest, EvaluateWithWrongInputShapes) { TEST_F(HloEvaluatorTest, EvaluateWithWrongInputShapes) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule Test HloModule Test
ENTRY main { ENTRY main {
@ -4211,7 +4211,7 @@ ENTRY main {
// Check that we get a useful error if we pass too many or too few inputs. // Check that we get a useful error if we pass too many or too few inputs.
TEST_F(HloEvaluatorTest, EvaluateWithWrongNumberOfInputs) { TEST_F(HloEvaluatorTest, EvaluateWithWrongNumberOfInputs) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule Test HloModule Test
ENTRY main { ENTRY main {
@ -4233,7 +4233,7 @@ ENTRY main {
} }
TEST_F(HloEvaluatorTest, PreserveFusionInputLayout) { TEST_F(HloEvaluatorTest, PreserveFusionInputLayout) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule FusionInputLayout HloModule FusionInputLayout
fused_computation { fused_computation {
@ -4255,7 +4255,7 @@ TEST_F(HloEvaluatorTest, PreserveFusionInputLayout) {
} }
TEST_F(HloEvaluatorTest, PreserveFusionOutputLayout) { TEST_F(HloEvaluatorTest, PreserveFusionOutputLayout) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule FusionOutputLayout HloModule FusionOutputLayout
fused_computation { fused_computation {
@ -4276,7 +4276,7 @@ TEST_F(HloEvaluatorTest, PreserveFusionOutputLayout) {
} }
TEST_F(HloEvaluatorTest, PreserveMOFusionOutputLayout) { TEST_F(HloEvaluatorTest, PreserveMOFusionOutputLayout) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule MOFusionOutputLayout HloModule MOFusionOutputLayout
fused_computation { fused_computation {
@ -4301,7 +4301,7 @@ TEST_F(HloEvaluatorTest, PreserveMOFusionOutputLayout) {
// Tests that custom_calls fail to evaluate when no handler is specified. // Tests that custom_calls fail to evaluate when no handler is specified.
TEST_F(HloEvaluatorTest, EvaluateCustomCall_NoHandler) { TEST_F(HloEvaluatorTest, EvaluateCustomCall_NoHandler) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule EvaluateCustomCall_NoHandler HloModule EvaluateCustomCall_NoHandler
ENTRY kernel_entry { ENTRY kernel_entry {
parameter.0 = u32[2,2]{1,0} parameter(0) parameter.0 = u32[2,2]{1,0} parameter(0)
@ -4318,7 +4318,7 @@ TEST_F(HloEvaluatorTest, EvaluateCustomCall_NoHandler) {
// Tests when a custom_call handler returns an error. // Tests when a custom_call handler returns an error.
TEST_F(HloEvaluatorTest, EvaluateCustomCall_HandlerError) { TEST_F(HloEvaluatorTest, EvaluateCustomCall_HandlerError) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule EvaluateCustomCall_HandlerError HloModule EvaluateCustomCall_HandlerError
ENTRY kernel_entry { ENTRY kernel_entry {
parameter.0 = u32[2,2]{1,0} parameter(0) parameter.0 = u32[2,2]{1,0} parameter(0)
@ -4342,7 +4342,7 @@ TEST_F(HloEvaluatorTest, EvaluateCustomCall_HandlerError) {
// We sum the operands so that we can verify the operand and output literals // We sum the operands so that we can verify the operand and output literals
// are properly mapped for access. // are properly mapped for access.
TEST_F(HloEvaluatorTest, EvaluateCustomCall_ManyInputs) { TEST_F(HloEvaluatorTest, EvaluateCustomCall_ManyInputs) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule EvaluateCustomCall_ManyInputs HloModule EvaluateCustomCall_ManyInputs
ENTRY kernel_entry { ENTRY kernel_entry {
parameter.0 = u32[1]{0} parameter(0) parameter.0 = u32[1]{0} parameter(0)
@ -4378,7 +4378,7 @@ TEST_F(HloEvaluatorTest, EvaluateCustomCall_ManyInputs) {
} }
TEST_F(HloEvaluatorTest, IsFiniteF16) { TEST_F(HloEvaluatorTest, IsFiniteF16) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule test HloModule test
ENTRY IsFiniteTest { ENTRY IsFiniteTest {
@ -4395,7 +4395,7 @@ TEST_F(HloEvaluatorTest, IsFiniteF16) {
} }
TEST_F(HloEvaluatorTest, IsFiniteBf16) { TEST_F(HloEvaluatorTest, IsFiniteBf16) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule test HloModule test
ENTRY IsFiniteTest { ENTRY IsFiniteTest {
@ -4414,7 +4414,7 @@ TEST_F(HloEvaluatorTest, IsFiniteBf16) {
// Check that evaluating `f32[<huge>, 0] iota` doesn't oom (it's an empty // Check that evaluating `f32[<huge>, 0] iota` doesn't oom (it's an empty
// array!). // array!).
TEST_F(HloEvaluatorTest, ZeroSizedIotaWithHugeDimension) { TEST_F(HloEvaluatorTest, ZeroSizedIotaWithHugeDimension) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule test HloModule test
ENTRY t { ENTRY t {
ROOT i = f32[1000000000000, 0] iota(), iota_dimension=0 ROOT i = f32[1000000000000, 0] iota(), iota_dimension=0
@ -4427,7 +4427,7 @@ TEST_F(HloEvaluatorTest, ZeroSizedIotaWithHugeDimension) {
} }
TEST_F(HloEvaluatorTest, CopyStartCopyDone) { TEST_F(HloEvaluatorTest, CopyStartCopyDone) {
constexpr absl::string_view hlo_text = R"( const absl::string_view hlo_text = R"(
HloModule test HloModule test
ENTRY CopyStartCopyDone { ENTRY CopyStartCopyDone {
init = f32[] constant(42.0) init = f32[] constant(42.0)