alpaka-group / alpaka

Abstraction Library for Parallel Kernel Acceleration :llama:
https://alpaka.readthedocs.io
Mozilla Public License 2.0
349 stars 72 forks source link

std::is_trivially_copyable constraint on kernel arguments and functions #2367

Open jasminmohnke opened 4 weeks ago

jasminmohnke commented 4 weeks ago

As previously talked about, the std::is_trivially_copyable constraint enforcement for kernel arguments and kernel functions that were introduced with release version 0.9.0 lead to some issues for us. While the traits introduced with #2198 and #2302 help mitigate this, in practice it is not very sustainable for us to declare IsKernelTriviallyCopyable for each templated kernel that requires this. It would be helpful to have something like a compile-time option that makes it possible to avoid this std::is_trivially_copyable check alltogether giving the responsibility that this is the case back to the user if they choose so.

psychocoderHPC commented 3 weeks ago

It should be possible that you implement a specialization in your user code but with the same possible side affects a flag will have where the check is disabled.

namespace alpaka::trait
{
  template<typename T>
  struct IsKernelArgumentTriviallyCopyable<T,void>
      : std::true_type
  {
  };
}

This will evaluate for any kernel to true and therefore disable the check.