forked from iree-org/iree
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert WebGPU compiler target into a plugin. (iree-org#15612)
Progress on iree-org#15468 I didn't do anything fancy with includes or namespaces for this, just relative includes with `./` (same as target/CUDA). * Unit test is at `iree/compiler/plugins/target/WebGPU/test/smoketest.mlir.test` * Unit tests for input plugins are at e.g. `tosa-iree/InputConversion/test/auto_input_conversion.mlir.test` I also moved the deps that are unique to the WebGPU target into the plugin, keeping the root `CMakeLists.txt` and shared `build_tools/third_party/` directories cleaner.
- Loading branch information
Showing
19 changed files
with
122 additions
and
140 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
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
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
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,58 @@ | ||
# Copyright 2021 The IREE Authors | ||
# | ||
# Licensed 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 | ||
|
||
# Tint is needed to compile SPIR-V into WGSL source code. | ||
# Tint also requires SPIRV-Tools, which requires SPIRV-Headers. | ||
# | ||
# NOTE: these can be synced by referencing one of these repositories: | ||
# * https://dawn.googlesource.com/dawn/ | ||
# * https://dawn.googlesource.com/tint/ | ||
# * https://chromium.googlesource.com/vulkan-deps/+/refs/heads/main/DEPS | ||
# or they can be updated independently | ||
set(IREE_TINT_TAG "fdb8787e9c1b79770bd98a8faf37fbe48a3077a4") # 2023-03-06 | ||
set(IREE_SPIRV_HEADERS_TAG "b730938c033ede3572b660ab019b438509ba24d9") # 2023-08-10 | ||
set(IREE_SPIRV_TOOLS_TAG "43b8886490eb6af81fc61e0ff071c51a922af864") # 2023-08-11 | ||
message(STATUS "Configuring WebGPU target deps (SPIRV-Headers, SPIRV-Tools, Tint)") | ||
list(APPEND CMAKE_MESSAGE_INDENT " ") | ||
add_subdirectory(spirv-headers EXCLUDE_FROM_ALL) | ||
add_subdirectory(spirv-tools EXCLUDE_FROM_ALL) | ||
add_subdirectory(tint EXCLUDE_FROM_ALL) | ||
list(POP_BACK CMAKE_MESSAGE_INDENT) | ||
|
||
add_subdirectory(test) | ||
|
||
iree_compiler_register_plugin( | ||
PLUGIN_ID | ||
hal_target_webgpu | ||
TARGET | ||
::WebGPU | ||
) | ||
|
||
iree_cc_library( | ||
NAME | ||
WebGPU | ||
HDRS | ||
"SPIRVToWGSL.h" | ||
SRCS | ||
"SPIRVToWGSL.cpp" | ||
"WebGPUTarget.cpp" | ||
DEPS | ||
LLVMSupport | ||
MLIRGPUDialect | ||
MLIRIR | ||
MLIRSPIRVDialect | ||
MLIRSPIRVSerialization | ||
MLIRSPIRVTransforms | ||
SPIRV-Tools | ||
iree::compiler::Codegen::Dialect::IREECodegenDialect | ||
iree::compiler::Codegen::SPIRV | ||
iree::compiler::Dialect::HAL::Target | ||
iree::compiler::PluginAPI | ||
iree::compiler::Utils | ||
iree::schemas::wgsl_executable_def_c_fbs | ||
libtint | ||
PUBLIC | ||
) |
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
File renamed without changes.
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
19 changes: 19 additions & 0 deletions
19
compiler/plugins/target/WebGPU/spirv-headers/CMakeLists.txt
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,19 @@ | ||
# Copyright 2023 The IREE Authors | ||
# | ||
# Licensed 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(FetchContent) | ||
|
||
FetchContent_Declare( | ||
spirv-headers | ||
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Headers.git | ||
GIT_TAG ${IREE_SPIRV_HEADERS_TAG} | ||
) | ||
|
||
set(SPIRV_HEADERS_SKIP_EXAMPLES ON CACHE BOOL "" FORCE) | ||
set(SPIRV_HEADERS_SKIP_INSTALL ON CACHE BOOL "" FORCE) | ||
|
||
FetchContent_MakeAvailable(spirv-headers) | ||
FetchContent_GetProperties(spirv-headers SOURCE_DIR SPIRV_HEADERS_SOURCE) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 0 additions & 37 deletions
37
compiler/src/iree/compiler/Dialect/HAL/Target/WebGPU/CMakeLists.txt
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
compiler/src/iree/compiler/Dialect/HAL/Target/WebGPU/WebGPUTarget.h
This file was deleted.
Oops, something went wrong.
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
Submodule spirv_headers
deleted from
b73093