Skip to content

Commit 584a451

Browse files
committed
Add amdxdna native HAL backend
Adds the amdxdna HAL driver with Linux KMQ and Windows MCDM native shims, PDIX and XADX executable schemas, async queue execution, transfer-queue support, native command recording/submission paths, HRX runtime integration, and amdxdna host CI coverage. Includes unit and CTS coverage for allocator/buffer/device/event/semaphore/executable paths, command-buffer planning and caches, transfer queue behavior, XADX/PDIX artifact handling, and platform shim utilities.
1 parent c45a683 commit 584a451

109 files changed

Lines changed: 27256 additions & 38 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci_core_linux.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ jobs:
5353
run_tests: true
5454
ctest_exclude_regex: ""
5555
package: true
56+
- variant: AMDXDNA Host
57+
sanitizer: none
58+
assertions: false
59+
run_tests: true
60+
ctest_exclude_regex: ""
61+
cmake_options: |
62+
-DIREE_HAL_DRIVER_AMDGPU=OFF
63+
-DIREE_HAL_DRIVER_AMDXDNA=ON
64+
-DLIBHRX_BUILD_PASSTHROUGH=OFF
65+
package: false
5666
- variant: ASAN
5767
sanitizer: asan
5868
assertions: true
@@ -99,6 +109,7 @@ jobs:
99109
ctest_label_exclude_regex: "runtime-resource=|manual"
100110
cmake_options: |
101111
-DIREE_HAL_AMDGPU_TARGETS=gfx942;gfx1151;gfx1201
112+
${{ matrix.cmake_options }}
102113
package: ${{ matrix.package }}
103114

104115
gpu_linux:

CMakeLists.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,21 @@ option(IREE_ENABLE_ASSERTIONS "Force unset of NDEBUG compile option." OFF)
7070
option(IREE_DEV_MODE
7171
"Configure settings optimized for IREE development instead of CI/release."
7272
OFF)
73+
option(IREE_HAL_DRIVER_AMDXDNA
74+
"Enables the amdxdna runtime HAL driver."
75+
OFF)
7376
option(LIBHRX_BUILD
7477
"Build libhrx and HRX compatibility targets." ON)
7578
if(LIBHRX_BUILD)
76-
if(DEFINED IREE_HAL_DRIVER_AMDGPU AND NOT IREE_HAL_DRIVER_AMDGPU)
79+
if(NOT DEFINED IREE_HAL_DRIVER_AMDGPU)
80+
if(NOT IREE_HAL_DRIVER_AMDXDNA)
81+
set(IREE_HAL_DRIVER_AMDGPU_DEFAULT ON)
82+
endif()
83+
elseif(NOT IREE_HAL_DRIVER_AMDGPU AND NOT IREE_HAL_DRIVER_AMDXDNA)
7784
message(FATAL_ERROR
78-
"LIBHRX_BUILD=ON requires IREE_HAL_DRIVER_AMDGPU=ON.")
85+
"LIBHRX_BUILD=ON requires at least one accelerator driver "
86+
"(IREE_HAL_DRIVER_AMDGPU=ON or IREE_HAL_DRIVER_AMDXDNA=ON).")
7987
endif()
80-
set(IREE_HAL_DRIVER_AMDGPU_DEFAULT ON)
8188
endif()
8289

