Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7624509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:58:58+00:00 2026-05-31T04:58:58+00:00

In C++ AMP, kernel functions or lambdas are marked with restrict(amp), which imposes severe

  • 0

In C++ AMP, kernel functions or lambdas are marked with restrict(amp), which imposes severe restrictions on the allowed subset of C++ (listed here). Does CUDA allow any more freedom on the subset of C or C++ in kernel functions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:59:00+00:00Added an answer on May 31, 2026 at 4:59 am

    As of Visual Studio 11 and CUDA 4.1, restrict(amp) functions are more restrictive than CUDA’s analogous __device__ functions. Most noticeably, AMP is more restrictive about how pointers can be used. This is a natural consequence of AMP’s DirectX11 computational substrate, which disallows pointers in HLSL (graphics shader) code. By constrast, CUDA’s lower-level IR is PTX, which is more general purpose than HLSL.

    Here’s a line by line comparison:

    | VS 11 AMP restrict(amp) functions     | CUDA 4.1 sm_2x __device__ functions  |
    |------------------------------------------------------------------------------|
    |* can only call functions that have    |* can only call functions that have   |
    |  the restrict(amp) clause             |  the __device__ decoration           |
    |* The function must be inlinable       |* need not be inlined                 |
    |* The function can declare only        |* Class types are allowed             |
    |  POD variables                        |                                      |
    |* Lambda functions cannot              |* Lambdas are not supported, but      |
    |  capture by reference and             |  user functors can hold pointers     |
    |  cannot capture pointers              |                                      |
    |* References and single-indirection    |* References and multiple-indirection |
    |  pointers are supported only as       |  pointers are supported              |
    |  local variables and function         |                                      |
    |* No recursion                         |* Recursion OK                        |
    |* No volatile variables                |* Volatile variables OK               |
    |* No virtual functions                 |* Virtual functions OK                |
    |* No pointers to functions             |* Pointers to functions OK            |
    |* No pointers to member functions      |* Pointers to member functions OK     |
    |* No pointers in structures            |* Pointers in structures OK           |
    |* No pointers to pointers              |* Pointers to pointers OK             |
    |* No goto statements                   |* goto statements OK                  |
    |* No labeled statements                |* Labeled statements OK               |
    |* No try, catch, or throw statements   |* No try, catch, or throw statements  |
    |* No global variables                  |* Global __device__ variables OK      |
    |* Static variables through tile_static |* Static variables through __shared__ |
    |* No dynamic_cast                      |* No dynamic_cast                     |
    |* No typeid operator                   |* No typeid operator                  |
    |* No asm declarations                  |* asm declarations (inline PTX) OK    |
    |* No varargs                           |* No varargs                          |
    

    You can read more about restrict(amp)‘s restrictions here. You can read about C++ support in CUDA __device__ functions in Appendix D of the CUDA C Programming Guide.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

User-Defined Functions & Collating Sequences Full support for user-defined functions and collating sequences means
I have a buggy kernel module which I am trying to fix. Basically when
I am using the following two functions to time different parts (cudaMemcpyHtoD, kernel execution,
So I'm working on a linux Kernel module which requires an infinite waiting loop
as stated in: http://www.kernel.org/doc/htmldocs/kernel-hacking.html#routines-copy this functions can sleep. So, do I always have to
I have written a kernel module which reads and writes /proc files, and it
& has && . | has || . Why doesn't ^ have ^^ ?
& Eacute ; \u00C9 & egrave ; \u00E8 & eacute ; \u00E9 & apos
  shows some symbol istead of space in IE? could you tell me why?
K&R C Programming Language: pg. 105 Extend entab and detab to accept the shorthand

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.