[Mlir-commits] [llvm] [mlir] [mlir] Add InferUniformityOpInterface (PR #220825)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Sep 3 03:05:26 PDT 2026


================
@@ -0,0 +1,120 @@
+//===- InferUniformityOpInterface.h - Uniformity ----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains the definitions of the uniformity inference interface
+// defined in `InferUniformityOpInterface.td`, and the lattice value it works
+// with.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_INTERFACES_INFERUNIFORMITYOPINTERFACE_H
+#define MLIR_INTERFACES_INFERUNIFORMITYOPINTERFACE_H
+
+#include "mlir/IR/OpDefinition.h"
+#include "llvm/ADT/ArrayRef.h"
+#include <optional>
+
+namespace mlir {
+
+/// The widest group of threads of a SIMT launch within which an SSA value is
+/// known to be the same for every thread, from the narrowest to the widest.
+///
+/// The groups nest: a thread belongs to a subgroup (warp, wave), a subgroup to
+/// a workgroup (thread block), a workgroup to a cluster, and every cluster to
+/// the launch. A value that is the same within a group is also the same within
+/// every narrower group, so the scopes are totally ordered and the meet of two
+/// scopes is the narrower one.
+enum class UniformityScope : uint8_t {
+  /// Two threads of the same subgroup may observe different values.
+  Divergent = 0,
+  /// The same for every thread of a subgroup.
+  Subgroup,
+  /// The same for every thread of a workgroup.
+  Workgroup,
+  /// The same for every thread of a cluster of workgroups.
+  Cluster,
+  /// The same for every thread of the launch.
+  Uniform,
+};
----------------
PragmaTwice wrote:

Should this interface be put into `mlir/Interfaces` or somewhere like `Dialect/GPU/Interfaces`? To me it seems coupled with GPU terms (e.g. "subgroup", "cluster" here).

https://github.com/llvm/llvm-project/pull/220825


More information about the Mlir-commits mailing list