-
-
Notifications
You must be signed in to change notification settings - Fork 202
feat: Implement the GPU Info gathering within the Native SDK #1336
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
Open
mujacica
wants to merge
58
commits into
master
Choose a base branch
from
native-gpu-info
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
2ffa22d
feat: Implement the GPU Info gathering within the Native SDK
mujacica 792c1af
Fix file format
mujacica ae6c5f6
Add changelog entry
mujacica a1fa547
Extend README with new SENTRY_WITH_GPU_INFO option
mujacica 1d7de99
Skip apple silicon tests on non darwin platforms
mujacica 2c2bd6d
Enable GPU Info per default to test cmake on github runners
mujacica e98bfb3
Resolve compiler issues on Linux
mujacica 52d8c44
Fix Windows builds
mujacica 1aeb0f2
Fix failing tests
mujacica bf248f3
Fix IOS builds
mujacica 5620eac
Fix remaining failing tests
mujacica 63d8620
Fix format
mujacica 0bfff8a
Keep GPU Info disabled by default
mujacica 3df5f64
Fix CMake for all platforms
mujacica 42e6b81
Fix comments, and findings from testing
mujacica f22b5cb
Further testing fixes
mujacica 3b8e940
Fix failing test
mujacica 0771c62
Use Sentry wstr function instead of custom implementation
mujacica 958f720
Simplify Unix implementation and CMakeLists
mujacica ed42e48
Add nvml support, add multi-gpu support
mujacica 3eecedf
Fix linux complier warnings
mujacica eab9dbb
Fix file formats
mujacica ce7deb1
Fix build issues after refactoring
mujacica 635b3d5
Fix file formats
mujacica abcf048
Use Vulkan for GPU info with multi-platform support
mujacica 19a588c
Fix file format
mujacica 19da153
Fix None implementation
mujacica 7da6373
Don't use singleton
mujacica 9713125
Fix format
mujacica ca4f058
Simplify driver version, remove test script
mujacica 7b4eceb
Use Vulkan headers, dynamically load
mujacica 57d11e5
Fix format
mujacica 553cd55
Fix CMake to include headers only
mujacica a5f5d88
Fix 32-bit builds
mujacica d3e5fd9
Fix GPU test pritnf formats
mujacica 408b3c7
Fix format
mujacica 072b03a
One more test fix
mujacica 8b81b22
Fix format
mujacica 1ded02e
Fix cursor comment
mujacica 61d288a
Update src/gpu/sentry_gpu_vulkan.c
mujacica 2a1efb9
Update src/gpu/sentry_gpu_vulkan.c
mujacica 2452945
Update tests/unit/test_gpu.c
mujacica f05f610
Update README.md
mujacica 2aef893
Fix PR Comments
mujacica fb3a571
Update tests/unit/test_gpu.c
mujacica 239aa5b
Further fixes
mujacica 0f26974
Fix memory units
mujacica 427ee77
Fix docs
mujacica 25adf1d
Fix more comments
mujacica 64fcd67
Fix Mac compatibility
mujacica 9bc68f3
Fix Vendor ID's
mujacica 9053706
Fix memory size to MB
mujacica f86dae5
Fix CHANGELOG
mujacica 3e996d9
Fix review findings: harden GPU info, disable by default
mujacica 1a0dc3a
Move GPU changelog entry to Unreleased section
mujacica 1021456
Fix VK_INCOMPLETE handling, GPU context key gaps, and formatting
mujacica 1b64cf0
fix(gpu): reset function pointers on partial Vulkan load failure
mujacica 5d328bc
fix(gpu): add forward declaration for unload_vulkan_library
mujacica File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -197,3 +197,4 @@ target_include_directories(breakpad_client | |
| PUBLIC | ||
| "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" | ||
| ) | ||
|
|
||
Submodule vulkan-headers
added at
2efaa5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| #include "sentry_gpu.h" | ||
| #include "sentry_logger.h" | ||
| #include "sentry_string.h" | ||
|
|
||
| char * | ||
| sentry__gpu_vendor_id_to_name(unsigned int vendor_id) | ||
| { | ||
| switch (vendor_id) { | ||
| case 0x10DE: | ||
| return sentry__string_clone("NVIDIA Corporation"); | ||
| case 0x1002: | ||
| case 0x1022: | ||
| return sentry__string_clone("Advanced Micro Devices, Inc. [AMD/ATI]"); | ||
mujacica marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| case 0x8086: | ||
| return sentry__string_clone("Intel Corporation"); | ||
| case 0x106B: | ||
| return sentry__string_clone("Apple Inc."); | ||
| case 0x1414: | ||
| return sentry__string_clone("Microsoft Corporation"); | ||
| case 0x5143: | ||
| case 0x17CB: | ||
| return sentry__string_clone("Qualcomm"); | ||
mujacica marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| case 0x13B5: | ||
| return sentry__string_clone("ARM"); | ||
| case 0x144D: | ||
| return sentry__string_clone("Samsung Electronics"); | ||
| case 0x1AE0: | ||
| return sentry__string_clone("Google"); | ||
| case 0x1010: | ||
| return sentry__string_clone("VideoLogic"); | ||
| case 0x1023: | ||
| return sentry__string_clone("Trident Microsystems"); | ||
| case 0x102B: | ||
| return sentry__string_clone("Matrox Graphics"); | ||
| case 0x121A: | ||
| return sentry__string_clone("3dfx Interactive"); | ||
| case 0x18CA: | ||
| return sentry__string_clone("XGI Technology"); | ||
| case 0x1039: | ||
| return sentry__string_clone("Silicon Integrated Systems [SiS]"); | ||
| case 0x126F: | ||
| return sentry__string_clone("Silicon Motion"); | ||
| default: { | ||
| char unknown_vendor[64]; | ||
| snprintf(unknown_vendor, sizeof(unknown_vendor), "Unknown (0x%04X)", | ||
| vendor_id); | ||
| return sentry__string_clone(unknown_vendor); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| static sentry_value_t | ||
| create_gpu_context_from_info(sentry_gpu_info_t *gpu_info) | ||
| { | ||
mujacica marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (!gpu_info) { | ||
| SENTRY_WARN("No GPU info provided. Skipping GPU context creation."); | ||
| return sentry_value_new_null(); | ||
| } | ||
mujacica marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| sentry_value_t gpu_context = sentry_value_new_object(); | ||
| if (sentry_value_is_null(gpu_context)) { | ||
| return gpu_context; | ||
| } | ||
mujacica marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Add type field for frontend recognition | ||
| sentry_value_set_by_key( | ||
| gpu_context, "type", sentry_value_new_string("gpu")); | ||
|
|
||
| // Add GPU name | ||
| if (gpu_info->name) { | ||
| sentry_value_set_by_key( | ||
| gpu_context, "name", sentry_value_new_string(gpu_info->name)); | ||
| } | ||
|
|
||
| // Add vendor information | ||
| if (gpu_info->vendor_name) { | ||
| sentry_value_set_by_key(gpu_context, "vendor_name", | ||
| sentry_value_new_string(gpu_info->vendor_name)); | ||
| } | ||
|
|
||
| if (gpu_info->vendor_id != 0) { | ||
| char vendor_id_str[32]; | ||
| snprintf( | ||
| vendor_id_str, sizeof(vendor_id_str), "%u", gpu_info->vendor_id); | ||
| sentry_value_set_by_key( | ||
| gpu_context, "vendor_id", sentry_value_new_string(vendor_id_str)); | ||
| } | ||
|
|
||
| // Add device ID | ||
| if (gpu_info->device_id != 0) { | ||
| char device_id_str[32]; | ||
| snprintf( | ||
| device_id_str, sizeof(device_id_str), "%u", gpu_info->device_id); | ||
| sentry_value_set_by_key( | ||
| gpu_context, "device_id", sentry_value_new_string(device_id_str)); | ||
| } | ||
|
|
||
| // Add memory size | ||
| if (gpu_info->memory_size > 0) { | ||
| sentry_value_set_by_key(gpu_context, "memory_size", | ||
| sentry_value_new_uint64(gpu_info->memory_size)); | ||
| } | ||
|
|
||
| // Add driver version | ||
| if (gpu_info->driver_version) { | ||
| sentry_value_set_by_key(gpu_context, "driver_version", | ||
| sentry_value_new_string(gpu_info->driver_version)); | ||
| } | ||
|
|
||
| sentry_value_freeze(gpu_context); | ||
| return gpu_context; | ||
| } | ||
|
|
||
| void | ||
| sentry__free_gpu_info(sentry_gpu_info_t *gpu_info) | ||
| { | ||
| if (!gpu_info) { | ||
| return; | ||
| } | ||
|
|
||
| sentry_free(gpu_info->name); | ||
| sentry_free(gpu_info->vendor_name); | ||
| sentry_free(gpu_info->driver_version); | ||
| sentry_free(gpu_info); | ||
| } | ||
|
|
||
| void | ||
| sentry__free_gpu_list(sentry_gpu_list_t *gpu_list) | ||
| { | ||
| if (!gpu_list) { | ||
| return; | ||
| } | ||
|
|
||
| for (unsigned int i = 0; i < gpu_list->count; i++) { | ||
| sentry__free_gpu_info(gpu_list->gpus[i]); | ||
| } | ||
|
|
||
| sentry_free(gpu_list->gpus); | ||
| sentry_free(gpu_list); | ||
| } | ||
|
|
||
| void | ||
| sentry__add_gpu_contexts(sentry_value_t contexts) | ||
| { | ||
| sentry_gpu_list_t *gpu_list = sentry__get_gpu_info(); | ||
| if (!gpu_list) { | ||
| return; | ||
| } | ||
|
|
||
| unsigned int context_index = 0; | ||
| for (unsigned int i = 0; i < gpu_list->count; i++) { | ||
| sentry_value_t gpu_context | ||
| = create_gpu_context_from_info(gpu_list->gpus[i]); | ||
| if (!sentry_value_is_null(gpu_context)) { | ||
| // Use context_index (not i) so keys are contiguous: gpu, gpu2, gpu3 | ||
| char context_key[32]; | ||
| if (context_index == 0) { | ||
| snprintf(context_key, sizeof(context_key), "gpu"); | ||
| } else { | ||
| snprintf(context_key, sizeof(context_key), "gpu%u", | ||
| context_index + 1); | ||
| } | ||
mujacica marked this conversation as resolved.
Show resolved
Hide resolved
mujacica marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| sentry_value_set_by_key(contexts, context_key, gpu_context); | ||
| context_index++; | ||
| } | ||
mujacica marked this conversation as resolved.
Show resolved
Hide resolved
mujacica marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| sentry__free_gpu_list(gpu_list); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #include "sentry_gpu.h" | ||
|
|
||
| sentry_gpu_list_t * | ||
| sentry__get_gpu_info(void) | ||
| { | ||
| return NULL; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.