Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Vulkan support #965

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .github/workflows/tpp-llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,3 @@ jobs:
${{ env.SRUN }} --partition=a100,v100 --time=0:30:00 -- \
'KIND=RelWithDebInfo COMPILER=clang GPU=cuda \
${{ github.workspace }}/scripts/buildkite/build_llvm.sh'

TPP-MLIR-LLVM-Vulkan:
runs-on: pcl-tiergarten
steps:
- uses: actions/checkout@v4
- name: LLVM Vulkan
run: |-
GPU=vulkan scripts/buildkite/check_llvm.sh || \
${{ env.SRUN }} --partition=spr-all --time=0:30:00 -- \
'KIND=RelWithDebInfo COMPILER=clang GPU=vulkan \
${{ github.workspace }}/scripts/buildkite/build_llvm.sh'
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ project(tpp-dialect LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")

set(TPP_GPU "" CACHE STRING "Enables GPU runtime (default: '')")
set_property(CACHE TPP_GPU PROPERTY STRINGS "" "cuda" "vulkan")
set_property(CACHE TPP_GPU PROPERTY STRINGS "" "cuda")

if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
message(STATUS "TPP-MLIR out-of-tree build.")
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ def verifyStats(self):
"--init-type", type=str, help="Random initializer type"
)
parser.add_argument(
"--gpu", type=str, help="Target GPU backend for lowering (cuda,vulkan)"
"--gpu", type=str, help="Target GPU backend for lowering (cuda)"
)
args = parser.parse_args()

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/harness/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def verifyStats(self):
help="Random initializer type (default: normal)",
)
parser.add_argument(
"--gpu", type=str, help="Target GPU backend for lowering (cuda,vulkan)"
"--gpu", type=str, help="Target GPU backend for lowering (cuda)"
)
args = parser.parse_args()

Expand Down
9 changes: 0 additions & 9 deletions include/TPP/PassBundles.td
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,4 @@ def GpuToCuda : Pass<"gpu-to-cuda", "ModuleOp"> {
];
}

def GpuToVulkan : Pass<"gpu-to-vulkan", "ModuleOp"> {
let summary = "Lower generic GPU operations to Vulkan backend";
let dependentDialects = ["arith::ArithDialect",
"memref::MemRefDialect",
"func::FuncDialect",
"gpu::GPUDialect",
"spirv::SPIRVDialect"];
}

#endif // TPP_DIALECT_TPP_PASSBUNDLES
25 changes: 3 additions & 22 deletions include/TPP/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def SetSPIRVCapabilities : Pass<"tpp-set-spirv-capabilities", "ModuleOp"> {
let summary = "Set SPIR-V capabilities.";
let options = [
Option<"clientAPI", "client-api", "std::string",
/*default=*/"\"vulkan\"",
/*default=*/"\"opencl\"",
"The client API to use for capabilities">,
];
}
Expand All @@ -299,30 +299,11 @@ def SetSPIRVAbiAttribute : Pass<"set-spirv-abi-attr", "gpu::GPUModuleOp"> {
let summary = "Set SPIR-V ABI attribute.";
let options = [
Option<"clientAPI", "client-api", "std::string",
/*default=*/"\"vulkan\"",
/*default=*/"\"opencl\"",
"The client API to use for ABI attribute">,
];
}

def GpuVulkanAbi : Pass<"gpu-vulkan-abi", "ModuleOp"> {
let summary = "Rewrite GPU kernels to comply with Vulkan ABI.";
let description = [{
This pass rewrites GPU kernels and the GPU function launches
to be compatible with Vulkan calling convention.

The rewrite is focused only on ensuring GPU kernel prototype
compatibility with Vulkan ABI.Thus, it is assumed that the kernel
operations have been already preserved in a separate SPIR-V module.
The original GPU kernel logic is thrown away to make interface
adaptation easier.
}];
let options = [
Option<"use64bitIndex", "use-64bit-index",
"bool", /*default=*/"false",
"Use 64-bit integers to convert index types">
];
}

