#!/usr/bin/make -f FEATURE_CHECK := $(if $(filter nocheck,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)),OFF,ON) FEATURE_INSTTEST := $(if $(filter noinsttest,$(DEB_BUILD_PROFILES)),OFF,ON) export CXX=hipcc export CC=hipcc export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto export DEB_CXXFLAGS_MAINT_PREPEND = -gz export DPKG_GENSYMBOLS_CHECK_LEVEL=4 # -Wl,--gc-sections: # Fixes linker errors ("relocation refers to a discarded section") when using gtest. # The linker's section garbage collection incorrectly discards needed code due to # a toolchain mismatch (ROCm's clang vs. the system's GCC). This flag forces the # linker to correctly re-evaluate dependencies, keeping the required sections. export DEB_LDFLAGS_MAINT_PREPEND = -Wl,--gc-sections export VERBOSE=1 export TENSILE_ROCM_ASSEMBLER_PATH=/usr/bin/clang++ export TENSILE_ROCM_OFFLOAD_BUNDLER_PATH=/usr/bin/clang-offload-bundler export PATH:=$(PATH):/usr/lib/llvm-22/bin #export AMD_LOG_LEVEL=4 #--merge-architectures --no-lazy-library-loading DEBUG_FLAGS=-DCMAKE_FIND_DEBUG_MODE=ON DEBUG_FLAGS= CXXFLAGS := $(subst -fstack-protector-strong,-Xarch_host -fstack-protector-strong,$(CXXFLAGS)) CXXFLAGS := $(subst -fcf-protection,-Xarch_host -fcf-protection,$(CXXFLAGS)) GPU_TARGETS := "$(shell rocm-target-arch --sep ';')" CMAKE_FLAGS = \ -DROCTX_PATH=/usr/lib/$(DEB_HOST_MULTIARCH) \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_SKIP_INSTALL_RPATH=ON \ -DROCM_SYMLINK_LIBS=OFF \ -DBUILD_CLIENTS_BENCHMARKS=$(FEATURE_INSTTEST) \ -DBUILD_FILE_REORG_BACKWARD_COMPATIBILITY=OFF \ -DGPU_TARGETS=$(GPU_TARGETS) \ -DBUILD_WITH_HIPBLASLT=OFF \ -DROCBLAS_TENSILE_LIBRARY_DIR=/usr/lib/$(DEB_HOST_MULTIARCH)/rocblas/5 \ -DINSTALL_TEST_DATA_DIR=/usr/share/librocblas5-tests/data \ -DTensile_COMPILER=hipcc \ -DTensile_TEST_LOCAL_PATH="../tensile" \ -DTensile_ROOT="$(CURDIR)/tensile/Tensile" \ -DTensile_LOGIC=asm_full \ -DTensile_LIBRARY_FORMAT=msgpack \ -DTensile_LAZY_LIBRARY_LOADING=ON \ -DTensile_SEPARATE_ARCHITECTURES=ON \ -DBUILD_CLIENTS_TESTS=$(if $(filter ON,$(FEATURE_CHECK) $(FEATURE_INSTTEST)),ON,OFF) \ $(DEBUG_FLAGS) \ -DBUILD_WITH_PIP=false \ -DOptions=--ignore-asm-cap-cache \ -DRUN_HEADER_TESTING=OFF \ -DBUILD_OFFLOAD_COMPRESS=ON %: dh $@ override_dh_auto_configure-arch: dh_auto_configure -- $(CMAKE_FLAGS) # strip cannot handle code object files override_dh_strip-arch: dh_strip --exclude=.hsaco --exclude=.co override_dh_dwz-arch: : # note: openblas crashes in dot for complex values with M=128, N=800000, incx=-3, incy=-3 override_dh_auto_test-arch: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) set -e \ ; if [ -r /dev/kfd ] \ ; then obj-$(DEB_HOST_GNU_TYPE)/clients/staging/rocblas-test \ --gtest_filter="*checkin*:-*known_bug*" \ ; else echo "W: /dev/kfd unreadable: no available AMD GPU." \ ; echo "W: tests skipped." \ ; fi endif override_dh_auto_configure-indep: : override_dh_auto_build-indep: ifeq ($(FEATURE_INSTTEST),ON) python3 clients/common/rocblas_gentest.py -I clients/include clients/gtest/rocblas_gtest.yaml -o rocblas_gtest.data endif execute_after_dh_auto_build-indep: export http_proxy=127.0.0.1:9 execute_after_dh_auto_build-indep: export https_proxy=127.0.0.1:9 execute_after_dh_auto_build-indep: ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) rocm-docs-build endif override_dh_auto_test-indep: : override_dh_auto_install-indep: : override_dh_gencontrol: dh_gencontrol -- -Vrocm:GPU-Architecture="$(shell rocm-target-arch)"