[XeGPU] Move targetinfo constants to their own header file

This breaks the dependency from Dialect to Utils, which would be cyclic.
This commit is contained in:
Benjamin Kramer
2025-06-26 13:51:57 +02:00
parent b77114b723
commit 3287c1c176
6 changed files with 37 additions and 23 deletions

View File

@@ -0,0 +1,30 @@
//===- XeGPUTargetInfo.h - Target constants ---------------------*- 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
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_DIALECT_XEGPU_IR_XEGPUTARGETINFO_H_
#define MLIR_DIALECT_XEGPU_IR_XEGPUTARGETINFO_H_
namespace mlir {
namespace xegpu {
/// HW dependent constants.
/// TODO: These constants should be queried from the target information.
namespace targetinfo {
constexpr unsigned subgroupSize = 16; // How many lanes in a subgroup.
/// If DPAS A or B operands have low precision element types they must be packed
/// according to the following sizes.
constexpr unsigned packedSizeInBitsForDefault =
16; // Minimum packing size per register for DPAS A.
constexpr unsigned packedSizeInBitsForDpasB =
32; // Minimum packing size per register for DPAS B.
constexpr unsigned packedSizeInBitsForGatherScatter =
32; // Minimum packing size per register for Gather and Scatter ops.
} // namespace targetinfo
} // namespace xegpu
} // namespace mlir
#endif // MLIR_DIALECT_XEGPU_IR_XEGPUTARGETINFO_H_

View File

@@ -24,22 +24,6 @@ class LayoutAttr;
class TensorDescType;
} // namespace xegpu
namespace xegpu {
/// HW dependent constants.
/// TODO: These constants should be queried from the target information.
namespace targetinfo {
constexpr unsigned subgroupSize = 16; // How many lanes in a subgroup.
/// If DPAS A or B operands have low precision element types they must be packed
/// according to the following sizes.
constexpr unsigned packedSizeInBitsForDefault =
16; // Minimum packing size per register for DPAS A.
constexpr unsigned packedSizeInBitsForDpasB =
32; // Minimum packing size per register for DPAS B.
constexpr unsigned packedSizeInBitsForGatherScatter =
32; // Minimum packing size per register for Gather and Scatter ops.
} // namespace targetinfo
} // namespace xegpu
namespace xegpu {
/// Flatten a set of ValueRange into a single SmallVector<Value>

View File

@@ -8,7 +8,7 @@
#include "mlir/Dialect/Utils/IndexingUtils.h"
#include "mlir/Dialect/XeGPU/IR/XeGPU.h"
#include "mlir/Dialect/XeGPU/Utils/XeGPUUtils.h"
#include "mlir/Dialect/XeGPU/IR/XeGPUTargetInfo.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/DialectImplementation.h"
#include "llvm/ADT/TypeSwitch.h"

View File

@@ -15,6 +15,7 @@
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/XeGPU/IR/XeGPU.h"
#include "mlir/Dialect/XeGPU/IR/XeGPUTargetInfo.h"
#include "mlir/Dialect/XeGPU/Transforms/Passes.h"
#include "mlir/Dialect/XeGPU/Utils/XeGPUUtils.h"
#include "mlir/IR/Attributes.h"

View File

@@ -11,6 +11,7 @@
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/Vector/Transforms/VectorDistribution.h"
#include "mlir/Dialect/XeGPU/IR/XeGPU.h"
#include "mlir/Dialect/XeGPU/IR/XeGPUTargetInfo.h"
#include "mlir/Dialect/XeGPU/Transforms/Passes.h"
#include "mlir/Dialect/XeGPU/Transforms/Transforms.h"
#include "mlir/Dialect/XeGPU/Utils/XeGPUUtils.h"

View File

@@ -3519,11 +3519,8 @@ gentbl_cc_library(
cc_library(
name = "XeGPUDialect",
srcs = [
"lib/Dialect/XeGPU/IR/XeGPUDialect.cpp",
"lib/Dialect/XeGPU/IR/XeGPUOps.cpp",
],
hdrs = ["include/mlir/Dialect/XeGPU/IR/XeGPU.h"],
srcs = glob(["lib/Dialect/XeGPU/IR/*.cpp"]),
hdrs = glob(["include/mlir/Dialect/XeGPU/IR/*.h"]),
includes = ["include"],
deps = [
":ArithDialect",
@@ -4845,7 +4842,8 @@ cc_library(
]),
hdrs = glob(["include/mlir/Support/*.h"]),
includes = ["include"],
deps = ["//llvm:Support"],)
deps = ["//llvm:Support"],
)
cc_library(
name = "Debug",