Debug C++AMP code locally in Visual Studio 2019/2022 issue

Carl 20 Reputation points
2023-05-18T13:45:29.43+00:00

This document: To debug the GPU code says

In the Debugger Type list, verify that Auto is selected. Auto is the default value. In versions before Windows 10, GPU Only is the required value instead of Auto.

According to the answer, there are two situations:

  1. Debugging a single step into a kernel function, but unable to capture the values of variables in the "Local Variables" window or "Automatic Window"; Display as' An unspecified error occurred 'in the variable value field;

无标题 - 副本

  1. No matter how the project is cleaned and recompiled, the breakpoint in the kernel function cannot be hit. The prompt is: "Currently, the breakpoint cannot be hit;

无标题

Excuse me, how did the above problems arise and how should they be resolved?

Based on the occurrence of the above two situations, I have questioned the mistake of using the "auto" debugging method before, so I have switched to the "GPU only" option; If using the "Auto" option is the correct way, but the above two situations occur in debugging multiple projects, how can I solve them?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,627 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
966 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Minxin Yu 10,791 Reputation points Microsoft Vendor
    2023-05-19T03:19:48.3133333+00:00

    Hi, Carl

    Thanks for taking time to report the problem with us.
    From the latest document: The debugger cannot break on both CPU code and GPU code in the same app execution.

    By default, the debugger breaks on CPU code. To debug GPU code, use one of these two steps: In the Debug Type list on the Standard toolbar, choose GPU Only. In Solution Explorer, on the shortcut menu for the project, choose Properties. In the Property Pages dialog box, select Debugging, and then select GPU Only in the Debugger Type list.

    Regarding errors in document, you could give feedback to GitHub.

    User's image

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.