{ lib , stdenv , fetchFromGitHub , writeScript , fetchpatch , cmake , rocm-cmake , rocm-runtime , rocm-device-libs , rocm-comgr , hip , python3 , tensile , msgpack , libxml2 , llvm , gtest , gfortran , python3Packages , buildTensile ? true , buildTests ? false , buildBenchmarks ? false , tensileLogic ? "asm_full" , tensileCOVersion ? "V3" , tensileSepArch ? true , tensileLazyLib ? true , tensileLibFormat ? "msgpack" , gpuTargets ? [ "all" ] }: stdenv.mkDerivation (finalAttrs: { pname = "rocblas"; version = "5.3.3"; src = fetchFromGitHub { owner = "ROCmSoftwarePlatform"; repo = "rocBLAS"; rev = "rocm-${finalAttrs.version}"; hash = "sha256-z40WxF+suMeIZihBWJPRWyL20S2FUbeZb5JewmQWOJo="; }; # We currently need this patch due to faulty toolchain includes # See: https://github.com/ROCmSoftwarePlatform/rocBLAS/issues/1277 patches = [ (fetchpatch { name = "only-std_norm-from-rocblas_complex.patch"; url = "https://github.com/ROCmSoftwarePlatform/rocBLAS/commit/44b99c6df26002139ca9ec68ee1fc8899c7b001f.patch"; hash = "sha256-vSZkVYY951fqfOThKFqnYBasWMblS6peEJZ6sFMCk9k="; }) ]; nativeBuildInputs = [ cmake rocm-cmake hip ]; buildInputs = [ rocm-runtime rocm-device-libs rocm-comgr python3 ] ++ lib.optionals buildTensile [ msgpack libxml2 llvm python3Packages.pyyaml python3Packages.msgpack ] ++ lib.optionals buildTests [ gtest gfortran ]; cmakeFlags = [ "-DCMAKE_C_COMPILER=hipcc" "-DCMAKE_CXX_COMPILER=hipcc" "-Dpython=python3" "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" "-DBUILD_WITH_TENSILE=${if buildTensile then "ON" else "OFF"}" # Manually define CMAKE_INSTALL_