Sycl: Practical Tips

Chapter 13 List of Tips

Just noting down tips as I grasp them rather than code or details.

  1. Multiarchitecture Binary Fat Heavy Binary that supports multiple platforms.
  2. Compilation can be JIT or AOT. JIT preferred unless AOT is needed like fpga.
  3. JIT portable AOT fat basically. JIT Intermediate Representation like llvm mlir.
  4. Contexts represent device or devices on which code can run.
  5. Devices can have sub devices which behave exactly like devices.
  6. USM can be shared between devices in same context.
  7. Contexts are expensive to create. Less I make the better.
  8. Thread Safety, Introduce Parallelism, Fine tuning.
  9. Sycl can be used alongside openmp, tbb, mpi etc.
  10. Run debugging on CPU. Compile with debugging flags, compile with debug info.
  11. debugging deadlock -> move from out of order to in order queue, queue.wait().
  12. debugging kernel code -> break points before or after parallel for.
  13. kernels provide a c++ like out stream
  14. debugging runtime failures LOOK AT THE ERRORS.
  15. Don’t need to abort can catch or code around them. Use Dump Tools when all fails.
  16. Check aspect::queue_profiling to see if device supports queue_profiling.
  17. Enable profiling get profiling info etc.
  18. Tracing and Profiling tools one trace and oneprof.
  19. Don’t access host memory(array or vec)directly after creating a buffer from it.
  20. To avoid using host memory before buffer goes out of scope use host_accessors.
  21. Make sure host accessors are destroyed to return memory back and unlock use of kernel.
  22. while host accessor is alive runtime doesn’t allow buffer to be used by any device.
  23. To call functions in different translation unit use SYCL_EXTERNAL.
  24. only used on functions, no raw pointers only classes as param or return type.
  25. Can’t call parallel_for_work_item method. cannot be called from parallel_for_work_group.
  26. multiple translation unit can have performance implications so measure and tune.
  27. Lambdas can be named with when multiple sycl tools are used.

← Back to all posts