Adding build config for HSA runtime headers. (#18909)
diff --git a/build_tools/bazel/workspace.bzl b/build_tools/bazel/workspace.bzl
index 6546495..bb39437 100644
--- a/build_tools/bazel/workspace.bzl
+++ b/build_tools/bazel/workspace.bzl
@@ -149,6 +149,13 @@
maybe(
native.new_local_repository,
+ name = "hsa_runtime_headers",
+ build_file = iree_repo_alias + "//:build_tools/third_party/hsa-runtime-headers/BUILD.overlay",
+ path = paths.join(iree_path, "third_party/hsa-runtime-headers"),
+ )
+
+ maybe(
+ native.new_local_repository,
name = "webgpu_headers",
build_file = iree_repo_alias + "//:build_tools/third_party/webgpu-headers/BUILD.overlay",
path = paths.join(iree_path, "third_party/webgpu-headers"),
diff --git a/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py b/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
index cecc217..0c0469e 100644
--- a/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
+++ b/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
@@ -113,6 +113,7 @@
"@com_google_googletest//:gtest": ["gmock", "gtest"],
"@spirv_cross//:spirv_cross_lib": ["spirv-cross-msl"],
"@cpuinfo": ["${IREE_CPUINFO_TARGET}"],
+ "@hsa_runtime_headers": ["hsa_runtime::headers"],
"@webgpu_headers": [],
}
)
diff --git a/build_tools/third_party/hsa-runtime-headers/BUILD.overlay b/build_tools/third_party/hsa-runtime-headers/BUILD.overlay
new file mode 100644
index 0000000..b3e0b85
--- /dev/null
+++ b/build_tools/third_party/hsa-runtime-headers/BUILD.overlay
@@ -0,0 +1,16 @@
+# Copyright 2024 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
+
+package(default_visibility = ["//visibility:public"])
+
+cc_library(
+ name = "hsa_runtime_headers",
+ hdrs = glob([
+ "include/hsa/*.h",
+ ]),
+ include_prefix = "third_party/hsa-runtime-headers/",
+ includes = ["include"],
+)
diff --git a/build_tools/third_party/hsa-runtime-headers/CMakeLists.txt b/build_tools/third_party/hsa-runtime-headers/CMakeLists.txt
new file mode 100644
index 0000000..e939e98
--- /dev/null
+++ b/build_tools/third_party/hsa-runtime-headers/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Copyright 2024 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
+
+set(HSA_RUNTIME_HEADERS_ROOT "${IREE_ROOT_DIR}/third_party/hsa-runtime-headers/")
+
+external_cc_library(
+ PACKAGE
+ hsa_runtime
+ NAME
+ headers
+ ROOT
+ ${HSA_RUNTIME_HEADERS_ROOT}
+ SYSTEM_INCLUDES
+ ${HSA_RUNTIME_HEADERS_ROOT}/include/
+ PUBLIC
+)
+
+iree_install_targets(
+ TARGETS
+ hsa_runtime_headers
+ COMPONENT
+ IREEBundledLibraries
+ EXPORT_SET
+ Runtime
+)
diff --git a/third_party/hsa-runtime-headers b/third_party/hsa-runtime-headers
index c4fb247..ffa0dc3 160000
--- a/third_party/hsa-runtime-headers
+++ b/third_party/hsa-runtime-headers
@@ -1 +1 @@
-Subproject commit c4fb247e28616c51d37a45f2c0056ed5f4df0555
+Subproject commit ffa0dc3307be5472ccdf7c9825c3dc68340649de