Coverage for cuda/core/_memory/_copy_attributes.pyx: 100.00%
13 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-09-03 02:41 +0000
« prev ^ index » next coverage.py v7.16.0, created at 2026-09-03 02:41 +0000
1# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2#
3# SPDX-License-Identifier: Apache-2.0
5from libc.string cimport memset
7from cuda.bindings cimport cydriver
8from cuda.core._memory._location cimport to_cumemlocation
10from cuda.core._memory._managed_location import _coerce_location
13cdef cydriver.CUmemcpyAttributes _to_cu_memcpy_attributes(object attr):
14 """Convert a CopyOptions to a cydriver.CUmemcpyAttributes struct."""
15 cdef cydriver.CUmemcpyAttributes cu_attr
16 memset(&cu_attr, 0, sizeof(cydriver.CUmemcpyAttributes)) 1IghijklmnopqrcdastuvwxyzefbABCDEFGH
17 cu_attr.srcAccessOrder = <cydriver.CUmemcpySrcAccessOrder>(<int>attr._to_driver_enum()) 1ghijklmnopqrcdastuvwxyzefbABCDEFGH
18 cu_attr.flags = <unsigned int>(<int>attr._to_driver_flags()) 1ghijklmnopqrcdastuvwxyzefbABCDEFGH
20 cdef object src_loc = _coerce_location(attr.src_location_hint, allow_none=True) 1ghijklmnopqrcdastuvwxyzefbABCDEFGH
21 cdef object dst_loc = _coerce_location(attr.dst_location_hint, allow_none=True) 1IghijklmnopqrcdastuvwxyzefbABCDEFGH
23 if src_loc is not None: 1ghijklmnopqrcdastuvwxyzefbABCDEFGH
24 cu_attr.srcLocHint = to_cumemlocation(src_loc.kind, src_loc.id) 1ab
25 if dst_loc is not None: 1ghijklmnopqrcdastuvwxyzefbABCDEFGH
26 cu_attr.dstLocHint = to_cumemlocation(dst_loc.kind, dst_loc.id) 1cdaefb
28 return cu_attr 1ghijklmnopqrcdastuvwxyzefbABCDEFGH