8390
set(IREE_USE_LINKER "" CACHE STRING "")
@@ -185,6 +192,9 @@ endif()
185192
if(IREE_HAL_DRIVER_HIP)
186193
message(STATUS " - hip")
187194
endif()
195+
if(IREE_HAL_DRIVER_AMDXDNA)
196+
message(STATUS " - amdxdna")
197+
endif()
188198
if(IREE_HAL_DRIVER_LOCAL_SYNC)
189199
message(STATUS " - local-sync")
190200
endif()

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ ctest --test-dir build/hrx-tests/share/hrx-system/tests \
185185
--output-on-failure -L runtime-resource=amd-gpu
186186
```
187187

188+
NPU runners use the AMD NPU resource label:
189+
190+
```bash
191+
ctest --test-dir build/hrx-tests/share/hrx-system/tests \
192+
--output-on-failure -L runtime-resource=amd-npu
193+
```
194+
188195
## Release Artifacts
189196

190197
Tagged releases publish one tarball per artifact, plus manifests and environment

libhrx/.bazel_to_cmake.cfg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def hrx_cts_test(self, name, deps=[], **kwargs):
100100
defines = kwargs.get("defines")
101101
includes = kwargs.get("includes")
102102
tags = kwargs.get("tags")
103+
target_compatible_with = kwargs.get("target_compatible_with")
103104
full_deps = (
104105
[
105106
":core",
@@ -131,6 +132,7 @@ def hrx_cts_test(self, name, deps=[], **kwargs):
131132
if platform_deps_block:
132133
self._converter.body += platform_deps_block
133134
labels_block = self._convert_string_list_block("LABELS", tags)
135+
self._emit_platform_guard_begin(target_compatible_with)
134136
self._converter.body += (
135137
f"hrx_cc_test(\n"
136138
f"{name_block}"
@@ -143,6 +145,7 @@ def hrx_cts_test(self, name, deps=[], **kwargs):
143145
f"{labels_block}"
144146
f")\n\n"
145147
)
148+
self._emit_platform_guard_end(target_compatible_with)
146149

147150

148151
def convert_unmatched_target(converter, target):

libhrx/cts/BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ package(
1616

1717
AMD_GPU_CTS_TAGS = ["runtime-resource=amd-gpu"]
1818

19+
AMDGPU_TARGET_COMPATIBLE_WITH = select({
20+
"//runtime/config/hal:driver_amdgpu": [],
21+
"//conditions:default": ["@platforms//:incompatible"],
22+
})
23+
1924
iree_amdgpu_binary_variants_embed_data(
2025
name = "amdgpu_executable_test_kernels",
2126
testonly = True,
@@ -26,6 +31,7 @@ iree_amdgpu_binary_variants_embed_data(
2631
identifier = "hrx_cts_amdgpu_executable_test_kernels",
2732
tags = ["manual"],
2833
target = "amdgcn-amd-amdhsa",
34+
target_compatible_with = AMDGPU_TARGET_COMPATIBLE_WITH,
2935
target_selectors_flag = "//runtime/src/iree/hal/drivers/amdgpu:targets",
3036
)
3137

@@ -112,6 +118,7 @@ hrx_cts_test(
112118
name = "executable",
113119
srcs = ["tests/executable/executable_test.cpp"],
114120
tags = AMD_GPU_CTS_TAGS,
121+
target_compatible_with = AMDGPU_TARGET_COMPATIBLE_WITH,
115122
deps = [
116123
":amdgpu_executable_test_kernels",
117124
"//build_tools/amdgpu:target_map_h",

libhrx/cts/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
iree_add_all_subdirs()
1111

12+
if(IREE_HAL_DRIVER_AMDGPU)
1213
iree_amdgpu_binary_variants_embed_data(
1314
NAME
1415
amdgpu_executable_test_kernels
@@ -29,6 +30,7 @@ iree_amdgpu_binary_variants_embed_data(
2930
TESTONLY
3031
PUBLIC
3132
)
33+
endif()
3234

3335
iree_cc_library(
3436
NAME
@@ -195,6 +197,7 @@ hrx_cc_test(
195197
"runtime-resource=amd-gpu"
196198
)
197199

200+
if(IREE_HAL_DRIVER_AMDGPU)
198201
hrx_cc_test(
199202
NAME
200203
hrx_cts_executable
@@ -211,6 +214,7 @@ hrx_cc_test(
211214
LABELS
212215
"runtime-resource=amd-gpu"
213216
)
217+
endif()
214218

215219
hrx_cc_test(
216220
NAME

libhrx/src/libhrx/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ if(IREE_HAL_DRIVER_AMDGPU)
8383
HRX_HAS_IREE_AMDGPU_DRIVER
8484
)
8585
endif()
86+
if(IREE_HAL_DRIVER_AMDXDNA)
87+
target_link_libraries(libhrx_src_libhrx_hrx PRIVATE
88+
iree::hal::drivers::amdxdna::registration
89+
iree::hal::drivers::amdxdna
90+
iree::base::tooling::flags
91+
)
92+
target_compile_definitions(libhrx_src_libhrx_hrx.objects PRIVATE
93+
HRX_HAS_IREE_AMDXDNA_DRIVER
94+
)
95+
endif()
8696
# IREE's allocator selector is exposed as a compile definition on the base
8797
# library target. libhrx is compiled through IREE's object-library wrapper, so
8898
# forward that definition to the object target that actually compiles the

0 commit comments

Comments
 (0)