[Mlir-commits] [mlir] [MLIR][AMDGPU] Adding Vector to AMDGPU conversion lowering (PR #131803)
Zhuoran Yin
llvmlistbot at llvm.org
Wed Mar 19 06:36:40 PDT 2025
================
@@ -0,0 +1,145 @@
+//===- VectorToAMDGPU.cpp - Vector to AMDGPU dialect conversion ---------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Conversion/VectorToAMDGPU/VectorToAMDGPU.h"
+
+#include "mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h"
+#include "mlir/Dialect/Vector/IR/VectorOps.h"
+#include "mlir/IR/BuiltinTypes.h"
+#include "mlir/IR/PatternMatch.h"
+#include "mlir/IR/TypeUtilities.h"
+#include "mlir/Pass/Pass.h"
+#include "mlir/Support/LogicalResult.h"
+#include "mlir/Transforms/WalkPatternRewriteDriver.h"
+
+namespace mlir {
+#define GEN_PASS_DEF_CONVERTVECTORTOAMDGPUPASS
+#include "mlir/Conversion/Passes.h.inc"
+} // namespace mlir
+
+using namespace mlir;
----------------
jerryyin wrote:
I noticed this too back when I drafted this PR. It turns out that every vectorTo* dialect adopt this pattern. Please refer to ` VectorToSPIRVPass.cpp`, `VectorToXeGPU.cpp`, etc...
I think this is motivated by [here](https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions).
Quote:
> When providing an out of line implementation of a function in a source file, do not open namespace blocks in the source file. Instead, use namespace qualifiers to help ensure that your definition matches an existing declaration.
So this explained why using is preferred over a namespace block below. I'm not entirely sure why not lifting using above the tabelgen definitions though. If I had to guess, I'd say that's because we have confidence that the tabelgen'ed file will not bump into the problem pointed out by llvm coding standards.
Considering this is a nit feedback, I'm skipping this to go with consistency with rest of codebase.
https://github.com/llvm/llvm-project/pull/131803
More information about the Mlir-commits
mailing list