E8010

E8010 — An mlir! block whose dialects list does not match its body: the body uses an operation of a dialect that the list does not name, or the list names something that is not a dialect. The list is what the block says it uses, so it must be right.

What the compiler reports

E8010{{.*}}vx:[[@LINE+1]]:{{.*}}uses `%r = math.ctpop %a : i32`, but its `dialects` list does not name `math`

The fragments the test suite holds the compiler to. An ellipsis marks text the test does not constrain; the emitted message also carries a source location.

A program that triggers it

//
// Part of the Vx Project, under the Apache License v2.0 with LLVM Exceptions.
// See LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//
// The `dialects` list of an `mlir!` block names the dialects that its operations come from, and
// only real dialects. This program used to compile and print 824.

// The block uses `math.ctpop`, but its list names only `linalg`.
fn count_ones(x : i32) -> i32 {
  return mlir!(inputs : (%a = x : i32), returns : i32, dialects : ["linalg"]) {
    %r = math.ctpop %a : i32
    macro.yield %r : i32
  };
}

// The list names a dialect that does not exist, and not `math`.
fn count_zeros(x : i32) -> i32 {
  return mlir!(inputs : (%a = x : i32), returns : i32, dialects : ["no_such_dialect"]) {
    %r = math.ctlz %a : i32
    macro.yield %r : i32
  };
}

fn main() -> i32 {
  print(count_ones(255));
  print(count_zeros(255));
  return 0;
}

From tests/frontend/fail/mlir_block_uses_only_the_dialects_it_names.vx, which asserts this diagnostic on every commit.

Related