feat: Add HSA_OVERRIDE_GFX_VERSION for newer AMD GPUs

This commit adds the `HSA_OVERRIDE_GFX_VERSION` environment variable to the `speedrun.sh` script. This is a workaround to enable support for newer AMD GPU architectures (e.g., gfx1151) that are not yet officially supported in the pre-compiled PyTorch ROCm builds.

This change also includes an update to the `README.md` to explain this workaround to users.
This commit is contained in:
google-labs-jules[bot] 2025-10-14 06:48:34 +00:00
parent 19fa71d6e5
commit 5a785854d1
2 changed files with 6 additions and 0 deletions

View File

@ -93,6 +93,8 @@ Before you begin, ensure you have the necessary drivers and toolkits installed f
- **NVIDIA GPUs:** You will need the NVIDIA driver and the CUDA Toolkit installed.
- **AMD GPUs:** You will need to install the ROCm platform.
**Note for newer AMD GPUs:** Some newer AMD GPU architectures (e.g., `gfx1151`) may not be officially supported by the pre-compiled PyTorch ROCm builds yet. If you encounter a `torch.AcceleratorError: HIP error: invalid device function` error, you can work around this by setting the `HSA_OVERRIDE_GFX_VERSION` environment variable to a compatible, supported architecture. For example, for `gfx1151`, you can use `11.0.0`. The `speedrun.sh` script includes this workaround by default.
### Python Dependencies
The Python dependencies are managed by `uv`. The project is configured to install a specific version of PyTorch that is compatible with your hardware.

View File

@ -12,6 +12,10 @@
# Default intermediate artifacts directory is in ~/.cache/nanochat
export OMP_NUM_THREADS=1
# For newer AMD GPUs that are not yet officially supported by PyTorch ROCm builds,
# we can override the detected GPU architecture to a compatible one.
# For example, for a gfx1151 GPU, we can use gfx1100 (11.0.0).
export HSA_OVERRIDE_GFX_VERSION=11.0.0
NANOCHAT_BASE_DIR="$HOME/.cache/nanochat"
mkdir -p $NANOCHAT_BASE_DIR