Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions cuda_bindings/tests/test_nvfatbin.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ def nvcc_smoke(tmpdir) -> str:
return nvcc


@pytest.fixture
def CUBIN(arch):
def _build_cubin(arch):
def CHECK_NVRTC(err):
if err != nvrtc.nvrtcResult.NVRTC_SUCCESS:
raise RuntimeError(repr(err))
Expand All @@ -142,6 +141,11 @@ def CHECK_NVRTC(err):
return cubin


@pytest.fixture
def CUBIN(arch):
return _build_cubin(arch)


# create a valid LTOIR input for testing
@pytest.fixture
def LTOIR(arch):
Expand Down Expand Up @@ -261,11 +265,11 @@ def test_nvfatbin_add_ptx(PTX, arch):
nvfatbin.destroy(handle)


@pytest.mark.parametrize("arch", ["sm_80"], indirect=True)
def test_nvfatbin_add_cubin_ELF_SIZE_MISMATCH(CUBIN, arch):
def test_nvfatbin_add_cubin_ELF_SIZE_MISMATCH():
cubin = _build_cubin("sm_80")
handle = nvfatbin.create([], 0)
with pytest.raises(nvfatbin.nvFatbinError, match="ERROR_ELF_ARCH_MISMATCH"):
nvfatbin.add_cubin(handle, CUBIN, len(CUBIN), "75", "inc")
nvfatbin.add_cubin(handle, cubin, len(cubin), "75", "inc")

nvfatbin.destroy(handle)

Expand All @@ -282,11 +286,11 @@ def test_nvfatbin_add_cubin(CUBIN, arch):
nvfatbin.destroy(handle)


@pytest.mark.parametrize("arch", ["sm_80"], indirect=True)
def test_nvfatbin_add_cubin_ELF_ARCH_MISMATCH(CUBIN, arch):
def test_nvfatbin_add_cubin_ELF_ARCH_MISMATCH():
cubin = _build_cubin("sm_80")
handle = nvfatbin.create([], 0)
with pytest.raises(nvfatbin.nvFatbinError, match="ERROR_ELF_ARCH_MISMATCH"):
nvfatbin.add_cubin(handle, CUBIN, len(CUBIN), "75", "inc")
nvfatbin.add_cubin(handle, cubin, len(cubin), "75", "inc")

nvfatbin.destroy(handle)

Expand Down