Skip to content

Commit 746df99

Browse files
committed
add lto enabled runtime test for ftz/prec_div/prec_sqrt/fma
1 parent c539cc2 commit 746df99

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎cuda_core/tests/test_linker.py‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,32 @@ def test_linker_options_as_bytes_nvjitlink():
210210
assert "-maxrregcount=32" in options_str
211211

212212

213+
@pytest.mark.agent_authored(model="claude-sonnet-5")
214+
@pytest.mark.skipif(is_culink_backend, reason="ftz/prec_div/prec_sqrt/fma are nvjitlink-only options")
215+
def test_linker_lto_enabled_runtime_accepts_bool_options(compile_ltoir_functions):
216+
"""Regression test for nvbug 6621758: actual LTO-enabled link, not just option setter.
217+
218+
With ``link_time_optimization=True``, ``-ftz``/``-prec-div``/``-prec-sqrt``/``-fma``
219+
are forwarded to libnvvm and actually validated at link time, unlike in a non-LTO
220+
link where legacy ``true``/``false`` values are silently ignored. Only ``0``/``1``
221+
reliably takes effect here on any CUDA version.
222+
223+
The test checks that Python ``True``/``False`` values are correctly
224+
mapped to ``1``/``0`` and accepted by the nvJitLink backend during an LTO-enabled link.
225+
"""
226+
options = LinkerOptions(
227+
arch=ARCH,
228+
link_time_optimization=True,
229+
ftz=True,
230+
prec_div=True,
231+
prec_sqrt=True,
232+
fma=True,
233+
)
234+
linker = Linker(*compile_ltoir_functions, options=options)
235+
linked_code = linker.link("cubin")
236+
assert isinstance(linked_code, ObjectCode)
237+
238+
213239
@pytest.mark.agent_authored(model="gpt-5.6")
214240
@pytest.mark.skipif(is_culink_backend, reason="as_bytes() only supported for nvjitlink backend")
215241
@pytest.mark.parametrize("value,expected_count", [(None, 0), (False, 0), (True, 1)])

0 commit comments

Comments
 (0)