standards-proposals icon indicating copy to clipboard operation
standards-proposals copied to clipboard

Accessor aliases

Open ProGTX opened this issue 6 years ago • 3 comments

In order to reduce the verbosity of programming with SYCL accessors, this proposal aims to reduce the number of template parameters to just 2 from the current 5. It achieves this by slightly revising how to treat read-only data and adding alias templates based on the access target.

  1. Main changes
    • Default accessor template parameters
    • Simplify access modes
    • Alias templates based on access target
    • Extend the handler class
  2. Accessor alias templates
    • `constant_buffer_accessor
    • host_accessor
  3. Treat const T the same as access::mode::read
    • Simplifies a lot of code
  4. Define implicit conversions for equivalent types
  5. Implicit conversions that add const
  6. Overload for handler::require that also takes an access mode
  • To weaken the access mode
  1. Default all accessor template parameters
  • Expect the data type
  • Default to an accessor to global buffer with read-write access
  • Assumes accessors can be a placeholder without template parameter
  1. Discussed some considerations and alternatives
  2. Examples of reduced verbosity

ProGTX avatar Sep 22 '19 19:09 ProGTX

That looks like a good simplification. You could also add some CTAD if compiled with C++17 or higher.

@keryell I've greatly simplified the proposal, and I've added a section on CTAD. I think I would need to add deduction guides to the accessor class, I might still add that. There's also the problem that CTAD doesn't work on alias templates in C++17, so maybe I should add something for C++20 as well?

ProGTX avatar Mar 09 '20 09:03 ProGTX

That looks good. Probably you need to coordinate with Intel to unify the simplifications they are pushing for too.

keryell avatar Mar 10 '20 19:03 keryell

I've pushed revision 0.3, which focuses a lot more on CTAD and makes host_accessor a separate type

ProGTX avatar Apr 06 '20 12:04 ProGTX