Files
TheRock/rocm-libraries/projects/hipblaslt/clients/common/CMakeLists.txt
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

79 lines
3.2 KiB
CMake
Executable File

# Copyright Advanced Micro Devices, Inc., or its affiliates.
# SPDX-License-Identifier: MIT
# Owns the `hipblaslt::mxdatagen` STATIC helper. The source and header live
# under this directory, so the target is defined here rather than at the root.
#
# This file is added by the project root via `add_subdirectory(clients/common)`
# only when:
# * HIPBLASLT_ENABLE_MXDATAGENERATOR is ON, and
# * at least one consumer subtree is enabled (HIPBLASLT_ENABLE_CLIENT,
# TENSILELITE_ENABLE_CLIENT, or TENSILELITE_BUILD_TESTING).
#
# Consumers should `target_link_libraries(<tgt> PUBLIC hipblaslt::mxdatagen)`
# (PRIVATE if no further consumer needs the macro). Linking propagates:
# * the include path for `<mxDataGen.hpp>`
# * the link to `roc::mxDataGenerator`
# * the C++20 requirement
# * the `HIPBLASLT_ENABLE_MXDATAGENERATOR` macro
# * `hipblaslt::headers`, which carries the in-tree `<hipblaslt/...>` API
# headers (the source pulls in `<hipblaslt/hipblaslt-export.h>` and
# `<hipblaslt/hipblaslt-types.h>`).
if(NOT ROCM_LIBS_SUPERBUILD)
if(HIPBLASLT_ENABLE_THEROCK)
find_package(mxDataGenerator REQUIRED)
else()
# `${PROJECT_SOURCE_DIR}/../../shared/mxdatagenerator` resolves to the
# sibling `shared/mxdatagenerator` subtree of the project. The binary
# dir is anchored under the hipblaslt project's build tree to match
# the upstream subdirectory's existing layout assumptions.
add_subdirectory(
"${PROJECT_SOURCE_DIR}/../../shared/mxdatagenerator"
"${PROJECT_BINARY_DIR}/mxdatagenerator"
)
endif()
endif()
add_library(hipblaslt-mxdatagen STATIC
"${CMAKE_CURRENT_SOURCE_DIR}/src/mxDataGen.cpp"
)
add_library(hipblaslt::mxdatagen ALIAS hipblaslt-mxdatagen)
target_include_directories(hipblaslt-mxdatagen
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
target_link_libraries(hipblaslt-mxdatagen
PUBLIC
hipblaslt::headers
roc::mxDataGenerator
PRIVATE
# `-x hip` (via hip::device's INTERFACE_COMPILE_OPTIONS) makes the
# translation unit compile through hipcc/clang. mxDataGen.cpp itself
# does not launch kernels, but the modern ROCm bf16 header it pulls
# in transitively uses clang-only builtins (e.g. __builtin_elementwise_rint).
hip::device
)
target_compile_features(hipblaslt-mxdatagen PUBLIC cxx_std_20)
target_compile_definitions(hipblaslt-mxdatagen PUBLIC HIPBLASLT_ENABLE_MXDATAGENERATOR)
set_target_properties(hipblaslt-mxdatagen
PROPERTIES POSITION_INDEPENDENT_CODE ON
)
# `<hipblaslt/hipblaslt-export.h>` is generated by
# `library/include/CMakeLists.txt`'s `generate_export_header(hipblaslt ...)`
# call when HIPBLASLT_ENABLE_HOST=ON. In a tensilelite-only build that target
# does not exist, so produce the same file from this helper instead. Both
# code paths emit the file to the same location so `hipblaslt::headers`'s
# `${CMAKE_BINARY_DIR}/library/include` interface dir resolves it either way.
if(NOT HIPBLASLT_ENABLE_HOST)
include(GenerateExportHeader)
generate_export_header(hipblaslt-mxdatagen
BASE_NAME hipblaslt
EXPORT_FILE_NAME "${PROJECT_BINARY_DIR}/library/include/hipblaslt/hipblaslt-export.h"
)
endif()