-
Notifications
You must be signed in to change notification settings - Fork 326
[fusilli-provider] Add fusilli-provider to dnn-providers
#5149
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
Merged
AaronStGeorge
merged 4 commits into
ROCm:develop
from
AaronStGeorge:p036-move-fusilli-plugin-to-rocm-libs
Mar 11, 2026
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b53a22d
Add fusilli-provider to dnn-providers
AaronStGeorge 01550af
Remove obsolete ThePebble dev environment scripts
AaronStGeorge f5827e7
Merge branch 'develop' into p036-move-fusilli-plugin-to-rocm-libs
AaronStGeorge 291495d
Address doc review
AaronStGeorge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| BasedOnStyle: LLVM |
This file contains hidden or 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,8 @@ | ||
| # CMake build | ||
| build/ | ||
|
|
||
| # clangd intellisense cache | ||
| .cache/ | ||
|
|
||
| # CMake presets | ||
| CMakeUserPresets.json |
This file contains hidden or 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,129 @@ | ||
| # Copyright 2025 Advanced Micro Devices, Inc. | ||
| # | ||
| # 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 | ||
|
|
||
| cmake_minimum_required(VERSION 3.24) | ||
|
|
||
| project(fusilli-plugin | ||
| VERSION 0.1.0 | ||
| DESCRIPTION "Fusilli-Plugin: A Fusilli/IREE powered hipDNN plugin for graph JIT compilation." | ||
| LANGUAGES C CXX) | ||
|
|
||
| # Set C++ standard | ||
| set(CMAKE_C_STANDARD 11) | ||
| set(CMAKE_CXX_STANDARD 20) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| set(CMAKE_CXX_SCAN_FOR_MODULES OFF) | ||
|
|
||
| # CMake includes | ||
| include(GNUInstallDirs) | ||
| include(FetchContent) | ||
|
|
||
| # IREE Runtime Dependency - build from source, same pattern as fusilli/CMakeLists.txt | ||
| if(NOT IREE_SOURCE_DIR) | ||
| message(FATAL_ERROR "IREE_SOURCE_DIR must be provided. Set -DIREE_SOURCE_DIR=<path> to the IREE source directory.") | ||
| endif() | ||
| message(STATUS "Using existing IREE sources: ${IREE_SOURCE_DIR}") | ||
| # Set IREE build flags | ||
| set(IREE_VISIBILITY_HIDDEN OFF) | ||
| set(IREE_BUILD_COMPILER OFF) | ||
| set(IREE_BUILD_TESTS OFF) | ||
| set(IREE_BUILD_SAMPLES OFF) | ||
| set(IREE_ERROR_ON_MISSING_SUBMODULES OFF) | ||
| set(IREE_HAL_DRIVER_DEFAULTS OFF) | ||
| set(IREE_HAL_DRIVER_HIP ON) | ||
| set(IREE_HIP_TEST_TARGET_CHIP "" CACHE STRING "") | ||
| # Build IREERuntime as part of plugin | ||
| FetchContent_Declare( | ||
| IREERuntime | ||
| SOURCE_DIR ${IREE_SOURCE_DIR} | ||
| # Fusilli's config file requires IREE runtime via | ||
| # find_dependency(IREERuntime), which triggers find_package(IREERuntime). The | ||
| # dependency can only be fulfilled via source build: FetchContent_Declare or | ||
| # add_subdirectory. Of those options, only FetchContent_Declare provides a way | ||
| # of intercepting the find_package call and redirecting to the source build. | ||
| OVERRIDE_FIND_PACKAGE | ||
| SYSTEM | ||
| ) | ||
| FetchContent_MakeAvailable(IREERuntime) | ||
|
|
||
| # Other dependencies | ||
| find_package(hip CONFIG REQUIRED) | ||
| find_package(hipdnn_data_sdk CONFIG REQUIRED) | ||
| find_package(hipdnn_plugin_sdk CONFIG REQUIRED) | ||
| find_package(hipdnn_frontend CONFIG REQUIRED) | ||
| find_package(hipdnn_test_sdk CONFIG REQUIRED) | ||
| find_package(Fusilli CONFIG REQUIRED) | ||
| # Fetch GTest if system install isn't available | ||
| find_package(GTest CONFIG QUIET) | ||
| if(NOT GTest_FOUND) | ||
| message(STATUS "GTest not found on system: Fetching from GitHub") | ||
| FetchContent_Declare( | ||
| googletest | ||
| QUIET | ||
| GIT_REPOSITORY https://github.com/google/googletest.git | ||
| GIT_TAG v1.16.0 | ||
| ) | ||
| FetchContent_MakeAvailable(googletest) | ||
| endif() | ||
|
|
||
|
|
||
| # Global constants | ||
| set(FUSILLI_PLUGIN_TARGET fusilli_plugin) | ||
| # Relative path from build/install prefix to plugin location. | ||
| # HIPDNN_PLUGIN_ENGINE_SUBDIR is provided by hipdnn_sdk. | ||
| set(FUSILLI_PLUGIN_RELATIVE_PATH "${CMAKE_INSTALL_LIBDIR}/${HIPDNN_PLUGIN_ENGINE_SUBDIR}") | ||
|
|
||
| # Useful compile warnings | ||
| list(PREPEND FUSILLI_PLUGIN_WARNING_COMPILE_OPTIONS | ||
| -Werror # Treat all warnings as errors | ||
| -Wall # Enable most common warnings | ||
| -Wextra # Enable additional warnings not covered by -Wall | ||
| -Wpedantic # Enforce strict ISO C++ compliance | ||
| -Wshadow # Warn about variable shadowing | ||
| -Wnon-virtual-dtor # Warn if a class with virtual functions has a non-virtual destructor | ||
| -Wold-style-cast # Warn about C-style casts | ||
| -Wcast-align # Warn about potential performance issues with misaligned casts | ||
| -Woverloaded-virtual # Warn if a base class function is hidden by a derived class function with the same name | ||
| -Wconversion # Warn about implicit type conversions that may alter a value | ||
| -Wsign-conversion # Warn about implicit conversions between signed and unsigned types | ||
| -Wnull-dereference # Warn about dereferencing null pointers | ||
| -Wdouble-promotion # Warn when a float is implicitly promoted to a double | ||
| -Wformat=2 # Enable stricter format string checks | ||
| -Winit-self # Warn about variables initialized with itself | ||
| -Wunreachable-code # Warn about unreachable code | ||
| -Wno-error=unused-command-line-argument # Disable error for unused command line arguments | ||
| -Wno-gnu-statement-expression # Disable gnu error for statement expression, this will need to change on Windows. | ||
| -Wswitch-default # Warn if a switch statement does not have a default case | ||
| ) | ||
|
|
||
| # Includes | ||
| include_directories(include) | ||
|
|
||
| # Plugin definition | ||
| add_library(${FUSILLI_PLUGIN_TARGET} SHARED | ||
| src/fusilli_plugin.cpp | ||
| ) | ||
| target_compile_options(${FUSILLI_PLUGIN_TARGET} PRIVATE ${FUSILLI_PLUGIN_WARNING_COMPILE_OPTIONS}) | ||
| target_link_libraries(${FUSILLI_PLUGIN_TARGET} PRIVATE hipdnn_plugin_sdk hipdnn_data_sdk hip::host fusilli::fusilli) | ||
| set_target_properties(${FUSILLI_PLUGIN_TARGET} PROPERTIES | ||
| C_VISIBILITY_PRESET hidden | ||
| CXX_VISIBILITY_PRESET hidden | ||
| VISIBILITY_INLINES_HIDDEN ON | ||
| LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${FUSILLI_PLUGIN_RELATIVE_PATH}" | ||
| ) | ||
| # Version script hides all symbol definitions not staring with "hipdnn" | ||
| target_link_options( | ||
| ${FUSILLI_PLUGIN_TARGET} PRIVATE "LINKER:--version-script=${CMAKE_SOURCE_DIR}/exports.map" | ||
| ) | ||
|
|
||
| # Installation | ||
| install(TARGETS ${FUSILLI_PLUGIN_TARGET} | ||
| LIBRARY DESTINATION "${FUSILLI_PLUGIN_RELATIVE_PATH}" | ||
| ) | ||
|
|
||
| # Tests | ||
| enable_testing() | ||
| add_subdirectory(test) |
This file contains hidden or 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,7 @@ | ||
| # Fusilli Plugin | ||
|
|
||
| Fusilli-Plugin: A Fusilli/IREE powered hipDNN plugin for graph JIT compilation. | ||
|
|
||
| :construction: **This project is under active development, many things don't work yet** :construction: | ||
|
|
||
| The plugin builds as a shared library (`fusilli_plugin.so`) providing a `hipDNN` [kernel engine plugin](https://github.com/ROCm/hipDNN/blob/develop/docs/PluginDevelopment.md#creating-a-kernel-engine-plugin) [API](https://github.com/ROCm/hipDNN/blob/839cf6c4bc6fe403d0ef72cb5d7df004e2004743/sdk/include/hipdnn_sdk/plugin/EnginePluginApi.h). | ||
|
AaronStGeorge marked this conversation as resolved.
Outdated
|
||
134 changes: 134 additions & 0 deletions
134
dnn-providers/fusilli-provider/build_tools/FusilliPluginTestUtils.cmake
This file contains hidden or 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,134 @@ | ||
| # Copyright 2025 Advanced Micro Devices, Inc. | ||
| # | ||
| # 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 | ||
|
|
||
| #===------------------------------------------------------------------------===# | ||
| # | ||
| # This file contains test utilities for Fusilli's hipDNN plugin. | ||
| # | ||
| # TheRock CI generates test, lib, dbg, etc. artifacts from the build - CI tests | ||
| # are run on separate runners using a downloaded version of a project's test | ||
| # artifacts. This approach allows the build to use a cheaper CPU-only machine, | ||
| # and the tests for each project to run in parallel on more expensive GPU | ||
| # machines (after the build has completed). | ||
| # | ||
| # In TheRock the pattern is to install tests as well as a generated CTest script | ||
| # in the test artifact. When the artifact is downloaded to an isolated runner, | ||
| # CTest can simply be pointed at the generated script + pre-built tests. | ||
| # | ||
| # This file provides `add_fusilli_plugin_test()` to wrap up boilerplate for test | ||
| # setup + test installation + test script generation. | ||
| # | ||
| #===------------------------------------------------------------------------===# | ||
|
|
||
| include(GoogleTest) | ||
|
|
||
| # Set up the installed CTestTestfile.cmake. We add a ".install" postfix to | ||
| # differentiate from CTestTestfile.cmake generated by GTest during the build. | ||
| # Note: we can't simply use the GTest version as the paths are absolute, the | ||
| # test script will need to be installed (and therefore relocated) so must use | ||
| # relative paths. | ||
| set(_FUSILLI_PLUGIN_INSTALLED_CTEST_FILE "${CMAKE_CURRENT_BINARY_DIR}/CTestTestfile.cmake.install") | ||
|
|
||
| file(WRITE "${_FUSILLI_PLUGIN_INSTALLED_CTEST_FILE}" | ||
| "# Autogenerated CTestTestfile for installed fusilli-plugin tests\n" | ||
| "# Generated by fusilli-plugin build system\n\n" | ||
| ) | ||
|
|
||
| install( | ||
| FILES "${_FUSILLI_PLUGIN_INSTALLED_CTEST_FILE}" | ||
| DESTINATION "${CMAKE_INSTALL_BINDIR}/fusilli_plugin_test_infra" | ||
| RENAME CTestTestfile.cmake | ||
| ) | ||
|
|
||
| # Creates a fusilli plugin test. | ||
| # | ||
| # To support build configurations (such as TheRock) that require tests to run on | ||
| # a different machine from where they were built, add_fusilli_plugin_test builds | ||
| # and _installs_ tests + CTest runner scripts | ||
| # | ||
| # add_fusilli_plugin_test( | ||
| # NAME <test-name> | ||
| # SRCS <file> [<file> ...] | ||
| # DEPS <dep> [<dep> ...] | ||
| # [COMPILE_DEFS <def> [<def> ...]] | ||
| # ) | ||
| # | ||
| # NAME | ||
| # The name of the test executable (required). | ||
| # | ||
| # SRCS | ||
| # Source files to compile into the executable (required). | ||
| # | ||
| # DEPS | ||
| # Library dependencies to be linked to this target. | ||
| # | ||
| # COMPILE_DEFS | ||
| # Compile definitions to add to the target. | ||
| function(add_fusilli_plugin_test) | ||
| cmake_parse_arguments( | ||
| ARG # prefix | ||
| "" # options | ||
| "NAME" # one value keywords | ||
| "SRCS;DEPS;COMPILE_DEFS" # multi-value keywords | ||
| ${ARGN} # extra arguments | ||
| ) | ||
|
|
||
| if(NOT DEFINED ARG_NAME) | ||
| message(FATAL_ERROR "add_fusilli_plugin_test: NAME is required") | ||
| endif() | ||
|
|
||
| if(NOT DEFINED ARG_SRCS) | ||
| message(FATAL_ERROR "add_fusilli_plugin_test: SRCS is required") | ||
| endif() | ||
|
|
||
| # Create executable | ||
| add_executable(${ARG_NAME} ${ARG_SRCS}) | ||
|
|
||
| # When installed all tests are at the same level in the file hierarchy, ensure | ||
| # tests are at the same level in the build directory as well | ||
| set_target_properties(${ARG_NAME} PROPERTIES | ||
| RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/test" | ||
| ) | ||
|
|
||
| # Set compile options | ||
| target_compile_options(${ARG_NAME} PRIVATE ${FUSILLI_PLUGIN_WARNING_COMPILE_OPTIONS}) | ||
|
|
||
| # Link dependencies | ||
| target_link_libraries(${ARG_NAME} PRIVATE ${ARG_DEPS}) | ||
|
|
||
| # Add compile definitions if provided | ||
| if(DEFINED ARG_COMPILE_DEFS) | ||
| target_compile_definitions(${ARG_NAME} PRIVATE ${ARG_COMPILE_DEFS}) | ||
| endif() | ||
|
|
||
| # Register with CTest | ||
| gtest_discover_tests(${ARG_NAME} | ||
| PROPERTIES | ||
| ENVIRONMENT "HIPDNN_LOG_LEVEL=info" | ||
| ENVIRONMENT "FUSILLI_LOG_INFO=1" | ||
| ENVIRONMENT "FUSILLI_LOG_FILE=stdout" | ||
| ) | ||
|
|
||
| # Install test executable | ||
| install(TARGETS ${ARG_NAME} | ||
| RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
| ) | ||
|
|
||
| # Append to installed CTestTestfile.cmake. Paths are relative as tests get | ||
| # relocated on install. | ||
| file(APPEND "${_FUSILLI_PLUGIN_INSTALLED_CTEST_FILE}" | ||
| "add_test(${ARG_NAME} \"../${ARG_NAME}\")\n" | ||
| ) | ||
| file(APPEND "${_FUSILLI_PLUGIN_INSTALLED_CTEST_FILE}" | ||
| "\n# Set environment variables\n" | ||
| "set_tests_properties(${ARG_NAME}\n" | ||
| " PROPERTIES\n" | ||
| " ENVIRONMENT \"HIPDNN_LOG_LEVEL=info\"\n" | ||
| " ENVIRONMENT \"FUSILLI_LOG_INFO=1\"\n" | ||
| " ENVIRONMENT \"FUSILLI_LOG_FILE=stdout\"\n" | ||
| ")\n" | ||
| ) | ||
| endfunction() |
This file contains hidden or 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,8 @@ | ||
| /* | ||
| * Version script for fusilli_plugin | ||
| * Export only the hipDNN plugin interface symbols | ||
| */ | ||
| { | ||
| global: hipdnn*; | ||
| local: *; | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.