0

In Sycl,if I want to pass a sycl::vec<double 3> to another function, is it better to pass it by value or by const reference?

How can I see the output of the target code? Is there something like compiler explorer for sycl cuda? (I'm using the Intell Clang / DPC++ compiler)

Eric Yen
  • 3
  • 2
  • Hi Eric, to address the target code question, there are a couple of outstanding issues that we hope to resolve to get SYCL implementations in Compiler Explorer. The blocker is more from a legal perspective related to licensing but hopefully that will be resolved soon. – Rod Burns Nov 16 '21 at 09:07
  • Thanks @RodBurns! I really look forwards to seeing it in compiler explorer! – Eric Yen Nov 16 '21 at 18:28

1 Answers1

1

Generally the best practice in C++ has been to pass cheap copied types by value and other types by const reference. The idea being that the compiler can optimize more if passed by value, but larger types can be expensive to copy if not passed by reference. I think for the vec class it should be fine to copy by value as (on the device side at least) it's treated as a built-in type.

Rod Burns
  • 2,104
  • 13
  • 24