Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cuda interop vk13 #90

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Conversation

devshgraphicsprogramming
Copy link
Member

Continues #49

@devshgraphicsprogramming devshgraphicsprogramming changed the base branch from master to vulkan_1_3 January 4, 2024 20:25
@atkurtul atkurtul deleted the branch master January 13, 2024 19:21
@atkurtul atkurtul closed this Jan 13, 2024
@devshgraphicsprogramming
Copy link
Member Author

any way to reopen?

Comment on lines 152 to 191
assert(re);
if (!re) logFail("Failed to bind CUDA memory to buffer");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw its return logFail if you want to quit

Comment on lines 166 to 172
// create and allocate CUmem with CUDA and slap it inside a simple IReferenceCounted wrapper
ASSERT_SUCCESS(cudaDevice->createSharedMemory(&cudaMemories[0], { .size = size, .alignment = sizeof(float), .location = CU_MEM_LOCATION_TYPE_DEVICE }));
ASSERT_SUCCESS(cudaDevice->createSharedMemory(&cudaMemories[1], { .size = size, .alignment = sizeof(float), .location = CU_MEM_LOCATION_TYPE_DEVICE }));
ASSERT_SUCCESS(cudaDevice->createSharedMemory(&cudaMemories[2], { .size = size, .alignment = sizeof(float), .location = CU_MEM_LOCATION_TYPE_DEVICE }));

sema = m_device->createSemaphore({ .externalHandleTypes = ISemaphore::EHT_OPAQUE_WIN32 });
ASSERT_SUCCESS(cudaDevice->importGPUSemaphore(&cusema, sema.get()));
importedSemaphore = m_device->createSemaphore(0, { .externalHandleTypes = ISemaphore::EHT_OPAQUE_WIN32 });
ASSERT_SUCCESS(cudaDevice->importGPUSemaphore(&cudaSemaphore, importedSemaphore.get()));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log a message and return false, don't assert

Comment on lines 252 to 254
.levelCount = 1u,
.layerCount = 1u,
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explain why you're not doing the usual UNDEFINED to X layout transition we usually see in samples

IIRC its because the CCUDASharedMemory creates a PREINITIALIZED layout image

.subresourceRange = {
.aspectMask = IImage::EAF_COLOR_BIT,
.levelCount = 1u,
.layerCount = 1u,
},
.oldLayout = IImage::LAYOUT::UNDEFINED,
.oldLayout = IImage::LAYOUT::PREINITIALIZED,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explain that old layout at the time of release was PREINITIALIZED and it needs to match at the time of acquire (external user of an image must put it back to same layout after done according to VK spec)

Base automatically changed from vulkan_1_3 to master March 20, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants