Initial commit
This commit is contained in:
97
scripts/optimize/verify.sh
Normal file
97
scripts/optimize/verify.sh
Normal file
@@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env bash
|
||||
# Post-optimization verification checklist
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../../lib/common.sh"
|
||||
source "$SCRIPT_DIR/../../lib/detect.sh"
|
||||
source "$SCRIPT_DIR/../../lib/format.sh"
|
||||
|
||||
log_header "Optimization Verification"
|
||||
|
||||
score=0
|
||||
total=0
|
||||
|
||||
check() {
|
||||
local pass="$1" label="$2" detail="$3"
|
||||
total=$(( total + 1 ))
|
||||
if [[ "$pass" == "1" ]]; then
|
||||
score=$(( score + 1 ))
|
||||
print_status pass "$label" "$detail"
|
||||
else
|
||||
print_status fail "$label" "$detail"
|
||||
fi
|
||||
}
|
||||
|
||||
# Kernel version
|
||||
kernel="$(detect_kernel_version)"
|
||||
kernel_major=$(echo "$kernel" | cut -d. -f1)
|
||||
kernel_minor=$(echo "$kernel" | cut -d. -f2)
|
||||
kernel_ok=0
|
||||
(( kernel_major > 6 || (kernel_major == 6 && kernel_minor >= 18) )) && kernel_ok=1
|
||||
check "$kernel_ok" "Kernel >= 6.18.4" "$kernel"
|
||||
|
||||
# Firmware
|
||||
fw_ok=1
|
||||
detect_firmware_bad && fw_ok=0
|
||||
check "$fw_ok" "Firmware (not 20251125)" "$(detect_firmware_version)"
|
||||
|
||||
# Kernel params
|
||||
iommu_val="$(detect_kernel_param 'iommu')"
|
||||
iommu_ok=0
|
||||
[[ "$iommu_val" == "pt" ]] && iommu_ok=1
|
||||
check "$iommu_ok" "iommu=pt" "${iommu_val:-not set}"
|
||||
|
||||
gttsize="$(detect_gttsize_param)"
|
||||
rec_gttsize="$(recommended_gttsize_mib)"
|
||||
gtt_ok=0
|
||||
[[ -n "$gttsize" ]] && (( gttsize >= rec_gttsize )) && gtt_ok=1
|
||||
check "$gtt_ok" "amdgpu.gttsize" "${gttsize:-not set} (recommended: $rec_gttsize)"
|
||||
|
||||
pages="$(detect_pages_limit_param)"
|
||||
rec_pages="$(recommended_pages_limit)"
|
||||
pages_ok=0
|
||||
[[ -n "$pages" ]] && (( pages >= rec_pages )) && pages_ok=1
|
||||
check "$pages_ok" "ttm.pages_limit" "${pages:-not set} (recommended: $rec_pages)"
|
||||
|
||||
# Tuned profile
|
||||
tuned="$(detect_tuned_profile)"
|
||||
tuned_ok=0
|
||||
[[ "$tuned" == "accelerator-performance" ]] && tuned_ok=1
|
||||
check "$tuned_ok" "Tuned profile" "$tuned"
|
||||
|
||||
# VRAM (should be <= 1 GiB)
|
||||
vram="$(detect_vram_total)"
|
||||
vram_gib=$(echo "scale=1; $vram / 1073741824" | bc)
|
||||
vram_ok=0
|
||||
(( vram <= 1073741824 )) && vram_ok=1
|
||||
check "$vram_ok" "VRAM <= 1 GiB" "${vram_gib} GiB"
|
||||
|
||||
# GTT (should be close to recommended)
|
||||
gtt="$(detect_gtt_total)"
|
||||
gtt_gib=$(echo "scale=1; $gtt / 1073741824" | bc)
|
||||
rec_gtt_bytes=$(( rec_gttsize * 1048576 ))
|
||||
gtt_mem_ok=0
|
||||
(( gtt >= rec_gtt_bytes * 3 / 4 )) && gtt_mem_ok=1
|
||||
check "$gtt_mem_ok" "GTT >= $(human_mib "$rec_gttsize")" "${gtt_gib} GiB"
|
||||
|
||||
# GPU monitor installed
|
||||
monitor_ok=0
|
||||
is_cmd amdgpu_top && monitor_ok=1
|
||||
check "$monitor_ok" "amdgpu_top installed" "$(is_cmd amdgpu_top && echo 'yes' || echo 'no — run make monitor-install')"
|
||||
|
||||
# Summary
|
||||
echo ""
|
||||
print_divider
|
||||
printf "\n ${BOLD}Score: %d / %d${RESET}\n" "$score" "$total"
|
||||
|
||||
if (( score == total )); then
|
||||
printf " ${GREEN}Fully optimized!${RESET} Run 'make benchmark' to measure performance.\n"
|
||||
elif (( score >= total * 3 / 4 )); then
|
||||
printf " ${YELLOW}Nearly there${RESET} — check the failed items above.\n"
|
||||
elif (( score >= total / 2 )); then
|
||||
printf " ${YELLOW}Partially optimized${RESET} — run 'make optimize' for the remaining items.\n"
|
||||
else
|
||||
printf " ${RED}Significant optimizations pending${RESET} — run 'make optimize'\n"
|
||||
fi
|
||||
echo ""
|
||||
Reference in New Issue
Block a user