Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

🛡️ GPU Safety Check

A simple read-only GPU safety checker for AMD ROCm systems that detects potentially dangerous or unwanted HSA_OVERRIDE_GFX_VERSION settings before you start ComfyUI, AI workloads, or other ROCm applications.

Designed and tested around:

  • CachyOS / Arch Linux
  • Fish shell
  • AMD Radeon RX 9070 XT
  • RDNA 4
  • ROCm
  • Native GPU architecture: gfx1201
  • ComfyUI
  • Other ROCm/PyTorch workloads

Important

This version is configured specifically for an AMD Radeon RX 9070 XT (gfx1201).

Do not assume the expected architecture is correct for another GPU.


Why This Exists

Modern ROCm versions can detect supported AMD GPUs natively.

Older installation guides, startup scripts, AI tools, and troubleshooting instructions may still recommend setting:

HSA_OVERRIDE_GFX_VERSION=...

An architecture override tells ROCm/HSA to treat the GPU as a different architecture.

For example, forcing an RX 9070 XT / gfx1201 system to use:

HSA_OVERRIDE_GFX_VERSION=11.0.0

can cause serious GPU compute problems.

The goal of gpu-safety-check is simple:

Check first. Run the GPU workload second.

The checker is read-only. It reports potential problems but does not automatically change your system.


🔍 What It Checks

gpu-safety-check checks several places where an HSA architecture override could be introduced.

Current environment

Checks whether:

HSA_OVERRIDE_GFX_VERSION

is currently active.

Fish configuration

Checks:

  • Current Fish variables
  • Fish universal variables
  • Persistent user configuration

This is particularly important because a command such as:

set -Ux HSA_OVERRIDE_GFX_VERSION 11.0.0

creates a persistent Fish universal variable.

System and service configuration

Checks common system locations including:

/etc/environment
/etc/environment.d
/etc/profile
/etc/profile.d
/etc/systemd/system

This can identify service-specific overrides such as those used by systemd services.

Project launchers and configuration

When executed from a project directory, the checker searches for executable/configuration files capable of setting HSA_OVERRIDE_GFX_VERSION.

Examples include:

*.sh
*.fish
*.bash
*.zsh
*.env
*.service
*.conf

This is useful for detecting a bundled launcher containing something like:

export HSA_OVERRIDE_GFX_VERSION="${HSA_OVERRIDE_GFX_VERSION:-11.0.0}"

before you run it.

Python assignments

Python source files are checked for code capable of assigning the environment variable.

Code that merely reads the variable is not treated as an executable override.

Documentation references

README files, documentation and text files containing HSA_OVERRIDE_GFX_VERSION are reported separately as:

[INFO]

Documentation does not block the project by itself.

This distinction is important:

Documentation mentions an override     → INFO
Executable file sets an override       → FAIL

Native ROCm architecture

The checker uses:

rocminfo

to verify that the expected GPU architecture is visible.

For the RX 9070 XT configuration supplied with this project, the expected architecture is:

gfx1201

📦 Installation

1. Download or clone the repository

Clone the repository:

git clone <YOUR-REPOSITORY-URL>
cd <YOUR-REPOSITORY>

Or download the gpu-safety-check file manually.


2. Create your local bin directory

mkdir -p ~/.local/bin

3. Copy the checker

From inside the downloaded repository:

cp gpu-safety-check ~/.local/bin/gpu-safety-check

4. Make it executable

chmod +x ~/.local/bin/gpu-safety-check

5. Validate the Fish script

Before executing it:

fish -n ~/.local/bin/gpu-safety-check

If the command produces no output, the Fish syntax is valid.


6. Check your PATH

contains ~/.local/bin $PATH; and echo "OK: ~/.local/bin is in PATH"; or echo "WARNING: ~/.local/bin is NOT in PATH"

If it is not in your PATH:

fish_add_path ~/.local/bin

7. Verify the command

type -a gpu-safety-check

You should see something similar to:

gpu-safety-check is /home/username/.local/bin/gpu-safety-check

Installation is complete.


🚀 Usage

The checker can be run from anywhere:

gpu-safety-check

However, the directory from which you execute it matters because the current directory is also scanned as the project.

For example, to inspect ComfyUI:

cd ~/ComfyUI
gpu-safety-check

This checks both:

  1. Your current machine/environment state.
  2. The current ComfyUI project for files capable of introducing an HSA override.

You can do the same before using another ROCm project:

cd ~/My-AI-Project
gpu-safety-check

✅ Understanding the Result

A healthy RX 9070 XT system should ideally show:

