Skip to content

Failure on Interpreter: dynamic_dimension_inference.cc:1962 operand_shape.IsTuple() Only tuple typed inputs can have dynamic dimension… #47390

Description

@cxxhou

Running the attached StableHLO module aborts run_hlo_module on Interpreter through an internal XLA check. Failure signature: dynamic_dimension_inference.cc:1962 operand_shape.IsTuple() Only tuple typed inputs can have dynamic dimension…. The same module runs successfully on CPU.

The following backends fail without a crash signal:

  • run_hlo_module on Interpreter (HLO proto input) — failed (rc=255)

The same module runs successfully on:

  • run_hlo_module on CPU (StableHLO input)
  • run_hlo_module on GPU (StableHLO input)
  • run_hlo_module on CPU (HLO proto input)
  • run_hlo_module on GPU (HLO proto input)

The module also compiles cleanly on:

  • hlo_runner_main on CPU (HLO proto input, compile-only via --run=false)
  • hlo_runner_main on GPU (HLO proto input, compile-only via --run=false)

The StableHLO→HLO-proto conversion:

  • hlo-translate — succeeds

Command:

hlo-translate \
  --mlir-to-hlo \
  --emit-proto \
  4385dedf54d6caf5.mlir \
  -o \
  4385dedf54d6caf5.hlo
sed -i '1{/^goo\.gle\//d}' 4385dedf54d6caf5.hlo

Environment

  • CPU: Intel(R) Core(TM) i9-14900HX
  • GPU: NVIDIA GeForce RTX 4060 Laptop GPU
  • CUDA Driver: 580.126.09
  • XLA commit: 6f1f2d916dcef0428bfa7ea66765be539126c4f2
  • StableHLO commit: e6f81ebd06b3509f2c7fa6175430aadbd4d724ca

IR

