2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00
Files
criu/plugins/amdgpu/Makefile
Yanning Yang bfb4a3d842 plugins/amdgpu: Implement parallel restore
This patch implements the entire logic to enable the offloading of
buffer object content restoration.

The goal of this patch is to offload the buffer object content
restoration to the main CRIU process so that this restoration can occur
in parallel with other restoration logic (mainly the restoration of
memory state in the restore blob, which is time-consuming) to speed up
the restore phase. The restoration of buffer object content usually
takes a significant amount of time for GPU applications, so
parallelizing it with other operations can reduce the overall restore
time.

It has three parts: the first replaces the restoration of buffer objects
in the target process by sending a parallel restore command to the main
CRIU process; the second implements the POST_FORKING hook in the amdgpu
plugin to enable buffer object content restoration in the main CRIU
process; the third stops the parallel thread in the RESUME_DEVICES_LATE
hook.

This optimization only focuses on the single-process situation (common
case). In other scenarios, it will turn to the original method. This is
achieved with the new `parallel_disabled` flag.

Signed-off-by: Yanning Yang <yangyanning@sjtu.edu.cn>
2025-05-17 13:36:36 -07:00

66 lines
1.8 KiB
Makefile

PLUGIN_NAME := amdgpu_plugin
PLUGIN_SOBJ := amdgpu_plugin.so
PLUGIN_INCLUDE := -iquote../../include
PLUGIN_INCLUDE += -iquote../../criu/include
PLUGIN_INCLUDE += -iquote../../criu/arch/$(ARCH)/include/
PLUGIN_INCLUDE += -iquote../../
COMPEL := ../../compel/compel-host
LIBDRM_INC := -I/usr/include/libdrm
DEPS_OK := amdgpu_plugin.so amdgpu_plugin_test
DEPS_NOK := ;
__nmk_dir ?= ../../scripts/nmk/scripts/
include $(__nmk_dir)msg.mk
PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC
PLUGIN_LDFLAGS := -lpthread -lrt -ldrm -ldrm_amdgpu
ifeq ($(CONFIG_AMDGPU),y)
all: $(DEPS_OK)
else
all: $(DEPS_NOK)
endif
criu-amdgpu.pb-c.c: criu-amdgpu.proto
protoc-c --proto_path=. --c_out=. criu-amdgpu.proto
amdgpu_plugin.so: amdgpu_plugin.c amdgpu_plugin_drm.c amdgpu_plugin_topology.c amdgpu_plugin_util.c criu-amdgpu.pb-c.c amdgpu_socket_utils.c
$(CC) $(PLUGIN_CFLAGS) $(shell $(COMPEL) includes) $^ -o $@ $(PLUGIN_INCLUDE) $(PLUGIN_LDFLAGS) $(LIBDRM_INC)
amdgpu_plugin_clean:
$(call msg-clean, $@)
$(Q) $(RM) amdgpu_plugin.so criu-amdgpu.pb-c*
.PHONY: amdgpu_plugin_clean
test_topology_remap: amdgpu_plugin_topology.c tests/test_topology_remap.c
$(CC) $^ -o $@ -DCOMPILE_TESTS $(PLUGIN_INCLUDE) -I .
amdgpu_plugin_test: test_topology_remap
.PHONY: amdgpu_plugin_test
amdgpu_plugin_test_clean:
$(Q) $(RM) test_topology_remap
.PHONY: amdgpu_plugin_test_clean
clean: amdgpu_plugin_clean amdgpu_plugin_test_clean
mrproper: clean
install:
ifeq ($(CONFIG_AMDGPU),y)
$(Q) mkdir -p $(DESTDIR)$(PLUGINDIR)
$(E) " INSTALL " $(PLUGIN_NAME)
$(Q) install -m 755 $(PLUGIN_SOBJ) $(DESTDIR)$(PLUGINDIR)
endif
.PHONY: install
uninstall:
ifeq ($(CONFIG_AMDGPU),y)
$(E) " UNINSTALL" $(PLUGIN_NAME)
$(Q) $(RM) $(DESTDIR)$(PLUGINDIR)/$(PLUGIN_SOBJ)
endif
.PHONY: uninstall