Skip to content

Commit

Permalink
Try to fix logic for CCs used for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarkall committed Mar 5, 2024
1 parent c829461 commit f574d3c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
9 changes: 6 additions & 3 deletions pynvjitlink/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ def gpu_compute_capability():
@pytest.fixture(scope="session")
def alt_gpu_compute_capability(gpu_compute_capability):
"""A compute capability that does not match the current GPU"""
if gpu_compute_capability == (7, 5):
return (7, 0)
# For sufficient incompatibility for the test suites, the major number of
# the compute capabilities must differ (for example one can load a 7.0
# cubin when linking for 7.5)
if gpu_compute_capability[0] == 7:
return (8, 0)
else:
return (7, 5)
return (7, 0)


@pytest.fixture(scope="session")
Expand Down
11 changes: 9 additions & 2 deletions test_binary_generation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

# Default to CC 7.5 for most testing unless explicitly set otherwise
GPU_CC ?= 75
# Use CC 7.0 as an alternative in fatbin testing, unless the default CC is 7.0
ALT_CC := $(if ifeq $(GPU_CC) 75,70,75)

# Use CC 7.0 as an alternative in fatbin testing, unless CC is 7.x
ifeq ($(shell echo "$(GPU_CC)" | cut -c1),7)
ALT_CC := 80
else
ALT_CC := 70
endif

# Gencode flags suitable for most tests
GENCODE := -gencode arch=compute_$(GPU_CC),code=sm_$(GPU_CC)
Expand All @@ -29,6 +34,8 @@ LTOIR_FLAGS := $(LTOIR_GENCODE) -dc
OUTPUT_DIR := ../pynvjitlink/tests

all:
@echo "GPU CC: $(GPU_CC)"
@echo "Alternative CC: $(ALT_CC)"
# Compile all test objects
nvcc $(NVCC_FLAGS) $(CUBIN_FLAGS) -o $(OUTPUT_DIR)/undefined_extern.cubin undefined_extern.cu
nvcc $(NVCC_FLAGS) $(CUBIN_FLAGS) -o $(OUTPUT_DIR)/test_device_functions.cubin test_device_functions.cu
Expand Down

0 comments on commit f574d3c

Please sign in to comment.