@@ -48,29 +48,31 @@ ROCBUDAI_AGENTS_TEMPLATE="${ROCBUDAI_AGENTS_TEMPLATE:-}"
4848ROCBUDAI_CONTAINER_DEMO_PERSONA=" ${ROCBUDAI_CONTAINER_DEMO_PERSONA:- ${ROCBUDAI_SHARE} / AGENTS-container-demo.md} "
4949
5050# >>> rocbudai persona-resolver (sourceable for tests; see tests/test-persona-resolver.sh) >>>
51- # Echo the first GPU agent's gfx arch (gfx90a|gfx942|gfx950) from rocminfo,
52- # or nothing if rocminfo is unavailable / no match.
53- _detect_gfx_arch () {
54- command -v rocminfo > /dev/null 2>&1 || return 1
55- rocminfo 2> /dev/null | grep -oE ' gfx(90a|942|950)' | head -n1
56- }
57-
58- # gfx942 is shared by MI300A (APU) and MI300X (discrete GPU). Narrow via the
59- # rocminfo Marketing Name / APU marker (mirrors install.sh detect_mi300a).
60- _is_mi300a_apu () {
61- command -v rocminfo > /dev/null 2>&1 || return 1
62- rocminfo 2> /dev/null | grep -qiE ' Marketing Name:.*MI300A|APU'
63- }
64-
6551# Echo the persona basename matching the detected (or hinted) GPU arch.
52+ #
53+ # Takes a SINGLE rocminfo snapshot and derives both the gfx arch and the
54+ # MI300A/MI300X split from that one snapshot. Previously two independent
55+ # rocminfo calls (arch detect + APU probe) could disagree when rocminfo output
56+ # was truncated under load (e.g. the ollama daemon saturating the GPUs during
57+ # `module load`): the arch call still returned gfx942 while the APU call came
58+ # back empty, so gfx942 fell through to the MI300X persona on an MI300A APU.
59+ #
60+ # For gfx942 (shared by MI300A APU and MI300X discrete GPU) we now select the
61+ # MI300X persona only on a POSITIVE discrete match and otherwise FAIL SAFE to
62+ # the MI300A persona, so a partial/empty snapshot can never mis-pick MI300X.
6663_persona_for_arch () {
6764 local arch=" ${ROCBUDAI_GFX_ARCH:- } "
68- [[ -n " ${arch} " ]] || arch=" $( _detect_gfx_arch || true) "
65+ local ri=" "
66+ command -v rocminfo > /dev/null 2>&1 && ri=" $( rocminfo 2> /dev/null) "
67+ [[ -n " ${arch} " ]] || arch=" $( printf ' %s\n' " ${ri} " | grep -oE ' gfx(90a|942|950)' | head -n1) "
6968 case " ${arch} " in
7069 gfx90a) echo " AGENTS-gfx90a.md" ;;
7170 gfx950) echo " AGENTS-gfx950.md" ;;
72- gfx942) if _is_mi300a_apu; then echo " AGENTS-default.md"
73- else echo " AGENTS-gfx942-mi300x.md" ; fi ;;
71+ gfx942) if printf ' %s\n' " ${ri} " | grep -qiE ' Marketing Name:.*MI300X' ; then
72+ echo " AGENTS-gfx942-mi300x.md"
73+ else
74+ echo " AGENTS-default.md"
75+ fi ;;
7476 * ) warn " could not determine GPU arch (got '${arch:- none} '); defaulting to the MI300A persona — set ROCBUDAI_GFX_ARCH=gfx90a|gfx942|gfx950 or ROCBUDAI_AGENTS_TEMPLATE to override."
7577 echo " AGENTS-default.md" ;;
7678 esac
0 commit comments