module {
  func.func @main(%arg0: tensor<5xf32>, %arg1: tensor<5xf32>, %arg2: tensor<5xf32>, %arg3: tensor<3x2xi32>) -> (tensor<5xf32>, tensor<2xi32>) {
    %0 = stablehlo.add %arg0, %arg1 : tensor<5xf32>
    %1 = stablehlo.multiply %0, %arg2 : tensor<5xf32>
    %2 = stablehlo.subtract %1, %0 : tensor<5xf32>
    %3 = stablehlo.multiply %2, %1 : tensor<5xf32>
    %4 = call @wrapped_157(%arg3) : (tensor<3x2xi32>) -> tensor<2xi32>
    return %3, %4 : tensor<5xf32>, tensor<2xi32>
  }
  func.func private @wrapped_157(%arg0: tensor<3x2xi32>) -> tensor<2xi32> {
    %c = stablehlo.constant dense<false> : tensor<i1>
    %c_0 = stablehlo.constant dense<2> : tensor<i32>
    %0 = stablehlo.set_dimension_size %arg0, %c_0, dim = 0 : (tensor<3x2xi32>, tensor<i32>) -> tensor<?x2xi32, #stablehlo.bounds<3, ?>>
    %1:2 = "stablehlo.if"(%c) ({
      %3 = stablehlo.add %0, %0 : tensor<?x2xi32, #stablehlo.bounds<3, ?>>
      stablehlo.return %3, %3 : tensor<?x2xi32, #stablehlo.bounds<3, ?>>, tensor<?x2xi32, #stablehlo.bounds<3, ?>>
    }, {
      %3 = stablehlo.add %0, %0 : tensor<?x2xi32, #stablehlo.bounds<3, ?>>
      stablehlo.return %3, %3 : tensor<?x2xi32, #stablehlo.bounds<3, ?>>, tensor<?x2xi32, #stablehlo.bounds<3, ?>>
    }) : (tensor<i1>) -> (tensor<?x2xi32, #stablehlo.bounds<3, ?>>, tensor<?x2xi32, #stablehlo.bounds<3, ?>>)
    %c_1 = stablehlo.constant dense<0> : tensor<i32>
    %2 = stablehlo.reduce(%1#1 init: %c_1) applies stablehlo.add across dimensions = [0] : (tensor<?x2xi32, #stablehlo.bounds<3, ?>>, tensor<i32>) -> tensor<2xi32>
    return %2 : tensor<2xi32>
  }
  func.func private @true_branch_157(%arg0: tensor<?x2xi32, #stablehlo.bounds<3, ?>>) -> (tensor<?x2xi32, #stablehlo.bounds<3, ?>>, tensor<?x2xi32, #stablehlo.bounds<3, ?>>) {
    %0 = stablehlo.add %arg0, %arg0 : tensor<?x2xi32, #stablehlo.bounds<3, ?>>
    return %0, %0 : tensor<?x2xi32, #stablehlo.bounds<3, ?>>, tensor<?x2xi32, #stablehlo.bounds<3, ?>>
  }
  func.func private @false_branch_157(%arg0: tensor<?x2xi32, #stablehlo.bounds<3, ?>>) -> (tensor<?x2xi32, #stablehlo.bounds<3, ?>>, tensor<?x2xi32, #stablehlo.bounds<3, ?>>) {
    %0 = stablehlo.add %arg0, %arg0 : tensor<?x2xi32, #stablehlo.bounds<3, ?>>
    return %0, %0 : tensor<?x2xi32, #stablehlo.bounds<3, ?>>, tensor<?x2xi32, #stablehlo.bounds<3, ?>>
  }
  func.func private @update_s32_157(%arg0: tensor<i32>, %arg1: tensor<i32>) -> tensor<i32> {
    %0 = stablehlo.add %arg0, %arg1 : tensor<i32>
    return %0 : tensor<i32>
  }
}

Reproduction (Interpreter (StableHLO input) — failed (rc=255))

Command:

export XLA_FLAGS='--xla_backend_extra_options=xla_cpu_use_multi_output_fusion --xla_enable_enzyme_comms_opt=true --xla_gpu_async_dot=true --xla_gpu_enable_cudnn_layer_norm=true --xla_gpu_enable_dus_accumulator_zero_init_elimination=true --xla_gpu_enable_latency_hiding_scheduler=true --xla_gpu_enable_scatter_determinism_expander=true --xla_gpu_experimental_stream_annotation=true --xla_gpu_experimental_use_ragged_dot_fusion --xla_gpu_gemm_rewrite_size_threshold=0 --xla_gpu_multi_streamed_windowed_einsum=true --xla_recognize_reduction_optimization_level=1 --xla_reduce_window_rewrite_base_length=1'
run_hlo_module \
  --platform=Interpreter \
  --reference_platform= \
  --input_format=stablehlo \
  4385dedf54d6caf5.mlir

Output:


 ** Running 4385dedf54d6caf5.mlir**
Running HLO module with runner HloRunner...
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1786848417.278327 3828318 status_macros.cc:58] INTERNAL: RET_CHECK failure (xla/service/dynamic_dimension_inference.cc:1962) operand_shape.IsTuple() Only tuple typed inputs can have dynamic dimension. Please file a bug against XLA team.
*** Begin stack trace ***


























	__libc_start_main

*** End stack trace ***

... compiled and ran in 0.000665344s.
INTERNAL: RET_CHECK failure (xla/service/dynamic_dimension_inference.cc:1962) operand_shape.IsTuple() Only tuple typed inputs can have dynamic dimension. Please file a bug against XLA team.


Suspected Python Code Location:
  -:14
	Failed to execute on HloRunner [xla::PythonStackTrace='']

Reference run (CPU (StableHLO input) — succeeds)

Command:

export XLA_FLAGS='--xla_backend_extra_options=xla_cpu_use_multi_output_fusion --xla_enable_enzyme_comms_opt=true --xla_gpu_async_dot=true --xla_gpu_enable_cudnn_layer_norm=true --xla_gpu_enable_dus_accumulator_zero_init_elimination=true --xla_gpu_enable_latency_hiding_scheduler=true --xla_gpu_enable_scatter_determinism_expander=true --xla_gpu_experimental_stream_annotation=true --xla_gpu_experimental_use_ragged_dot_fusion --xla_gpu_gemm_rewrite_size_threshold=0 --xla_gpu_multi_streamed_windowed_einsum=true --xla_recognize_reduction_optimization_level=1 --xla_reduce_window_rewrite_base_length=1'
run_hlo_module \
  --platform=CPU \
  --reference_platform= \
  --input_format=stablehlo \
  4385dedf54d6caf5.mlir

Output:


 ** Running 4385dedf54d6caf5.mlir**
Running HLO module with runner HloRunner...
... compiled and ran in 0.0283194s.
Skipping reference runner

Contact

  • Email: ch395@njit.edu, zhihao.yao@njit.edu, benquike@gmail.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions