Skip to content

fix: add missing CUDA error check + correct Vulkan enum type mismatch#414

Open
Scottcjn wants to merge 1 commit intoNVIDIA:masterfrom
Scottcjn:fix/cuda-error-check-and-vulkan-enum
Open

fix: add missing CUDA error check + correct Vulkan enum type mismatch#414
Scottcjn wants to merge 1 commit intoNVIDIA:masterfrom
Scottcjn:fix/cuda-error-check-and-vulkan-enum

Conversation

@Scottcjn
Copy link
Copy Markdown

Summary

Two small bug fixes:

1. Missing error check on cuDeviceGetName (#413)

File: Samples/7_libNVVM/simple/simple.c:72

cuDeviceGetName() was called without checkCudaErrors(). If the call fails, the sample continues with an uninitialized device name.

Fix: Wrap with checkCudaErrors() matching the pattern used on the surrounding CUDA API calls.

2. Wrong Vulkan enum type in external memory import (#409)

File: Samples/5_Domain_Specific/simpleVulkan/main.cpp:331-337

The function parameter handleType is VkExternalMemoryHandleTypeFlagBits but the comparisons used VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_* flags (a different enum). This works by coincidence because the bit values happen to match, but is incorrect per the Vulkan spec and will cause warnings with strict enum type checking.

Fix: Replace with VK_EXTERNAL_MEMORY_HANDLE_TYPE_* constants.

Test plan

  • Confirmed enum values match: VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT = 0x00000001 (same as semaphore variant)
  • No behavioral change — just type correctness

Fixes #413, Fixes #409

1. simple.c: Wrap cuDeviceGetName() with checkCudaErrors() to catch
   failures instead of silently using uninitialized device name.
   Fixes NVIDIA#413

2. simpleVulkan/main.cpp: Replace VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_*
   with VK_EXTERNAL_MEMORY_HANDLE_TYPE_* when checking memory handle
   type. The parameter is VkExternalMemoryHandleTypeFlagBits, not
   semaphore flags. Works by coincidence (same bit values) but is
   incorrect per the Vulkan spec.
   Fixes NVIDIA#409
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.

Missing check for CUDA failure in example Potential bug in simpleVulkan example

1 participant