at master 73 lines 1.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchpatch, 5 cmake, 6 python3, 7 rocm-merged-llvm, 8 rocm-device-libs, 9 zlib, 10 zstd, 11 libxml2, 12}: 13 14let 15 llvmNativeTarget = 16 if stdenv.hostPlatform.isx86_64 then 17 "X86" 18 else if stdenv.hostPlatform.isAarch64 then 19 "AArch64" 20 else 21 throw "Unsupported ROCm LLVM platform"; 22in 23stdenv.mkDerivation (finalAttrs: { 24 pname = "rocm-comgr"; 25 # In-tree with ROCm LLVM 26 inherit (rocm-merged-llvm) version; 27 src = rocm-merged-llvm.llvm-src; 28 29 sourceRoot = "${finalAttrs.src.name}/amd/comgr"; 30 31 patches = [ 32 # [Comgr] Extend ISA compatibility 33 (fetchpatch { 34 sha256 = "sha256-dgow0kwSWM1TnkqWOZDRQrh5nuF8p5jbYyOLCpQsH4k="; 35 url = "https://github.com/GZGavinZhao/rocm-llvm-project/commit/a439e4f37ce71de48d4a979594276e3be0e6278f.patch"; 36 relative = "amd/comgr"; 37 }) 38 #[Comgr] Extend ISA compatibility for CCOB 39 (fetchpatch { 40 sha256 = "sha256-6Rwz12Lk4R2JK3olii3cr2Zd0ZLYe7VSpK1YRCOsJWY="; 41 url = "https://github.com/GZGavinZhao/rocm-llvm-project/commit/2d8c459a4d4c0567a7a275b4b54560d88e5c6919.patch"; 42 relative = "amd/comgr"; 43 }) 44 ]; 45 46 nativeBuildInputs = [ 47 cmake 48 python3 49 ]; 50 51 buildInputs = [ 52 rocm-device-libs 53 libxml2 54 zlib 55 zstd 56 rocm-merged-llvm 57 ]; 58 59 cmakeFlags = [ 60 "-DCMAKE_VERBOSE_MAKEFILE=ON" 61 "-DCMAKE_BUILD_TYPE=Release" 62 "-DLLVM_TARGETS_TO_BUILD=AMDGPU;${llvmNativeTarget}" 63 ]; 64 65 meta = with lib; { 66 description = "APIs for compiling and inspecting AMDGPU code objects"; 67 homepage = "https://github.com/ROCm/ROCm-CompilerSupport/tree/amd-stg-open/lib/comgr"; 68 license = licenses.ncsa; 69 maintainers = with maintainers; [ lovesegfault ]; 70 teams = [ teams.rocm ]; 71 platforms = platforms.linux; 72 }; 73})