HIP can only auto-extract HIP ceated fat libraries so we need to add a step to extract the DAL from openmp-created fat library
@@ -38,11 +38,10 @@ TRIPLE = amdgcn-amd-amdhsa
#OMPFLAGS = -O3 -target x86_64-pc-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=$(MYGPU)
OMPFLAGS = -O3 -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=$(MYGPU)
-writeIndex: writeIndex.hip lib_mylib.a libbc-_mylib-amdgcn.a lib_myomplib.a
- @echo
- @echo " ---------- 3 Build HIP application using both SDLs ----------------"
+
+writeIndex: writeIndex.hip lib_mylib.a libbc-_mylib-amdgcn.a libbc-_myomplib-amdgcn.a
@echo
- @echo " 3. Create HIP app using both _mylib and _myomplib SDLs. $@"
+ @echo " 3.2 Create HIP application using both _mylib and _myomplib SDLs. $@"
DEVICE_LIB_PATH=$(DEVICE_LIB_PATH) $(HIPCC) -std=c++11 -fgpu-rdc -L$(PWD) -l_myomplib -l_mylib writeIndex.hip -o $@ -std=c++11
inc_arrayval.o: inc_arrayval.c
@@ -71,7 +70,7 @@ dec_arrayval-amdgcn.bc: dec_arrayval.c
libbc-_mylib-amdgcn.a: inc_arrayval-amdgcn.bc dec_arrayval-amdgcn.bc
@echo
- @echo " 1.6 Use Linux ar command to create device-specific archive. $@"
+ @echo " 1.6 Use Linux ar command to create device-specific archive (DAL). $@"
ar rcs $@ $^
_myomplib.o: _myomplib.c
@@ -85,6 +84,14 @@ lib_myomplib.a: _myomplib.o
@echo " 2.2 Create heterogeneous archive from bundled objects. $@"
ar rcs $@ $^
+libbc-_myomplib-amdgcn.a: lib_myomplib.a
+ @echo
+ @echo " ---------- 3 Build HIP application using both SDLs ----------------"
+ @echo
+ @echo " 3.1 Extract(unbundle) DAL from openmp fat archive lib_myomplib.a $@"
+ @echo " Note: HIP can only auto-extract from HIP-created fat libraries"
+ $(AOMP)/bin/clang-offload-bundler -unbundle -type=a -inputs=$^ -targets=openmp-amdgcn-amd-amdhsa--$(MYGPU) -outputs=$@ -allow-missing-bundles
+
run: writeIndex
./writeIndex
@@ -97,4 +104,5 @@ clean:
@[ -f ./lib_myomplib.a ] && rm lib_myomplib.a ; true
@[ -f ./inc_arrayval-amdgcn.bc ] && rm inc_arrayval-amdgcn.bc ; true
@[ -f ./dec_arrayval-amdgcn.bc ] && rm dec_arrayval-amdgcn.bc ; true
+ @[ -f ./libbc-_myomplib-amdgcn.a ] && rm libbc-_myomplib-amdgcn.a ; true
@[ -f ./_myomplib.o ] && rm _myomplib.o ; true