def DecomposeAggregatedOps : Pass<"decompose-aggregated-ops", "func::FuncOp"> {
let summary = "Decompose aggregated operations.";
let description = [{
Expand Down Expand Up @@ -467,7 +448,7 @@ def TppRunnerWrapper : Pass<"tpp-runner-wrapper", "ModuleOp">{
"The type of the kernel function.">,
Option<"backend", "backend", "std::string",
/*default=*/"\"cpu\"",
"Kernel target device backend (cpu, cuda, vulkan).">,
"Kernel target device backend (cpu, cuda, intel).">,
Option<"offloadToDevice", "offload-on-device", "bool",
/*default=*/"true",
"Offload kernel arguments to the target device.">,
Expand Down
2 changes: 0 additions & 2 deletions lib/TPP/DefaultPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ struct DefaultPipeline : public tpp::impl::DefaultPipelineBase<DefaultPipeline>,
pm.addNestedPass<func::FuncOp>(createCSEPass());
pm.addPass(createReconcileUnrealizedCastsPass());

pm.addPass(createConvertVulkanLaunchFuncToVulkanCallsPass());

// Anything useful has been lowered by now.
// Cleanup IR by removing any dead symbols.
// This step aims to avoid errors caused by frontend leftovers.
Expand Down
10 changes: 1 addition & 9 deletions lib/TPP/GPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ add_mlir_library(TPPGPU
GpuPipeline.cpp
GpuConversion.cpp
GpuToCuda.cpp
GpuToVulkan.cpp
SetSPIRVCapabilities.cpp
SetSPIRVAbiAttribute.cpp
GpuVulkanAbi.cpp
LinalgToGpu.cpp
GpuDataTransfer.cpp
GpuInlineConstants.cpp
Expand Down Expand Up @@ -46,17 +44,11 @@ if (TPP_GPU MATCHES "cuda")
)
endif()

if (TPP_GPU MATCHES "vulkan")
target_compile_definitions(obj.TPPGPU
PRIVATE
TPP_VULKAN_ENABLE=1
)

if (DEFINED ${TPP_GPU})
target_link_libraries(TPPGPU
PUBLIC
MLIRSPIRVDialect
MLIRSPIRVTransforms
MLIRGPUToVulkanTransforms
MLIRGPUToSPIRV
)
endif()
11 changes: 1 addition & 10 deletions lib/TPP/GPU/GpuPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,12 @@ namespace {

enum class GpuType {
Cuda,
Vulkan,
Intel,
};

GpuType parseGpuOption(StringRef gpuStr) {
auto type = llvm::StringSwitch<std::optional<GpuType>>(gpuStr)
.CaseLower("cuda", GpuType::Cuda)
.CaseLower("vulkan", GpuType::Vulkan)
.CaseLower("intel", GpuType::Intel)
.Default(std::nullopt);
assert(type && "Unsupported GPU backend");
Expand All @@ -115,7 +113,6 @@ GpuOptions getGpuOptions(GpuType gpuType) {
options.features = "+ptx60";
break;
}
case GpuType::Vulkan:
case GpuType::Intel: {
// No options needed at the moment.
break;
Expand Down Expand Up @@ -196,8 +193,7 @@ struct GpuPipeline : public tpp::impl::GpuPipelineBase<GpuPipeline>,
// Preprocess and bufferize as further conversion requires memref
// abstraction.
pm.addPass(createLowerPacksAndUnPacks());
bool dealloc = gpuType == GpuType::Vulkan;
pm.addPass(createBufferize(BufferizeOptions{dealloc}));
pm.addPass(createBufferize(BufferizeOptions{/*dealloc=*/false}));
pm.addPass(createConvertForAllToParallelOp());
pm.addPass(createCleanup());

Expand All @@ -211,16 +207,11 @@ struct GpuPipeline : public tpp::impl::GpuPipelineBase<GpuPipeline>,
case GpuType::Cuda: {
// Perform explicit GPU data transfers only for CUDA as the unified
// memory is not currently used here.
// Vulkan runner assumes usage of GPU unified memory.
pm.addNestedPass<func::FuncOp>(createGpuDataTransfer());
pm.addPass(createGpuToCuda(GpuToCudaOptions{
gpuOptions.triple, gpuOptions.chip, gpuOptions.features}));
break;
}
case GpuType::Vulkan: {
pm.addPass(createGpuToVulkan());
break;
}
case GpuType::Intel:
pm.addPass(xegpu::createXeGPUFoldAliasOps());

Expand Down
89 changes: 0 additions & 89 deletions lib/TPP/GPU/GpuToVulkan.cpp

This file was deleted.

Loading