@@ -40,7 +40,21 @@ CCUDADevice::CCUDADevice(
4040
4141 for (uint32_t locationType = 0 ; locationType < m_allocationGranularity.size (); ++locationType)
4242 {
43- const auto prop = getMemAllocationProp (static_cast <CUmemLocationType>(locationType));
43+
44+ #ifdef _WIN32
45+ OBJECT_ATTRIBUTES metadata = {
46+ .Length = sizeof (OBJECT_ATTRIBUTES)
47+ };
48+ #endif
49+
50+ const auto prop = CUmemAllocationProp{
51+ .type = CU_MEM_ALLOCATION_TYPE_PINNED,
52+ .requestedHandleTypes = ALLOCATION_HANDLE_TYPE,
53+ .location = { .type = static_cast <CUmemLocationType>(locationType), .id = m_handle },
54+ #ifdef _WIN32
55+ .win32HandleMetaData = &metadata,
56+ #endif
57+ };
4458 ASSERT_CUDA_SUCCESS (cu.pcuMemGetAllocationGranularity (&m_allocationGranularity[locationType], &prop, CU_MEM_ALLOC_GRANULARITY_MINIMUM), m_handler);
4559 }
4660}
@@ -81,32 +95,27 @@ CUresult CCUDADevice::reserveAddressAndMapMemory(CUdeviceptr* outPtr, size_t siz
8195 return CUDA_SUCCESS;
8296}
8397
84- CUmemAllocationProp CCUDADevice::getMemAllocationProp (CUmemLocationType locationType) const
98+ core::smart_refctd_ptr<CCUDAExportableMemory> CCUDADevice::createExportableMemory (CCUDAExportableMemory::SCreationParams&& inParams)
8599{
100+ CCUDAExportableMemory::SCachedCreationParams params = { inParams };
101+
102+ auto & cu = m_handler->getCUDAFunctionTable ();
86103
87104#ifdef _WIN32
88- OBJECT_ATTRIBUTES metadata = {};
89- metadata.Length = sizeof (OBJECT_ATTRIBUTES);
105+ OBJECT_ATTRIBUTES metadata = {
106+ .Length = sizeof (OBJECT_ATTRIBUTES)
107+ };
90108#endif
91109
92- return {
110+ const auto prop = CUmemAllocationProp {
93111 .type = CU_MEM_ALLOCATION_TYPE_PINNED,
94112 .requestedHandleTypes = ALLOCATION_HANDLE_TYPE,
95- .location = { .type = locationType , .id = m_handle },
113+ .location = { .type = params. location , .id = m_handle },
96114#ifdef _WIN32
97115 .win32HandleMetaData = &metadata,
98116#endif
99117 };
100- }
101118
102- core::smart_refctd_ptr<CCUDAExportableMemory> CCUDADevice::createExportableMemory (CCUDAExportableMemory::SCreationParams&& inParams)
103- {
104- CCUDAExportableMemory::SCachedCreationParams params = { inParams };
105-
106- auto & cu = m_handler->getCUDAFunctionTable ();
107-
108- const auto prop = getMemAllocationProp (params.location );
109-
110119 params.granularSize = roundToGranularity (params.location , params.size );
111120
112121 CUmemGenericAllocationHandle mem;
0 commit comments