Skip to content

Commit 60d36b7

Browse files
committed
cuda.core.texture: register new StrEnums in enum-coverage test (NVIDIA#2292)
test_enum_coverage.py::test_all_str_enums_in_cases requires every StrEnum in cuda.core to be declared either in _CASES (bound to a cuda_binding enum) or in _UNBOUND_STR_ENUMS. The four texture enums moved into cuda.core.typing (item 4 of NVIDIA#2292) were not registered, failing that guard. - AddressModeType / FilterModeType are 1:1 wrappers of CUaddress_mode / CUfilter_mode, so add mapping=None _CASES entries (count-check only; the texture mapping dicts store cydriver-derived ints, not driver.<Enum> members, so the isinstance-based mapping check does not apply). - ArrayFormatType exposes only the 8 NumPy-representable formats out of CUarray_format's ~67 members, so it is a curated subset rather than a 1:1 wrapper -> _UNBOUND_STR_ENUMS. - ReadModeType maps to the CU_TRSF_READ_AS_INTEGER flag bit, not a CUenum -> _UNBOUND_STR_ENUMS. This is the third local test failure; the other two (stale texture negative-path tests) were fixed in the two preceding commits.
1 parent 57bcf4c commit 60d36b7

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

‎cuda_core/tests/test_enum_coverage.py‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,25 @@
9898
},
9999
set(),
100100
),
101+
# AddressModeType / FilterModeType are 1:1 wrappers of small driver enums.
102+
# The texture mapping dicts (_ADDRESSMODE_TO_CU / _FILTERMODE_TO_CU) store
103+
# plain ints keyed on cydriver values, not driver.<Enum> members, so they
104+
# are incompatible with the isinstance-based mapping check. Use the
105+
# mapping=None form, which count-checks the StrEnum against the binding enum.
106+
(
107+
driver.CUaddress_mode,
108+
cuda.core.typing.AddressModeType,
109+
None,
110+
set(),
111+
set(),
112+
),
113+
(
114+
driver.CUfilter_mode,
115+
cuda.core.typing.FilterModeType,
116+
None,
117+
set(),
118+
set(),
119+
),
101120
]
102121

103122
if system.CUDA_BINDINGS_NVML_IS_COMPATIBLE:
@@ -278,6 +297,16 @@
278297
cuda.core.typing.SourceCodeType,
279298
# This enum is dynamic depending on the version of CTK installed.
280299
cuda.core.typing.VirtualMemoryAllocationType,
300+
# ArrayFormatType wraps CUarray_format, but intentionally exposes only the
301+
# 8 NumPy-representable formats out of the driver's ~67 members (BC1..BC7,
302+
# UNORM_INTx, packed/planar YUV, etc. are deliberately unsupported for now).
303+
# It is a curated subset, not a 1:1 wrapper, so a count/coverage check
304+
# against the binding enum does not apply.
305+
cuda.core.typing.ArrayFormatType,
306+
# ReadModeType (ELEMENT_TYPE / NORMALIZED_FLOAT) has no backing cuda_binding
307+
# enum: it maps to the presence/absence of the CU_TRSF_READ_AS_INTEGER
308+
# texture-descriptor flag bit, not to a CUenum.
309+
cuda.core.typing.ReadModeType,
281310
}
282311

283312

0 commit comments

Comments
 (0)