beignet-1.3.2-coffeelake.patch 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. Description: Enable Coffee Lake support
  2. Little change is needed here because the graphics core is the same as
  3. Kaby Lake. Includes all PCI IDs currently supported by the kernel driver
  4. in the drm-intel tree (Coffee Lake S, H and U devices in GT 1, 2 and 3
  5. configurations).
  6. Origin: upstream 7e181af2ea4d37f67406f2563c0e13fa1fdbb14b
  7. Author: Mark Thompson
  8. --- a/backend/src/backend/gen_program.cpp
  9. +++ b/backend/src/backend/gen_program.cpp
  10. @@ -209,6 +209,8 @@ namespace gbe {
  11. ctx = GBE_NEW(BxtContext, unit, name, deviceID, relaxMath);
  12. } else if (IS_KABYLAKE(deviceID)) {
  13. ctx = GBE_NEW(KblContext, unit, name, deviceID, relaxMath);
  14. + } else if (IS_COFFEELAKE(deviceID)) {
  15. + ctx = GBE_NEW(KblContext, unit, name, deviceID, relaxMath);
  16. } else if (IS_GEMINILAKE(deviceID)) {
  17. ctx = GBE_NEW(GlkContext, unit, name, deviceID, relaxMath);
  18. }
  19. @@ -328,6 +330,7 @@ namespace gbe {
  20. (IS_SKYLAKE(deviceID) && MATCH_SKL_HEADER(binary)) || \
  21. (IS_BROXTON(deviceID) && MATCH_BXT_HEADER(binary)) || \
  22. (IS_KABYLAKE(deviceID) && MATCH_KBL_HEADER(binary)) || \
  23. + (IS_COFFEELAKE(deviceID) && MATCH_KBL_HEADER(binary)) || \
  24. (IS_GEMINILAKE(deviceID) && MATCH_GLK_HEADER(binary)) \
  25. )
  26. @@ -436,6 +439,8 @@ namespace gbe {
  27. FILL_BXT_HEADER(*binary);
  28. }else if(IS_KABYLAKE(prog->deviceID)){
  29. FILL_KBL_HEADER(*binary);
  30. + }else if(IS_COFFEELAKE(prog->deviceID)){
  31. + FILL_KBL_HEADER(*binary);
  32. }else if(IS_GEMINILAKE(prog->deviceID)){
  33. FILL_GLK_HEADER(*binary);
  34. }else {
  35. --- a/src/cl_device_data.h
  36. +++ b/src/cl_device_data.h
  37. @@ -372,7 +372,59 @@
  38. (devid == PCI_CHIP_GLK_3x6 || \
  39. devid == PCI_CHIP_GLK_2x6)
  40. -#define IS_GEN9(devid) (IS_SKYLAKE(devid) || IS_BROXTON(devid) || IS_KABYLAKE(devid) || IS_GEMINILAKE(devid))
  41. +#define PCI_CHIP_COFFEELAKE_S_GT1_1 0x3E90
  42. +#define PCI_CHIP_COFFEELAKE_S_GT1_2 0x3E93
  43. +#define PCI_CHIP_COFFEELAKE_S_GT1_3 0x3E99
  44. +
  45. +#define PCI_CHIP_COFFEELAKE_U_GT1_1 0x3EA1
  46. +#define PCI_CHIP_COFFEELAKE_U_GT1_2 0x3EA4
  47. +
  48. +#define PCI_CHIP_COFFEELAKE_S_GT2_1 0x3E91
  49. +#define PCI_CHIP_COFFEELAKE_S_GT2_2 0x3E92
  50. +#define PCI_CHIP_COFFEELAKE_S_GT2_3 0x3E96
  51. +#define PCI_CHIP_COFFEELAKE_S_GT2_4 0x3E9A
  52. +
  53. +#define PCI_CHIP_COFFEELAKE_H_GT2_1 0x3E94
  54. +#define PCI_CHIP_COFFEELAKE_H_GT2_2 0x3E9B
  55. +
  56. +#define PCI_CHIP_COFFEELAKE_U_GT2_1 0x3EA0
  57. +#define PCI_CHIP_COFFEELAKE_U_GT2_2 0x3EA3
  58. +#define PCI_CHIP_COFFEELAKE_U_GT2_3 0x3EA9
  59. +
  60. +#define PCI_CHIP_COFFEELAKE_U_GT3_1 0x3EA2
  61. +#define PCI_CHIP_COFFEELAKE_U_GT3_2 0x3EA5
  62. +#define PCI_CHIP_COFFEELAKE_U_GT3_3 0x3EA6
  63. +#define PCI_CHIP_COFFEELAKE_U_GT3_4 0x3EA7
  64. +#define PCI_CHIP_COFFEELAKE_U_GT3_5 0x3EA8
  65. +
  66. +#define IS_CFL_GT1(devid) \
  67. + (devid == PCI_CHIP_COFFEELAKE_S_GT1_1 || \
  68. + devid == PCI_CHIP_COFFEELAKE_S_GT1_2 || \
  69. + devid == PCI_CHIP_COFFEELAKE_S_GT1_3 || \
  70. + devid == PCI_CHIP_COFFEELAKE_U_GT1_1 || \
  71. + devid == PCI_CHIP_COFFEELAKE_U_GT1_2)
  72. +
  73. +#define IS_CFL_GT2(devid) \
  74. + (devid == PCI_CHIP_COFFEELAKE_S_GT2_1 || \
  75. + devid == PCI_CHIP_COFFEELAKE_S_GT2_2 || \
  76. + devid == PCI_CHIP_COFFEELAKE_S_GT2_3 || \
  77. + devid == PCI_CHIP_COFFEELAKE_S_GT2_4 || \
  78. + devid == PCI_CHIP_COFFEELAKE_H_GT2_1 || \
  79. + devid == PCI_CHIP_COFFEELAKE_H_GT2_2 || \
  80. + devid == PCI_CHIP_COFFEELAKE_U_GT2_1 || \
  81. + devid == PCI_CHIP_COFFEELAKE_U_GT2_2 || \
  82. + devid == PCI_CHIP_COFFEELAKE_U_GT2_3)
  83. +
  84. +#define IS_CFL_GT3(devid) \
  85. + (devid == PCI_CHIP_COFFEELAKE_U_GT3_1 || \
  86. + devid == PCI_CHIP_COFFEELAKE_U_GT3_2 || \
  87. + devid == PCI_CHIP_COFFEELAKE_U_GT3_3 || \
  88. + devid == PCI_CHIP_COFFEELAKE_U_GT3_4 || \
  89. + devid == PCI_CHIP_COFFEELAKE_U_GT3_5)
  90. +
  91. +#define IS_COFFEELAKE(devid) (IS_CFL_GT1(devid) || IS_CFL_GT2(devid) || IS_CFL_GT3(devid))
  92. +
  93. +#define IS_GEN9(devid) (IS_SKYLAKE(devid) || IS_BROXTON(devid) || IS_KABYLAKE(devid) || IS_GEMINILAKE(devid) || IS_COFFEELAKE(devid))
  94. #define MAX_OCLVERSION(devid) (IS_GEN9(devid) ? 200 : 120)
  95. --- a/src/cl_device_id.c
  96. +++ b/src/cl_device_id.c
  97. @@ -274,6 +274,36 @@ static struct _cl_device_id intel_glk12eu_device = {
  98. #include "cl_gen9_device.h"
  99. };
  100. +static struct _cl_device_id intel_cfl_gt1_device = {
  101. + .max_compute_unit = 12,
  102. + .max_thread_per_unit = 7,
  103. + .sub_slice_count = 2,
  104. + .max_work_item_sizes = {512, 512, 512},
  105. + .max_work_group_size = 256,
  106. + .max_clock_frequency = 1000,
  107. +#include "cl_gen9_device.h"
  108. +};
  109. +
  110. +static struct _cl_device_id intel_cfl_gt2_device = {
  111. + .max_compute_unit = 24,
  112. + .max_thread_per_unit = 7,
  113. + .sub_slice_count = 3,
  114. + .max_work_item_sizes = {512, 512, 512},
  115. + .max_work_group_size = 256,
  116. + .max_clock_frequency = 1000,
  117. +#include "cl_gen9_device.h"
  118. +};
  119. +
  120. +static struct _cl_device_id intel_cfl_gt3_device = {
  121. + .max_compute_unit = 48,
  122. + .max_thread_per_unit = 7,
  123. + .sub_slice_count = 6,
  124. + .max_work_item_sizes = {512, 512, 512},
  125. + .max_work_group_size = 256,
  126. + .max_clock_frequency = 1000,
  127. +#include "cl_gen9_device.h"
  128. +};
  129. +
  130. LOCAL cl_device_id
  131. cl_get_gt_device(cl_device_type device_type)
  132. {
  133. @@ -785,6 +815,64 @@ glk12eu_break:
  134. cl_intel_platform_enable_extension(ret, cl_khr_fp16_ext_id);
  135. break;
  136. + case PCI_CHIP_COFFEELAKE_S_GT1_1:
  137. + case PCI_CHIP_COFFEELAKE_S_GT1_2:
  138. + case PCI_CHIP_COFFEELAKE_S_GT1_3:
  139. + DECL_INFO_STRING(cfl_gt1_break, intel_cfl_gt1_device, name, "Intel(R) UHD Graphics Coffee Lake Desktop GT1");
  140. + case PCI_CHIP_COFFEELAKE_U_GT1_1:
  141. + case PCI_CHIP_COFFEELAKE_U_GT1_2:
  142. + DECL_INFO_STRING(cfl_gt1_break, intel_cfl_gt1_device, name, "Intel(R) UHD Graphics Coffee Lake Mobile GT1");
  143. +cfl_gt1_break:
  144. + intel_cfl_gt1_device.device_id = device_id;
  145. + intel_cfl_gt1_device.platform = cl_get_platform_default();
  146. + ret = &intel_cfl_gt1_device;
  147. + cl_intel_platform_get_default_extension(ret);
  148. +#ifdef ENABLE_FP64
  149. + cl_intel_platform_enable_extension(ret, cl_khr_fp64_ext_id);
  150. +#endif
  151. + cl_intel_platform_enable_extension(ret, cl_khr_fp16_ext_id);
  152. + break;
  153. +
  154. + case PCI_CHIP_COFFEELAKE_S_GT2_1:
  155. + case PCI_CHIP_COFFEELAKE_S_GT2_2:
  156. + case PCI_CHIP_COFFEELAKE_S_GT2_3:
  157. + case PCI_CHIP_COFFEELAKE_S_GT2_4:
  158. + DECL_INFO_STRING(cfl_gt2_break, intel_cfl_gt2_device, name, "Intel(R) UHD Graphics Coffee Lake Desktop GT2");
  159. + case PCI_CHIP_COFFEELAKE_H_GT2_1:
  160. + case PCI_CHIP_COFFEELAKE_H_GT2_2:
  161. + DECL_INFO_STRING(cfl_gt2_break, intel_cfl_gt2_device, name, "Intel(R) UHD Graphics Coffee Lake Halo GT2");
  162. + case PCI_CHIP_COFFEELAKE_U_GT2_1:
  163. + case PCI_CHIP_COFFEELAKE_U_GT2_2:
  164. + case PCI_CHIP_COFFEELAKE_U_GT2_3:
  165. + DECL_INFO_STRING(cfl_gt2_break, intel_cfl_gt2_device, name, "Intel(R) UHD Graphics Coffee Lake Mobile GT2");
  166. +cfl_gt2_break:
  167. + intel_cfl_gt2_device.device_id = device_id;
  168. + intel_cfl_gt2_device.platform = cl_get_platform_default();
  169. + ret = &intel_cfl_gt2_device;
  170. + cl_intel_platform_get_default_extension(ret);
  171. +#ifdef ENABLE_FP64
  172. + cl_intel_platform_enable_extension(ret, cl_khr_fp64_ext_id);
  173. +#endif
  174. + cl_intel_platform_enable_extension(ret, cl_khr_fp16_ext_id);
  175. + break;
  176. +
  177. + case PCI_CHIP_COFFEELAKE_U_GT3_1:
  178. + case PCI_CHIP_COFFEELAKE_U_GT3_2:
  179. + case PCI_CHIP_COFFEELAKE_U_GT3_3:
  180. + case PCI_CHIP_COFFEELAKE_U_GT3_4:
  181. + case PCI_CHIP_COFFEELAKE_U_GT3_5:
  182. + DECL_INFO_STRING(cfl_gt3_break, intel_cfl_gt3_device, name, "Intel(R) UHD Graphics Coffee Lake Mobile GT3");
  183. +cfl_gt3_break:
  184. + intel_cfl_gt3_device.device_id = device_id;
  185. + intel_cfl_gt3_device.platform = cl_get_platform_default();
  186. + ret = &intel_cfl_gt3_device;
  187. + cl_intel_platform_get_default_extension(ret);
  188. +#ifdef ENABLE_FP64
  189. + cl_intel_platform_enable_extension(ret, cl_khr_fp64_ext_id);
  190. +#endif
  191. + cl_intel_platform_enable_extension(ret, cl_khr_fp16_ext_id);
  192. + break;
  193. +
  194. case PCI_CHIP_SANDYBRIDGE_BRIDGE:
  195. case PCI_CHIP_SANDYBRIDGE_GT1:
  196. case PCI_CHIP_SANDYBRIDGE_GT2:
  197. @@ -992,7 +1080,10 @@ LOCAL cl_bool is_gen_device(cl_device_id device) {
  198. device == &intel_kbl_gt3_device ||
  199. device == &intel_kbl_gt4_device ||
  200. device == &intel_glk18eu_device ||
  201. - device == &intel_glk12eu_device;
  202. + device == &intel_glk12eu_device ||
  203. + device == &intel_cfl_gt1_device ||
  204. + device == &intel_cfl_gt2_device ||
  205. + device == &intel_cfl_gt3_device;
  206. }
  207. LOCAL cl_int
  208. @@ -1420,7 +1511,9 @@ cl_device_get_version(cl_device_id device, cl_int *ver)
  209. || device == &intel_bxt18eu_device || device == &intel_bxt12eu_device || device == &intel_kbl_gt1_device
  210. || device == &intel_kbl_gt2_device || device == &intel_kbl_gt3_device
  211. || device == &intel_kbl_gt4_device || device == &intel_kbl_gt15_device
  212. - || device == &intel_glk18eu_device || device == &intel_glk12eu_device) {
  213. + || device == &intel_glk18eu_device || device == &intel_glk12eu_device
  214. + || device == &intel_cfl_gt1_device || device == &intel_cfl_gt1_device
  215. + || device == &intel_cfl_gt3_device) {
  216. *ver = 9;
  217. } else
  218. return CL_INVALID_VALUE;