build: add amd hip sdk support for Windows #21595
No reviewers
Labels
No labels
avcodec
avdevice
avfilter
avformat
avutil
backport/release/4.3
backport/release/4.4
backport/release/5.0
backport/release/5.1
backport/release/6.0
backport/release/6.1
backport/release/7.0
backport/release/7.1
backport/release/8.0
backport/release/8.1
backport/release/9.0
backport/release/9.1
CLI
doc
Forgejo Fairy
swresample
swscale
vulkan
API
API major
bug
enhancement
fix/bug
fix/regression
GSoC
GSoC-Qualification
help wanted
important
LGTM
meta
needs backport
needs docs
needs fate test
needs info
needs sample
needs testing
new
question
regression
repro
flaky
repro
no
repro
no(env)
repro
yes
resolution
duplicate
resolution
external
resolution
fixed
resolution
invalid
resolution
wontfix
security
No milestone
No assignees
6 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
FFmpeg/FFmpeg!21595
Loading…
Reference in a new issue
No description provided.
Delete branch "younengxiao/FFmpeg:build/add-amd-hip-sdk-support-for-windows"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add support for AMD's HIP (Heterogeneous-compute Interface for Portability)
SDK on Windows, enabling GPU-accelerated video processing on AMD GPUs.
This commit introduces the build infrastructure for HIP, similar to the
existing CUDA support. HIP allows writing portable GPU code that can run
on AMD GPUs with RDNA2 architecture or newer.
Build Instructions (MSYS2 MinGW):
Install MSYS2 from https://www.msys2.org/
Install AMD HIP SDK from:
https://www.amd.com/en/developer/resources/rocm-hub/hip-sdk.html
Default installation path: C:\Program Files\AMD\ROCm<version>
Ensure hipcc is available: C:\Program Files\AMD\ROCm<version>\bin\hipcc.bat
Add HIP SDK to PATH (in MSYS2 terminal):
export PATH="/c/Program Files/AMD/ROCm/6.4/bin:$PATH"
(Adjust version number as needed)
Configure and Build:
./configure --enable-hip --enable-nonfree
make -j
Note: The default target architecture is gfx900. To target a specific
GPU architecture, use --hipccflags="--offload-arch=" where
is your GPU's architecture code (e.g., gfx1030 for RDNA2, gfx1100 for RDNA3).
External Dependencies:
Header files:
- hip/hip_runtime.h (from HIP SDK, or compat/hip/hip_runtime.h)
Tools:
- hipcc (HIP compiler, from AMD HIP SDK)
Runtime:
- AMD GPU driver with ROCm/HIP support
- amdhip64.dll (HIP runtime library)
Notes:
HIP enables GPU-accelerated code that can run on AMD GPUs.
The --enable-hip option enables the hipcc compiler for building
GPU kernels (.hip files) into GPU code objects (.hsaco files).
HIP support provides infrastructure for GPU-accelerated filters.
Actual GPU filters must implement HIP kernels similar to existing
CUDA filters (scale_cuda, yadif_cuda, etc.).
35ffe9f2a58cc0583eb9Shader Compression unified both cuda and vulkan ones already.
So you don't need to re-add yet another one for this.
Also, this is at least missing the vpath handling in the makefiles, so it most likely breaks out-of-tree builds.
8cc0583eb9295b6c2cc9a706bb5312253079cf93253079cf93816ff702fa@BtbN wrote in #21595 (comment):
@BtbN Changed from CONFIG_HSACO_COMPRESSION to CONFIG_SHADER_COMPRESSION in ffbuild/common.mak to align with cuda and vulkan.
Also, add vpath handling for out-of-tree builds in Makefile.
@ -0,0 +1,91 @@Building FFmpeg with AMD HIP SDK Support (Windows)This entire file is redundant with the addition in general_contents.texi. Should be removed.
The file "general_contents.texi" was removed.
For posterity's sake, actually the file
doc/build_with_hip_sdk.txtwas removed, notdoc/general_contents.texiYes, the file "doc/build_with_hip_sdk.txt" was removed, which is the actual we decided to remove. :)
Please ensure a thorough manual review of all AI-generated code before submission. Document on how to use pacman to install gcc and make in commit message is far from necessary, and add an option const named 8 with value 8 is unnecessary.
AI-generated code tends to be verbose; it requires the developer's own judgment and cleanup.
@ -7069,0 +7124,4 @@hipccflags="$hipccflags -std=c++17"if enabled x86_64 || enabled ppc64 || enabled aarch64; thenHas it actually been verified on a PPC64 machine?
Verified on "x86_64" architecture, but not PPC64. Removed the other options.
@quink wrote in #21595 (comment):
@quink Please take a reference of this document https://github.com/GPUOpen-LibrariesAndSDKs/AMF/wiki/Build%20FFmpeg%20with%20AMF%20Support#3-build-ffmpeg-with-amf-for-windows. This document was created by me 4 years ago. I did the work step by step, then summarize this document. From my practice, those steps such as using pacman to install dependent packages are necessary. This is not related AI or human. This is really my experience and my practices.
Maybe for some people, this is not necessary, and take it as a common knowledge.
If reviewer think "using pacman to install dependent packages" is not necessary, of course I'd like to delete this part.
@younengxiao wrote in #21595 (comment):
I am sorry for the misunderstanding. I never realized there were developers who couldn't distinguish between a wiki page and a git commit message.
@quink wrote in #21595 (comment):
For some modules, if the build steps are complicated, it is a good idea to put the build steps into the commit message. This will help people who want to build ffmpeg on their own. Please take reference this pull request
f4e0664fd1. I have suffered to take long time to find way to build some specific ffmpeg modules. This is the reason I also the reason I put the build steps in the commit message, and I also post page https://github.com/GPUOpen-LibrariesAndSDKs/AMF/wiki/Build%20FFmpeg%20with%20AMF%20Support.816ff702fa7d950339ea@quink wrote in #21595 (comment):
As suggested, removed the commit message part which uses pacman to install dependent packages.
@younengxiao wrote in #21595 (comment):
In fact, I believe you've just provided a bad case. The commit message should be clear and concise, explaining the purpose of this commit and what specific actions were taken.
No one would look up how to compile and set up the environment via Git commit messages.
The commit message is not a place for end-user guidance. It should just describe the changes made and why.
I don't agree we should add support for this.
Unlike CUDA, which has plenty of users, as well as a whole ecosystem with decoders, encoders and filters, HIP would only be usable for filters. Our OpenCL code is already bitrotting after no one's touched it for years.
Furthermore, Vulkan covers all the hardware that HIP supports, is more open, and more available.
@GyanD @quink @mypopydev Thanks for the discussion about commit message. and we reach agreement what commit message should be. That makes sense 👍.
@Lynne wrote in #21595 (comment):
I understand your concern about the scope and ecosystem of HIP at current time, and I respect your final decision.
Pull request closed