none
Are entire structs captured by (AMP) lambdas or only the used members? RRS feed

  • Question

  • Hi all,

    Are entire structs captured by (AMP) lambdas or only the used members? E.g., if float3::x is used by a lambda are the y and z members also using constant memory?

    Cheers,

    T

    Monday, August 20, 2012 10:16 AM

Answers

  • Hi T,

    The entry lambda of parallel_for_each works as a normal C++ lambda, and thus, if a data member of a struct is used by the lambda, the entire struct is captured, i.e., becomes a data member of the lambda object. And the whole lambda object will be accessed via the constant memory.

    Thanks,
    Lingli

    • Proposed as answer by Zhu, Weirong Monday, August 20, 2012 5:26 PM
    • Marked as answer by TwoPointSevenOh Tuesday, August 21, 2012 6:52 AM
    Monday, August 20, 2012 5:21 PM
    Moderator

All replies

  • Hi T,

    The entry lambda of parallel_for_each works as a normal C++ lambda, and thus, if a data member of a struct is used by the lambda, the entire struct is captured, i.e., becomes a data member of the lambda object. And the whole lambda object will be accessed via the constant memory.

    Thanks,
    Lingli

    • Proposed as answer by Zhu, Weirong Monday, August 20, 2012 5:26 PM
    • Marked as answer by TwoPointSevenOh Tuesday, August 21, 2012 6:52 AM
    Monday, August 20, 2012 5:21 PM
    Moderator
  •  Hi Lingli,

    I understand. Thanks for your reply.

    Cheers,

    T

    Tuesday, August 21, 2012 6:52 AM