Skip to content

Commit

Permalink
Cleanup compiler target plugin files. (#15898)
Browse files Browse the repository at this point in the history
Progress on #15468

* Use descriptive file name instead of `LLVMPasses.h`
* Update `ifndef` guards based on new paths
* Delete unused `MetalSPIRVTarget.h` file
  • Loading branch information
ScottTodd authored Dec 13, 2023
1 parent 6e811ff commit 138af17
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 46 deletions.
2 changes: 1 addition & 1 deletion compiler/plugins/target/CUDA/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ iree_compiler_cc_library(
"SetBlockIdsRangePass.cpp",
],
hdrs = [
"LLVMPasses.h",
"SetBlockIdsRangePass.h",
],
deps = [
"//compiler/src/iree/compiler/Codegen",
Expand Down
2 changes: 1 addition & 1 deletion compiler/plugins/target/CUDA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ iree_cc_library(
NAME
CUDA
HDRS
"LLVMPasses.h"
"SetBlockIdsRangePass.h"
SRCS
"CUDATarget.cpp"
"SetBlockIdsRangePass.cpp"
Expand Down
2 changes: 1 addition & 1 deletion compiler/plugins/target/CUDA/CUDATarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "./LLVMPasses.h"
#include "./SetBlockIdsRangePass.h"
#include "iree/compiler/Codegen/Dialect/IREECodegenDialect.h"
#include "iree/compiler/Codegen/LLVMGPU/Passes.h"
#include "iree/compiler/Dialect/HAL/Target/LLVMLinkerUtils.h"
Expand Down
3 changes: 2 additions & 1 deletion compiler/plugins/target/CUDA/SetBlockIdsRangePass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "./LLVMPasses.h"
#include "./SetBlockIdsRangePass.h"

#include "llvm/IR/Constants.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef IREE_COMPILER_DIALECT_HAL_TARGET_CUDA_PASS_H_
#define IREE_COMPILER_DIALECT_HAL_TARGET_CUDA_PASS_H_
#ifndef IREE_COMPILER_PLUGINS_TARGET_CUDA_SETBLOCKIDSRANGEPASS_H_
#define IREE_COMPILER_PLUGINS_TARGET_CUDA_SETBLOCKIDSRANGEPASS_H_

#include "llvm/IR/PassManager.h"
#include "llvm/Pass.h"
Expand All @@ -25,4 +25,4 @@ struct SetBlockIdsRangePass : PassInfoMixin<SetBlockIdsRangePass> {

} // namespace llvm

#endif // IREE_COMPILER_DIALECT_HAL_TARGET_CUDA_PASS_H_
#endif // IREE_COMPILER_PLUGINS_TARGET_CUDA_SETBLOCKIDSRANGEPASS_H_
1 change: 0 additions & 1 deletion compiler/plugins/target/MetalSPIRV/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ iree_compiler_register_plugin(
iree_compiler_cc_library(
name = "MetalSPIRV",
srcs = ["MetalSPIRVTarget.cpp"],
hdrs = ["MetalSPIRVTarget.h"],
deps = [
":MSLToMetalLib",
":MetalTargetPlatform",
Expand Down
2 changes: 0 additions & 2 deletions compiler/plugins/target/MetalSPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ iree_compiler_register_plugin(
iree_cc_library(
NAME
MetalSPIRV
HDRS
"MetalSPIRVTarget.h"
SRCS
"MetalSPIRVTarget.cpp"
DEPS
Expand Down
6 changes: 3 additions & 3 deletions compiler/plugins/target/MetalSPIRV/MSLToMetalLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef IREE_COMPILER_DIALECT_HAL_TARGET_METALSPIRV_MSLTOMETALLIB_H_
#define IREE_COMPILER_DIALECT_HAL_TARGET_METALSPIRV_MSLTOMETALLIB_H_
#ifndef IREE_COMPILER_PLUGINS_TARGET_METALSPIRV_MSLTOMETALLIB_H_
#define IREE_COMPILER_PLUGINS_TARGET_METALSPIRV_MSLTOMETALLIB_H_

#include "./MetalTargetPlatform.h"
#include "llvm/ADT/StringRef.h"
Expand All @@ -22,4 +22,4 @@ compileMSLToMetalLib(MetalTargetPlatform targetPlatform,

} // namespace mlir::iree_compiler::IREE::HAL

#endif // IREE_COMPILER_DIALECT_HAL_TARGET_METALSPIRV_MSLTOMETALLIB_H_
#endif // IREE_COMPILER_PLUGINS_TARGET_METALSPIRV_MSLTOMETALLIB_H_
2 changes: 0 additions & 2 deletions compiler/plugins/target/MetalSPIRV/MetalSPIRVTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "./MetalSPIRVTarget.h"

#include "./MSLToMetalLib.h"
#include "./MetalTargetPlatform.h"
#include "./SPIRVToMSL.h"
Expand Down
19 changes: 0 additions & 19 deletions compiler/plugins/target/MetalSPIRV/MetalSPIRVTarget.h

This file was deleted.

6 changes: 3 additions & 3 deletions compiler/plugins/target/MetalSPIRV/MetalTargetPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef IREE_COMPILER_DIALECT_HAL_TARGET_METALSPIRV_METALTARGETPLATFORM_H_
#define IREE_COMPILER_DIALECT_HAL_TARGET_METALSPIRV_METALTARGETPLATFORM_H_
#ifndef IREE_COMPILER_PLUGINS_TARGET_METALSPIRV_METALTARGETPLATFORM_H_
#define IREE_COMPILER_PLUGINS_TARGET_METALSPIRV_METALTARGETPLATFORM_H_

#include <functional>

Expand All @@ -16,4 +16,4 @@ enum class MetalTargetPlatform { macOS, iOS, iOSSimulator };

} // namespace mlir::iree_compiler::IREE::HAL

#endif // IREE_COMPILER_DIALECT_HAL_TARGET_METALSPIRV_METALTARGETPLATFORM_H_
#endif // IREE_COMPILER_PLUGINS_TARGET_METALSPIRV_METALTARGETPLATFORM_H_
6 changes: 3 additions & 3 deletions compiler/plugins/target/MetalSPIRV/SPIRVToMSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef IREE_COMPILER_DIALECT_HAL_TARGET_METALSPIRV_SPIRVTOMSL_H_
#define IREE_COMPILER_DIALECT_HAL_TARGET_METALSPIRV_SPIRVTOMSL_H_
#ifndef IREE_COMPILER_PLUGINS_TARGET_METALSPIRV_SPIRVTOMSL_H_
#define IREE_COMPILER_PLUGINS_TARGET_METALSPIRV_SPIRVTOMSL_H_

#include <array>
#include <optional>
Expand Down Expand Up @@ -37,4 +37,4 @@ crossCompileSPIRVToMSL(IREE::HAL::MetalTargetPlatform targetPlatform,

} // namespace mlir::iree_compiler

#endif // IREE_COMPILER_DIALECT_HAL_TARGET_METALSPIRV_SPIRVTOMSL_H_
#endif // IREE_COMPILER_PLUGINS_TARGET_METALSPIRV_SPIRVTOMSL_H_
6 changes: 3 additions & 3 deletions compiler/plugins/target/ROCM/ROCMTargetUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef IREE_COMPILER_DIALECT_HAL_TARGET_ROCM_ROCMTARGETUTILS_H_
#define IREE_COMPILER_DIALECT_HAL_TARGET_ROCM_ROCMTARGETUTILS_H_
#ifndef IREE_COMPILER_PLUGINS_TARGET_ROCM_ROCMTARGETUTILS_H_
#define IREE_COMPILER_PLUGINS_TARGET_ROCM_ROCMTARGETUTILS_H_

#include "iree/compiler/Dialect/HAL/Target/TargetBackend.h"
#include "llvm/IR/Module.h"
Expand All @@ -21,4 +21,4 @@ std::string createHsaco(Location loc, const std::string isa, StringRef name);

} // namespace mlir::iree_compiler::IREE::HAL

#endif // IREE_COMPILER_DIALECT_HAL_TARGET_ROCM_ROCMTARGETUTILS_H_
#endif // IREE_COMPILER_PLUGINS_TARGET_ROCM_ROCMTARGETUTILS_H_
6 changes: 3 additions & 3 deletions compiler/plugins/target/WebGPU/SPIRVToWGSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef IREE_COMPILER_DIALECT_HAL_TARGET_WEBGPU_SPIRVTOWGSL_H_
#define IREE_COMPILER_DIALECT_HAL_TARGET_WEBGPU_SPIRVTOWGSL_H_
#ifndef IREE_COMPILER_PLUGINS_TARGET_WEBGPU_SPIRVTOWGSL_H_
#define IREE_COMPILER_PLUGINS_TARGET_WEBGPU_SPIRVTOWGSL_H_

#include <optional>
#include <string>
Expand All @@ -21,4 +21,4 @@ compileSPIRVToWGSL(llvm::ArrayRef<uint32_t> spvBinary);

} // namespace mlir::iree_compiler::IREE::HAL

#endif // IREE_COMPILER_DIALECT_HAL_TARGET_WEBGPU_SPIRVTOWGSL_H_
#endif // IREE_COMPILER_PLUGINS_TARGET_WEBGPU_SPIRVTOWGSL_H_

0 comments on commit 138af17

Please sign in to comment.