Fix OFFLOAD_ARCH_gfxABC in Makefile.defs.
This ensures the macro matches --offload-arch by honoring
AOMP_GPU and ROCR_VISIBLE_DEVICES. The first visible GPU
found when setting ROCR_VISIBLE_DEVICES will be used.
Spacing adjustments.
@@ -62,10 +62,19 @@ else
INSTALLED_GPU = sm_50
else
ifneq ($(CBL),1)
+ # Honor AOMP_GPU.
+ ifneq ("$(AOMP_GPU)","")
+ INSTALLED_GPU = $(shell echo $(AOMP_GPU))
+ # Honor ROCR_VISIBLE_DEVICES. Returns first GPU in list.
+ else ifneq ("$(ROCR_VISIBLE_DEVICES)","")
+ INSTALLED_GPU = $(shell $(AOMP)/bin/offload-arch -c | grep -oP gfx.+?\(?=:\))
+ # Default to rocm_agent_enumerator. Returns first GPU in list.
+ else
INSTALLED_GPU = $(shell $(AOMP)/bin/rocm_agent_enumerator | grep -m 1 -E gfx[^0]{1}.{2})
endif
endif
endif
+endif
AOMP_GPU ?= $(INSTALLED_GPU)
CC = $(AOMP)/bin/clang