CURRENT MACHINE STATE
  [PASS] HSA override              : UNSET
  [PASS] Fish persistent override  : NONE
  [PASS] Native ROCm GPU           : gfx1201

SYSTEM / SERVICES
  [PASS] Service overrides         : NONE

CURRENT PROJECT
  [PASS] Executable overrides      : NONE
  [PASS] Python assignments        : NONE

CURRENT GPU STATE: SAFE
PROJECT DEVELOPMENT: SAFE

🚨 Project Blocked

The checker can report:

CURRENT GPU STATE: SAFE
PROJECT DEVELOPMENT: BLOCKED

This distinction is intentional.

It means the GPU's current environment is safe, but the project contains executable code capable of setting HSA_OVERRIDE_GFX_VERSION.

For example:

[FAIL] Executable overrides : 3 references in 3 files

       /home/user/ComfyUI/example/start_api_server_rocm.sh
       /home/user/ComfyUI/example/start_gradio_ui_rocm.sh
       /home/user/ComfyUI/example/start_manual_rocm.sh

Your GPU is not necessarily in danger simply because these files exist.

The warning means:

Review the affected launcher before executing it.


⚠️ System / Service Warnings

You may see something like:

SYSTEM / SERVICES
  [WARN] Service overrides : 1 found

         /etc/systemd/system/example.service.d/override.conf

A systemd service environment does not necessarily affect your current terminal.

The checker therefore reports service configuration separately from the active environment.

Do not blindly delete service configuration.

Inspect it first and understand why the service uses the setting.


📊 Exit Codes

The checker returns a standard exit status that can also be used by scripts.

Exit Code Meaning
0 Safe
1 Safe with warnings
2 Active problem detected or project blocked

After running the checker in Fish:

gpu-safety-check
echo $status

Example:

0

means the check passed without warnings.


🔒 Safety Philosophy

This tool follows several deliberate rules.

Read-only by design

gpu-safety-check does not:

  • Remove environment variables
  • Modify Fish configuration
  • Modify systemd services
  • Modify project files
  • Change GPU clocks
  • Change power profiles
  • Write to sysfs
  • Change kernel parameters
  • Install or remove ROCm packages
  • Modify PyTorch
  • Automatically "fix" detected problems

It only inspects and reports.

No automatic HSA override

For the supported RX 9070 XT configuration, the desired state is:

HSA_OVERRIDE_GFX_VERSION = UNSET

with ROCm detecting:

gfx1201

natively.

Do not replace an unwanted override with another architecture override simply to make the checker pass.


🧪 Check Native GPU Detection Manually

You can inspect ROCm directly with:

rocminfo | grep -E 'gfx[0-9]+'

For the RX 9070 XT configuration targeted by this repository, you should see gfx1201.

The complete checker performs this verification automatically.


🐍 PyTorch Information

If PyTorch is available in the currently active Python environment, the checker displays information such as:

PyTorch   : 2.x.x+rocm
ROCm/HIP  : x.x
Available : True
GPU       : AMD Radeon RX 9070 XT

If you see:

PyTorch : Not installed in current Python environment

this does not automatically indicate a problem.

For example, you may simply be using:

/usr/bin/python

instead of the project's virtual environment.

The checker deliberately avoids running a heavy GPU compute test as part of its normal safety scan.


🛠️ Requirements

Recommended environment:

  • Linux

  • CachyOS / Arch Linux

  • Fish shell

  • AMD ROCm

  • rocminfo

  • Standard GNU utilities:

    • grep
    • find
    • xargs
    • realpath

Optional:

  • Python
  • PyTorch ROCm

🎯 Current GPU Target

This version is configured for:

Component Configuration
GPU AMD Radeon RX 9070 XT
Architecture RDNA 4
Native ROCm target gfx1201
Shell Fish
Primary OS CachyOS / Arch Linux
Workloads ComfyUI, PyTorch, ROCm AI applications

If you use another GPU, do not simply change the expected architecture without first verifying the native architecture reported by your ROCm installation.


🔎 Search Keywords / Repository Topics

Suggested GitHub repository topics:

amd
amd-gpu
amdgpu
rocm
rocm-linux
rdna4
rx-9070-xt
radeon
gfx1201
hsa
hsa-override
hsa-override-gfx-version
gpu-safety
gpu-diagnostics
gpu-debugging
comfyui
pytorch
pytorch-rocm
cachyos
arch-linux
fish-shell
linux
genera

About

Read-only AMD ROCm GPU safety checker for detecting HSA_OVERRIDE_GFX_VERSION overrides and unsafe project launchers.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages