diff --git a/BUILD_TOPOLOGY.toml b/BUILD_TOPOLOGY.toml index aae9b93f896..c986f35def6 100644 --- a/BUILD_TOPOLOGY.toml +++ b/BUILD_TOPOLOGY.toml @@ -153,7 +153,8 @@ artifact_groups = [ "hip-runtime", "opencl-runtime", "profiler-core", - "rocrtst" + "rocrtst", + "rocjitsu" ] [build_stages.math-libs] @@ -327,6 +328,13 @@ type = "generic" artifact_group_deps = ["third-party-sysdeps", "base", "core-runtime", "hip-runtime"] source_sets = ["amd-mesa", "rocm-systems"] +[artifact_groups.rocjitsu] +description = "ROCm emulation, virtualization, and instrumentation tools" +type = "generic" +artifact_group_deps = [] +source_sets = ["rocm-systems"] +disable_platforms = ["windows"] + # ============================================================================== # ARTIFACTS - The actual build outputs that can be transmitted between stages # ============================================================================== @@ -777,3 +785,12 @@ type = "target-neutral" artifact_deps = ["amd-llvm", "amd-dbgapi", "sysdeps-gmp", "sysdeps-mpfr", "sysdeps-expat", "sysdeps-ncurses"] feature_group = "DEBUG_TOOLS" # Part of DEBUG_TOOLS, enabled by default via THEROCK_ENABLE_ALL disable_platforms = ["windows"] + +# --- ROCm Emulation Tools --- + +[artifacts.rocjitsu] +artifact_group = "rocjitsu" +type = "target-neutral" +artifact_deps = [] +feature_group = "EMULATION" +disable_platforms = ["windows"] diff --git a/CMakeLists.txt b/CMakeLists.txt index ef81dd4d578..c9d1f07ff86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -500,6 +500,8 @@ add_subdirectory(debug-tools) # Note that rocprofiler-register is in base and is what higher level clients # depend on. The profiler itself is independent. add_subdirectory(profiler) +# Emulation and instrumentation tools. +add_subdirectory(emulation) # Data center tools (RDC, etc.) add_subdirectory(dctools) add_subdirectory(comm-libs) diff --git a/build_tools/install_rocm_from_artifacts.py b/build_tools/install_rocm_from_artifacts.py index dbe9d045298..7e769cc162e 100644 --- a/build_tools/install_rocm_from_artifacts.py +++ b/build_tools/install_rocm_from_artifacts.py @@ -36,6 +36,7 @@ [--rccl | --no-rccl] [--rocdecode | --no-rocdecode] [--rocjpeg | --no-rocjpeg] + [--rocjitsu | --no-rocjitsu] [--rocprofiler-compute | --no-rocprofiler-compute] [--rocprofiler-sdk | --no-rocprofiler-sdk ] [--rocprofiler-systems | --no-rocprofiler-systems] @@ -360,6 +361,7 @@ def retrieve_artifacts_by_run_id(args): args.rccl, args.rocdecode, args.rocjpeg, + args.rocjitsu, args.rocprofiler_compute, args.rocprofiler_sdk, args.rocprofiler_systems, @@ -425,6 +427,9 @@ def retrieve_artifacts_by_run_id(args): argv.append("rocjpeg_test") argv.append("base_dev") argv.append("amd-llvm_dev") + if args.rocjitsu: + extra_artifacts.append("rocjitsu") + argv.append("rocjitsu_run") if args.hipblasltprovider: extra_artifacts.append("hipblasltprovider") if args.prim: @@ -747,6 +752,13 @@ def main(argv): action=argparse.BooleanOptionalAction, ) + artifacts_group.add_argument( + "--rocjitsu", + default=False, + help="Include 'rocjitsu' artifacts", + action=argparse.BooleanOptionalAction, + ) + artifacts_group.add_argument( "--hipblasltprovider", default=False, diff --git a/docs/development/installing_artifacts.md b/docs/development/installing_artifacts.md index 6617ca080ff..9704feb0105 100644 --- a/docs/development/installing_artifacts.md +++ b/docs/development/installing_artifacts.md @@ -43,6 +43,7 @@ Choose one of these options to specify where to install from: | `--rccl` | Flag | Include RCCL artifacts | | `--rocdecode` | Flag | Include rocDecode artifacts (Linux only) | | `--rocjpeg` | Flag | Include rocJPEG artifacts (Linux only) | +| `--rocjitsu` | Flag | Include rocjitsu artifacts (Linux only) | | `--rocwmma` | Flag | Include rocWMMA artifacts | | `--tests` | Flag | Include test artifacts for enabled components | diff --git a/emulation/CMakeLists.txt b/emulation/CMakeLists.txt new file mode 100644 index 00000000000..80cc1f486fc --- /dev/null +++ b/emulation/CMakeLists.txt @@ -0,0 +1,63 @@ +# Copyright Advanced Micro Devices, Inc. +# SPDX-License-Identifier: MIT + +# ROCm Emulation Tools + +if(THEROCK_ENABLE_ROCJITSU) + ############################################################################## + # rocjitsu + # + # ROCm Just-in-Time Suite: simulation, virtualization, and instrumentation + # tools for AMD GPU applications. Provides ISA-level execution of AMD GPU + # and RISC-V machine code from HIP fat binaries without requiring GPU + # hardware. + ############################################################################## + + if(EXISTS "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/emulation/rocjitsu/CMakeLists.txt") + set(_rocjitsu_source_dir "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/emulation/rocjitsu") + elseif(EXISTS "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/experimental/rocjitsu/CMakeLists.txt") + set(_rocjitsu_source_dir "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/experimental/rocjitsu") + else() + message(FATAL_ERROR "rocjitsu source directory not found under rocm-systems/emulation or rocm-systems/experimental") + endif() + + therock_cmake_subproject_declare(rocjitsu + USE_DIST_AMDGPU_TARGETS + EXTERNAL_SOURCE_DIR "${_rocjitsu_source_dir}" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/rocjitsu" + BACKGROUND_BUILD + CMAKE_ARGS + -DRJ_BUILD_GUI=OFF + -DBUILD_TESTING=${THEROCK_BUILD_TESTING} + ) + + therock_cmake_subproject_glob_c_sources(rocjitsu + SUBDIRS + lib + tools + tests + ) + + therock_cmake_subproject_activate(rocjitsu) + + therock_cmake_subproject_build_test(rocjitsu + COMMAND "${CMAKE_CTEST_COMMAND}" --output-on-failure --no-tests=error + ) + + therock_test_validate_shared_lib(PATH rocjitsu/dist/lib + LIB_NAMES + librocjitsu.so + ) + + therock_provide_artifact(rocjitsu + TARGET_NEUTRAL + DESCRIPTOR artifact-rocjitsu.toml + COMPONENTS + dbg + dev + lib + run + SUBPROJECT_DEPS + rocjitsu + ) +endif() diff --git a/emulation/artifact-rocjitsu.toml b/emulation/artifact-rocjitsu.toml new file mode 100644 index 00000000000..470fe8e9b21 --- /dev/null +++ b/emulation/artifact-rocjitsu.toml @@ -0,0 +1,8 @@ +# rocjitsu +[components.lib."emulation/rocjitsu/stage"] +[components.dbg."emulation/rocjitsu/stage"] +[components.dev."emulation/rocjitsu/stage"] +[components.run."emulation/rocjitsu/stage"] +include = [ + "share/rocjitsu/**", +]