gpu_group.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef GPU_GROUP_H
  2. #define GPU_GROUP_H
  3. #include <isl/schedule_node.h>
  4. #include "gpu.h"
  5. /* A group of array references in a kernel that should be handled together.
  6. * If private_tile is not NULL, then it is mapped to registers.
  7. * Otherwise, if shared_tile is not NULL, it is mapped to shared memory.
  8. * Otherwise, it is accessed from global memory.
  9. * Note that if both private_tile and shared_tile are set, then shared_tile
  10. * is only used inside group_common_shared_memory_tile.
  11. */
  12. struct gpu_array_ref_group {
  13. /* The references in this group access this local array. */
  14. struct gpu_local_array_info *local_array;
  15. /* This is the corresponding array. */
  16. struct gpu_array_info *array;
  17. /* Position of this group in the list of reference groups of array. */
  18. int nr;
  19. /* The following fields are use during the construction of the groups.
  20. * access is the combined access relation relative to the private
  21. * memory tiling. In particular, the domain of the map corresponds
  22. * to the first thread_depth dimensions of the kernel schedule.
  23. * write is set if any access in the group is a write.
  24. * exact_write is set if all writes are definite writes.
  25. * slice is set if there is at least one access in the group
  26. * that refers to more than one element
  27. * "min_depth" is the minimum of the tile depths and thread_depth.
  28. */
  29. isl_map *access;
  30. int write;
  31. int exact_write;
  32. int slice;
  33. int min_depth;
  34. /* The shared memory tile, NULL if none. */
  35. struct gpu_array_tile *shared_tile;
  36. /* The private memory tile, NULL if none. */
  37. struct gpu_array_tile *private_tile;
  38. /* References in this group; point to elements of a linked list. */
  39. int n_ref;
  40. struct gpu_stmt_access **refs;
  41. };
  42. int gpu_group_references(struct ppcg_kernel *kernel,
  43. __isl_keep isl_schedule_node *node);
  44. __isl_give isl_printer *gpu_array_ref_group_print_name(
  45. struct gpu_array_ref_group *group, __isl_take isl_printer *p);
  46. void gpu_array_ref_group_compute_tiling(struct gpu_array_ref_group *group);
  47. __isl_give isl_union_map *gpu_array_ref_group_access_relation(
  48. struct gpu_array_ref_group *group, int read, int write);
  49. int gpu_array_ref_group_requires_unroll(struct gpu_array_ref_group *group);
  50. enum ppcg_group_access_type gpu_array_ref_group_type(
  51. struct gpu_array_ref_group *group);
  52. struct gpu_array_tile *gpu_array_ref_group_tile(
  53. struct gpu_array_ref_group *group);
  54. struct gpu_array_ref_group *gpu_array_ref_group_free(
  55. struct gpu_array_ref_group *group);
  56. #endif