This repository has been archived by the owner on Apr 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements initial version of Vulkan runtime to test spirv::ModuleOp. Creates and runs Vulkan computation pipeline. Requirements: - Vulkan capable device and drivers installed. - Vulkan SDK installed and VULKAN_SDK environment variable is set. How to build: - Provide -DMLIR_VULKAN_RUNNER_ENABLED=ON as cmake variable.
- Loading branch information
Showing
6 changed files
with
1,323 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
set(LLVM_OPTIONAL_SOURCES | ||
VulkanRuntime.cpp | ||
) | ||
|
||
if (MLIR_VULKAN_RUNNER_ENABLED) | ||
message(STATUS "Building the Vulkan runner") | ||
|
||
# At first try "FindVulkan" from: | ||
# https://cmake.org/cmake/help/v3.7/module/FindVulkan.html | ||
if (NOT CMAKE_VERSION VERSION_LESS 3.7.0) | ||
find_package(Vulkan) | ||
endif() | ||
|
||
# If Vulkan is not found try a path specified by VULKAN_SDK. | ||
if (NOT Vulkan_FOUND) | ||
if ("$ENV{VULKAN_SDK}" STREQUAL "") | ||
message(FATAL_ERROR "VULKAN_SDK environment variable is empty") | ||
endif() | ||
|
||
find_library(Vulkan_LIBRARY vulkan HINTS "$ENV{VULKAN_SDK}/lib" REQUIRED) | ||
if (Vulkan_LIBRARY) | ||
set(Vulkan_FOUND ON) | ||
set(Vulkan_INCLUDE_DIR "$ENV{VULKAN_SDK}/include") | ||
message(STATUS "Found Vulkan: " ${Vulkan_LIBRARY}) | ||
endif() | ||
endif() | ||
|
||
if (NOT Vulkan_FOUND) | ||
message(FATAL_ERROR "Cannot find Vulkan library") | ||
endif() | ||
|
||
# Create archive for this moment. | ||
add_llvm_library(MLIRVulkanRuntime | ||
VulkanRuntime.cpp | ||
) | ||
|
||
target_include_directories(MLIRVulkanRuntime PRIVATE ${Vulkan_INCLUDE_DIR}) | ||
|
||
target_link_libraries(MLIRVulkanRuntime | ||
MLIRSPIRVSerialization | ||
LLVMCore | ||
LLVMSupport | ||
${Vulkan_LIBRARY} | ||
) | ||
endif() |
Oops, something went wrong.