RFC: Introducing "rocm-origin" module for streamlining rocm packaging
@x-KHauge and I recently streamlined the generation of new ROCm package descriptions by creating a centralized module for creating origin objects for the various ROCm components (llvm & friends, libraries, hip, etc). The motivation for this is to simplify the process of creating up-to-date ROCm packages in a way that is suitable for some level of automation. This is particularly helpful when implementing nightly builds of all ROCm development branches.
This is a request for feedback before submitting a merge request.
They way we have currently done this is by creating a separate module ("rocm-origin") which maps version/tags to specific hashes (and patches) through association lists using list-references. Doing it this way, we can greatly simplify our package descriptions by using an exported procedure to generate the origin information, e.g:
; rocr-runtime
(define (make-rocr-runtime roct-thunk rocm-device-libs lld-rocm clang-rocm)
(package
(name "rocr-runtime")
(version (package-version rocm-device-libs))
(source (rocm-origin name version))
(build-system cmake-build-system)
... ))
Behind the scenes, the procedure rocm-origin
uses name
and version
in a list-reference to extract hash and patch information:
(define (rocm-origin name version)
(origin
(method git-fetch)
(uri (git-reference
(url (string-append "https://github.com/ROCm/" name))
(commit (string-append "rocm-" version))))
(file-name (git-file-name name (string-append "rocm-" version)))
(sha256 (assoc-ref rocm-hashes (list name version)))
(patches (map search-patch
(let ((patch-list (assoc-ref rocm-patches (list name version))))
(if patch-list patch-list '()))))))
where rocm-hashes
and rocm-patches
are association lists defined as:
(define rocm-hashes
`(
...
(("rocr-runtime" "6.0.0") . ,(base32 "00hjznlrxxkkp1s8vq4id7vac6bynvz0f67ngs7d88q7kvvhdly4"))
(("rocr-runtime" "5.7.1") . ,(base32 "02g53357i15d8laxlhvib7h01kfarlq8hyfm7rm3ii2wgrm23c0g"))
(("rocr-runtime" "5.6.1") . ,(base32 "07wh7s1kgvpw8ydxmr2wvvn05fdqcmcc20qjbmnc3cbbhxviksyr"))
(("rocr-runtime" "5.5.1") . ,(base32 "0zhqlbnkq2w0zqdqiqk4l2mksy618fl0zivkp2h6f5pjfnishpw9"))
(("rocr-runtime" "5.4.4") . ,(base32 "09kpnfn5vpfcjh0amxbk1885hyib9jbisfmh2p9224cx156xfi16"))
(("rocr-runtime" "5.3.3") . ,(base32 "18hf3abq6g7hyxlkfzd61a661j8lxgq42nkarrs2x5491ny3p8fv"))
...
(define rocm-patches
`(
...
(("rocr-runtime" "6.0.0") . ("amd/packages/patches/rocr-runtime-5.5.patch"))
(("rocr-runtime" "5.7.1") . ("amd/packages/patches/rocr-runtime-5.5.patch"))
(("rocr-runtime" "5.6.1") . ("amd/packages/patches/rocr-runtime-5.5.patch"))
(("rocr-runtime" "5.5.1") . ("amd/packages/patches/rocr-runtime-5.5.patch"))
(("rocr-runtime" "5.4.4") . ("amd/packages/patches/rocr-runtime-5.3.3.patch"))
(("rocr-runtime" "5.3.3") . ("amd/packages/patches/rocr-runtime-5.3.3.patch"))
...