Skip to content

Commit d656887

Browse files
committed
refactor(test): restructure test kernels into test/kernel/[platform]/
- Create test/kernel/ with top-level dispatcher Makefile - Move platform-agnostic headers to test/kernel/include/ - Create test/kernel/nvidia/ with clean CUDA kernels (no #ifdef) - Create test/kernel/du/ with clean DU kernels (no #ifdef) - Update unittest/device_api and perf/device_api Makefiles to use new paths - Split test_nvshmem_adaptor.cu into kernel (.cu) + harness (.cpp) - Move nvshmem_state_sync.cc to test/unittest/shmem_adaptor/ - Add KERNEL_DIR/KERNEL_PLATFORM/KERNEL_OBJ_DIR to test/make.inc Old test/device_api/ directory kept temporarily for reference until build verification passes on GPU nodes.
1 parent 421990c commit d656887

17 files changed

Lines changed: 4253 additions & 53 deletions

File tree

test/kernel/Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# test/kernel/Makefile
2+
# Dispatches kernel compilation to the active platform subdirectory.
3+
4+
include ../make.inc
5+
6+
KERNEL_PLATFORM_DIR := $(CURDIR)/$(KERNEL_PLATFORM)
7+
8+
.PHONY: all clean
9+
10+
all:
11+
@$(MAKE) -C $(KERNEL_PLATFORM_DIR) all \
12+
USE_SHMEM=$(USE_SHMEM) SHMEM_HOME=$(SHMEM_HOME) \
13+
FORCE_DEFAULT_PATH=$(FORCE_DEFAULT_PATH)
14+
15+
clean:
16+
@$(MAKE) -C $(KERNEL_PLATFORM_DIR) clean
17+
18+
# Pass through any specific target (device_api.o, dlink_ir.o, etc.)
19+
%:
20+
@$(MAKE) -C $(KERNEL_PLATFORM_DIR) $@ \
21+
USE_SHMEM=$(USE_SHMEM) SHMEM_HOME=$(SHMEM_HOME) \
22+
FORCE_DEFAULT_PATH=$(FORCE_DEFAULT_PATH)

test/kernel/du/Makefile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# test/kernel/du/Makefile
2+
# DU platform kernel compilation for test binaries.
3+
4+
include ../../make.inc
5+
6+
# Propagate FORCE_DEFAULT_PATH
7+
ifeq ($(FORCE_DEFAULT_PATH), 1)
8+
ADAPTOR_DEFINE += -DFLAGCX_FORCE_DEFAULT_PATH
9+
endif
10+
11+
PLATFORM_INCLUDES := -I$(PLATFORM_IR_DIR)
12+
13+
ALL_INCLUDES := $(FLAGCX_INCLUDES) \
14+
-I$(PROJECT_ROOT)/flagcx/adaptor/include/device_api \
15+
-I$(PROJECT_ROOT)/bindings/ir \
16+
-I$(PROJECT_ROOT)/test/kernel/include \
17+
$(PLATFORM_INCLUDES) \
18+
$(CCL_INCLUDE) \
19+
$(DEVICE_INCLUDE)
20+
21+
NVCC_RDC_FLAG := -c
22+
23+
.PHONY: all clean device_api.o device_ir.o
24+
25+
all: $(OBJDIR)/device_api.o $(OBJDIR)/device_ir.o
26+
27+
device_api.o: $(OBJDIR)/device_api.o
28+
device_ir.o: $(OBJDIR)/device_ir.o
29+
30+
$(OBJDIR)/device_api.o: device_api.cu
31+
@mkdir -p $(OBJDIR)
32+
@echo "Compiling device_api.cu (DU)"
33+
@$(DEVICE_COMPILER) -std=c++17 $(DEVICE_COMPILER_GENCODE) $(NVCC_RDC_FLAG) -o $@ $< \
34+
$(ALL_INCLUDES) -DCOMPILE_KERNEL $(ADAPTOR_DEFINE)
35+
36+
$(OBJDIR)/device_ir.o: device_ir.cu
37+
@mkdir -p $(OBJDIR)
38+
@echo "Compiling device_ir.cu (DU)"
39+
@$(DEVICE_COMPILER) -std=c++17 $(DEVICE_COMPILER_GENCODE) $(NVCC_RDC_FLAG) -o $@ $< \
40+
$(ALL_INCLUDES) -DCOMPILE_KERNEL $(ADAPTOR_DEFINE)
41+
42+
# DU does not use SHMEM device-link targets
43+
dlink.o dlink_api.o dlink_ir.o:
44+
@echo "DU: no device-link needed (no SHMEM support)"
45+
46+
clean:
47+
@rm -rf $(BUILDDIR)

0 commit comments

Comments
 (0)