Skip to content

Conversation

@newling
Copy link
Contributor

@newling newling commented Oct 8, 2025

Compilation:

iree-compile --output-format=vm-bytecode --mlir-print-op-on-diagnostic=false e2e/regression/scalar_computation.mlir

Assertion failure:

llvm::dyn_cast(From &) [To = mlir::iree_compiler::IREE::HAL::DeviceOptimalAttr, From = mlir::iree_compiler::IREE::Stream::AffinityAttr]: Assertion `detail::isPresent(Val) && "dyn_cast on a non-existent value"' failed

For some reason this is only after an LLVM bump + 2 other fixes (see #22234).

Signed-off-by: James Newling <[email protected]>
@newling newling marked this pull request as ready for review October 8, 2025 14:55
@newling newling requested a review from benvanik as a code owner October 8, 2025 14:55
@benvanik
Copy link
Collaborator

benvanik commented Oct 8, 2025

Odd - do you have IR for this or what was failing? It should never be legal to get to StreamToHAL with null affinities on ops that require them at that phase and I want to make sure we don't have a regression above it.

@newling
Copy link
Contributor Author

newling commented Oct 8, 2025

Actually I'm seeing the assert error on main.

Input IR: https://github.com/iree-org/iree/blob/main/tests/e2e/regression/scalar_computation.mlir

Final IR before crash is below.

@benvanik note, I'm not passing a device to iree-compile.

// -----// IR Dump Before ConvertToHALPass (iree-hal-conversion) //----- //
module {
  util.func public @simpleDAG() attributes {iree.abi.stub, iree.reflection = {iree.abi.declaration = "sync func @simpleDAG() -> ()"}} {
    util.call @_simpleDAG() : () -> ()
    util.return
  }
  util.func private @_simpleDAG() {
    %c0 = arith.constant 0 : index
    %c1091567616_i32 = arith.constant 1091567616 : i32
    %c4 = arith.constant 4 : index
    %c1077936128_i32 = arith.constant 1077936128 : i32
    %result, %result_timepoint = stream.resource.alloca uninitialized : !stream.resource<external>{%c4} => !stream.timepoint
    %0 = stream.cmd.execute await(%result_timepoint) => with(%result as %arg0: !stream.resource<external>{%c4}) {
      stream.cmd.fill %c1077936128_i32, %arg0[%c0 for %c4] : i32 -> !stream.resource<external>{%c4}
    } => !stream.timepoint
    %1 = stream.timepoint.await %0 => %result : !stream.resource<external>{%c4}
    %2 = stream.tensor.export %1 : tensor<f32> in !stream.resource<external>{%c4} -> tensor<f32>
    check.expect_almost_eq(%2, %2) : tensor<f32>
    %result_0, %result_timepoint_1 = stream.resource.alloca uninitialized : !stream.resource<external>{%c4} => !stream.timepoint
    %3 = stream.cmd.execute await(%result_timepoint_1) => with(%result_0 as %arg0: !stream.resource<external>{%c4}) {
      stream.cmd.fill %c1091567616_i32, %arg0[%c0 for %c4] : i32 -> !stream.resource<external>{%c4}
    } => !stream.timepoint
    %4 = stream.timepoint.await %3 => %result_0 : !stream.resource<external>{%c4}
    %5 = stream.tensor.export %4 : tensor<f32> in !stream.resource<external>{%c4} -> tensor<f32>
    check.expect_almost_eq(%5, %5) : tensor<f32>
    util.return
  }
  util.func public @simpleHorizontal() attributes {iree.abi.stub, iree.reflection = {iree.abi.declaration = "sync func @simpleHorizontal() -> ()"}} {
    util.call @_simpleHorizontal() : () -> ()
    util.return
  }
  util.func private @_simpleHorizontal() {
    %c0 = arith.constant 0 : index
    %c1090519040_i32 = arith.constant 1090519040 : i32
    %c4 = arith.constant 4 : index
    %c1091567616_i32 = arith.constant 1091567616 : i32
    %result, %result_timepoint = stream.resource.alloca uninitialized : !stream.resource<external>{%c4} => !stream.timepoint
    %0 = stream.cmd.execute await(%result_timepoint) => with(%result as %arg0: !stream.resource<external>{%c4}) {
      stream.cmd.fill %c1091567616_i32, %arg0[%c0 for %c4] : i32 -> !stream.resource<external>{%c4}
    } => !stream.timepoint
    %1 = stream.timepoint.await %0 => %result : !stream.resource<external>{%c4}
    %2 = stream.tensor.export %1 : tensor<f32> in !stream.resource<external>{%c4} -> tensor<f32>
    check.expect_almost_eq(%2, %2) : tensor<f32>
    %result_0, %result_timepoint_1 = stream.resource.alloca uninitialized : !stream.resource<external>{%c4} => !stream.timepoint
    %3 = stream.cmd.execute await(%result_timepoint_1) => with(%result_0 as %arg0: !stream.resource<external>{%c4}) {
      stream.cmd.fill %c1090519040_i32, %arg0[%c0 for %c4] : i32 -> !stream.resource<external>{%c4}
    } => !stream.timepoint
    %4 = stream.timepoint.await %3 => %result_0 : !stream.resource<external>{%c4}
    %5 = stream.tensor.export %4 : tensor<f32> in !stream.resource<external>{%c4} -> tensor<f32>
    check.expect_almost_eq(%5, %5) : tensor<f32>
    util.return
  }
}

@newling
Copy link
Contributor Author

newling commented Oct 8, 2025

I'm pretty sure the compile command I've put above is the one I saw printed in the CI log, but I can't find that log anymore as I've pushed an update to the PR where I saw it

newling added a commit that referenced this pull request Oct 9, 2025
Carries same 2 reverts as previous integrates
#22200 and
#22214

Change in IREE for change some TOSA pass logic:
llvm/llvm-project#153771
Change in IREE for deprecated LLVM Triple API:
llvm/llvm-project#162186
Currently includes patch #22241
which is a pure IREE fix
Increases golden times for 2 models (<5%): `assert 10.864054075338773 <=
10.5`

Noticed this potential flake on windows at some point: lit test
ksplitmatmul_basic

Follow-up: understand #22241 (why can we not just assert it is not null?)

---------

Signed-off-by: James Newling <[email protected]>
@newling
Copy link
Contributor Author

newling commented Oct 9, 2025

Closing, preference is for #22244

@newling newling closed this Oct 9, 2025
weidel-p pushed a commit to weidel-p/iree that referenced this pull request Oct 21, 2025
Carries same 2 reverts as previous integrates
iree-org#22200 and
iree-org#22214

Change in IREE for change some TOSA pass logic:
llvm/llvm-project#153771
Change in IREE for deprecated LLVM Triple API:
llvm/llvm-project#162186
Currently includes patch iree-org#22241
which is a pure IREE fix
Increases golden times for 2 models (<5%): `assert 10.864054075338773 <=
10.5`

Noticed this potential flake on windows at some point: lit test
ksplitmatmul_basic

Follow-up: understand iree-org#22241 (why can we not just assert it is not null?)

---------

Signed-off-by: James Newling <[email protected]>
Signed-off-by: Philipp <[email protected]>
mischirmer pushed a commit to mischirmer/iree that referenced this pull request Nov 24, 2025
Carries same 2 reverts as previous integrates
iree-org/iree#22200 and
iree-org/iree#22214

Change in IREE for change some TOSA pass logic:
llvm/llvm-project#153771
Change in IREE for deprecated LLVM Triple API:
llvm/llvm-project#162186
Currently includes patch iree-org/iree#22241
which is a pure IREE fix
Increases golden times for 2 models (<5%): `assert 10.864054075338773 <=
10.5`

Noticed this potential flake on windows at some point: lit test
ksplitmatmul_basic

Follow-up: understand iree-org/iree#22241 (why can we not just assert it is not null?)

---------

Signed-off-by: James Newling <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants