#! /usr/bin/make -f export CC=clang export CXX=clang++ export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto export DEB_CXXFLAGS_MAINT_PREPEND = -gz export VERBOSE=1 export DPKG_GENSYMBOLS_CHECK_LEVEL = 4 export PATH:=/usr/lib/llvm-22/bin:$(PATH) #export AMD_LOG_LEVEL=4 ##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)) ifdef CCACHE_DIR CMAKE_CACHE_FLAGS = \ -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache CCACHE=ccache endif CMAKE_FLAGS = \ -DCMAKE_BUILD_TYPE=Release \ $(CMAKE_CACHE_FLAGS) # From TheRock build/logs/hipBLASLt_configure.log CMAKE_FLAGS += \ -DHIP_PLATFORM=$(shell hipconfig --platform) CMAKE_FLAGS += \ -DUSE_SYSTEM_NANOBIND=ON \ -DDEBIAN_MUT=ON # Filter out GPU targets that are broken (gfx942) and unsupported (gfx1030) # and tensilelite missing gfx950 # tensilelite Unsupported GPU target: gfx803 # tensilelite Unsupported GPU target: gfx900 # tensilelite Unsupported GPU target: gfx906 # tensilelite Unsupported GPU target: gfx1010 GPU_TARGETS_FILTERED := "$(shell rocm-target-arch --sep "\n" | grep -vE "(gfx803|gfx900|gfx906|gfx942|gfx1010|gfx1030|gfx950)" | tr '\n' ';' | sed 's/;$$//')" CMAKE_FLAGS += \ -DGPU_TARGETS=$(GPU_TARGETS_FILTERED) # rocRoller not packaged yet CMAKE_FLAGS += \ -DHIPBLASLT_ENABLE_ROCROLLER=OFF \ -DHIPBLASLT_USE_ROCROLLER=OFF # rocTracer not packaged yet CMAKE_FLAGS += \ -DHIPBLASLT_ENABLE_MARKER=OFF # blis/tests FLAGS CMAKE_FLAGS += \ -DHIPBLASLT_ENABLE_BLIS=ON \ -DTENSILELITE_BUILD_TESTING=ON # blas/lapack FLAGS (cf install.sh) CMAKE_FLAGS += \ -DBLAS_LIBRARIES=/usr/lib/$(DEB_HOST_MULTIARCH)/blas/libblas.a \ -DLAPACK_LIBRARIES='/usr/lib/$(DEB_HOST_MULTIARCH)/lapack/liblapack.a;/usr/lib/$(DEB_HOST_MULTIARCH)/blas/libblas.a' \ -DBLA_STATIC=ON ifeq (,$(filter noinsttest,$(DEB_BUILD_PROFILES))) CMAKE_FLAGS += \ -DHIPBLASLT_BUILD_TESTING=ON \ -DCMAKE_CXX_FLAGS="-I/usr/src/googletest/googlemock/include" \ -DCMAKE_C_FLAGS="-I/usr/src/googletest/googlemock/include" endif %: dh $@ -Scmake override_dh_auto_configure-arch: dh_auto_configure -- $(CMAKE_FLAGS) override_dh_strip-arch: dh_strip --exclude=.hsaco --exclude=.co --no-automatic-dbgsym override_dh_dwz-arch: override_dh_auto_test-arch: ifeq (,$(filter noinsttest,$(DEB_BUILD_OPTIONS))) set -e \ ; if [ -r /dev/kfd ] \ ; then obj-$(DEB_HOST_MULTIARCH)/clients/hipblaslt-test \ --gtest_filter="*quick*" \ ; else echo "W: /dev/kfd unreadable: no available AMD GPU." \ ; echo "W: tests skipped." \ ; fi endif execute_before_dh_install-arch: override_dh_auto_configure-indep: 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 # Fix privacy find build/html -name data-type-support.html \ -exec perl -ni -e 'print unless /cdn\.jsdelivr\.net/' {} \; find build/html -name what-is-hipBLASLt.html \ -exec perl -ni -e 'print unless /cdn\.jsdelivr\.net/' {} \; # Remove build path in some html files find build/html -type f -name '*.html' -exec sed -i 's|$(CURDIR)/||g' {} + endif override_dh_auto_test-indep: override_dh_auto_install-indep: LIB=libhipblaslt1 LIBV=$(shell head -1 debian/changelog | sed 's/.*(\(.*\)-.*).*$$/\1/') REV=$(shell head -1 debian/changelog | sed 's/.*(.*-\(.*\)).*$$/\1/') gensymbols: rm -rf /tmp/libhipblaslt1 dpkg-deb -x ../$(LIB)_$(LIBV)-$(REV)_amd64.deb /tmp/$(LIB) dpkg-gensymbols -v$(LIBV) -p$(LIB) -P/tmp/$(LIB) -Odebian/$(LIB).symbols #Add "* Build-Depends-Package: libhipblaslt-dev" on line 2 #sed -i '2i * Build-Depends-Package: libhipblaslt-dev' debian/$(LIB).symbols override_dh_gencontrol: dh_gencontrol -- -Vrocm:GPU-Architecture=$(subst ;, ,$(GPU_TARGETS_FILTERED))