You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

meson.build 18 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. _blas_roots = [
  2. # NOTE: q, qx, x, xq do not have cblas_ rules in the Makefile
  3. # NOTE: https://developer.arm.com/documentation/101004/2310/BLAS-Basic-Linear-Algebra-Subprograms/CBLAS-functions?lang=en
  4. # Level 1
  5. { 'base': '?asum', '_types': ['s', 'd', 'q',
  6. 'sc', 'dz', 'qx'],
  7. 'fname': 'asum.c',
  8. 'cblas': true,
  9. },
  10. { 'base': '?sum', '_types': ['s', 'd', 'q',
  11. 'sc', 'dz', 'qx'],
  12. 'fname': 'sum.c',
  13. 'cblas': true,
  14. },
  15. { 'base': '?amax', '_types': ['s', 'd', 'q',
  16. 'sc', 'dz', 'qx'],
  17. 'fname': 'max.c',
  18. 'cblas': true,
  19. },
  20. { 'base': '?amin', '_types': ['s', 'd', 'q',
  21. 'sc', 'dz', 'qx'],
  22. 'fname': 'max.c',
  23. 'cblas': true,
  24. },
  25. { 'base': '?max', '_types': ['s', 'd', 'q'],
  26. 'fname': 'max.c',
  27. },
  28. { 'base': '?min', '_types': ['s', 'd', 'q'],
  29. 'fname': 'max.c',
  30. },
  31. { 'base': '?axpy', '_types': ['s', 'd', 'q'],
  32. 'fname': 'axpy.c',
  33. 'cblas': true,
  34. },
  35. { 'base': '?axpy', '_types': ['c', 'z', 'x'],
  36. 'fname': 'zaxpy.c',
  37. 'cblas': true,
  38. },
  39. { 'base': '?axpyc', '_types': ['c', 'z', 'x'],
  40. 'fname': 'zaxpy.c',
  41. 'cblas': true,
  42. },
  43. { 'base': '?copy', '_types': ['s', 'd', 'q', 'c', 'z', 'x'],
  44. 'fname': 'copy.c',
  45. 'cblas': true,
  46. },
  47. { 'base': '?dot', '_types': ['s', 'd', 'q'],
  48. 'fname': 'dot.c',
  49. 'cblas': true,
  50. },
  51. { 'base': '?dotu', '_types': ['c', 'z', 'x'],
  52. 'fname': 'zdot.c',
  53. 'cblas': true,
  54. },
  55. { 'base': '?dotc', '_types': ['c', 'z', 'x'],
  56. 'fname': 'zdot.c',
  57. 'cblas': true,
  58. },
  59. { 'base': 'cblas_?dotu_sub', '_types': ['c', 'z'],
  60. 'fname': 'zdot.c',
  61. 'cblas': false, # These don't non-cblas rules Makefile:1623:1627
  62. },
  63. { 'base': 'cblas_?dotc_sub', '_types': ['c', 'z'],
  64. 'fname': 'zdot.c',
  65. 'cblas': false, # These don't non-cblas rules Makefile:1623:1627
  66. },
  67. { 'base': '?nrm2', '_types': ['s', 'd', 'q',
  68. 'sc', 'dz', 'qx'],
  69. 'fname': 'nrm2.c',
  70. 'cblas': true, # q, qx don't have cblas_ rules Makefile:1635,1645
  71. },
  72. { 'base': '?rot', '_types': ['s', 'd', 'q'],
  73. 'fname': 'rot.c',
  74. 'cblas': true, # q doesn't have cblas_
  75. },
  76. { 'base': '?rot', '_types': ['cs', 'zd', 'xq'],
  77. 'fname': 'zrot.c',
  78. 'cblas': true,
  79. },
  80. { 'base': '?rotm', '_types': ['s', 'd', 'q'],
  81. 'fname': 'rotm.c',
  82. 'cblas': true,
  83. },
  84. { 'base': '?rotmg', '_types': ['s', 'd', 'q'],
  85. 'fname': 'rotmg.c',
  86. 'cblas': true,
  87. },
  88. { 'base': '?rotg', '_types': ['s', 'd', 'q'],
  89. 'fname': 'rotg.c',
  90. 'cblas': true,
  91. },
  92. { 'base': '?rotg', '_types': ['c', 'z', 'x'],
  93. 'fname': 'zrotg.c',
  94. 'cblas': true,
  95. },
  96. { 'base': '?scal', '_types': ['s', 'd', 'q'],
  97. 'fname': 'scal.c',
  98. 'cblas': true,
  99. },
  100. { 'base': '?scal', '_types': ['c', 'z', 'x'],
  101. 'fname': 'zscal.c',
  102. 'cblas': true, # x doesn't have cblas_
  103. },
  104. { 'base': '?scal', '_types': ['cs', 'zd', 'xq'],
  105. 'fname': 'zscal.c', 'def': [ 'SSCAL' ], 'undef': [ ],
  106. 'cblas': true,
  107. },
  108. { 'base': '?swap', '_types': ['s', 'd', 'q'],
  109. 'fname': 'swap.c',
  110. 'cblas': true,
  111. },
  112. { 'base': '?swap', '_types': ['c', 'z', 'x'],
  113. 'fname': 'zswap.c',
  114. 'cblas': true,
  115. },
  116. { 'base': '?dsdot', '_types': ['s'],
  117. 'fname': 'sdsdot.c',
  118. 'cblas': true,
  119. },
  120. { 'base': '?dsdot', '_types': [''],
  121. 'fname': 'dsdot.c',
  122. 'cblas': true,
  123. },
  124. # TODO: Handle BFLOAT16 Makefile 784:795, 1592:1603
  125. { 'base': 'i?max', '_types': ['s', 'd', 'q', 'c', 'z'], # NOTE: c,z only for cblas, Makefile:1526
  126. 'fname': 'imax.c',
  127. 'cblas': true, # TODO: Maybe 'cblas_only': ['c', 'z']
  128. },
  129. { 'base': 'i?amax', '_types': ['s', 'd', 'q', 'c', 'z', 'x'],
  130. 'fname': 'imax.c',
  131. 'cblas': true,
  132. },
  133. { 'base': 'i?amin', '_types': ['s', 'd', 'c', 'z', 'x'],
  134. 'fname': 'imax.c',
  135. 'cblas': true,
  136. },
  137. { 'base': 'i?min', '_types': ['s', 'd', 'q', 'c', 'z'], # NOTE: c,z only for cblas, Makefile:1532
  138. 'fname': 'imax.c',
  139. 'cblas': true,
  140. },
  141. # Level 2
  142. { 'base': '?ger', '_types': ['s', 'd', 'q'],
  143. 'fname': 'ger.c',
  144. 'cblas': true,
  145. },
  146. { 'base': '?geru', '_types': ['c', 'z', 'x'],
  147. 'fname': 'zger.c',
  148. 'cblas': true,
  149. },
  150. { 'base': '?gerc', '_types': ['c', 'z', 'x'],
  151. 'fname': 'zger.c',
  152. 'cblas': true,
  153. },
  154. # TODO: Handle BFLOAT16 Makefile 941:944
  155. # TODO: Handle Netlib_gemv Makefile 946:958
  156. { 'base': '?gemv', '_types': ['s', 'd', 'q'],
  157. 'fname': 'gemv.c',
  158. 'cblas': true,
  159. },
  160. { 'base': '?gemv', '_types': ['c', 'z', 'x'],
  161. 'fname': 'zgemv.c',
  162. 'cblas': true,
  163. },
  164. { 'base': '?trmv', '_types': ['s', 'd', 'q'],
  165. 'fname': 'trmv.c',
  166. 'cblas': true,
  167. },
  168. { 'base': '?trmv', '_types': ['c', 'z', 'x'],
  169. 'fname': 'ztrmv.c',
  170. 'cblas': true,
  171. },
  172. { 'base': '?trsv', '_types': ['s', 'd', 'q'],
  173. 'fname': 'trsv.c',
  174. 'cblas': true,
  175. },
  176. { 'base': '?trsv', '_types': ['c', 'z', 'x'],
  177. 'fname': 'ztrsv.c',
  178. 'cblas': true,
  179. },
  180. # TODO: Handle NO_LAPACK
  181. { 'base': '?symv', '_types': ['s', 'd', 'q'],
  182. 'fname': 'symv.c',
  183. 'cblas': true,
  184. },
  185. { 'base': '?symv', '_types': ['c', 'z', 'x'],
  186. 'fname': 'zsymv.c',
  187. 'cblas': false, # NOTE: This oddly has no cblas set..
  188. },
  189. { 'base': '?syr', '_types': ['s', 'd', 'q'],
  190. 'fname': 'syr.c',
  191. 'cblas': true,
  192. },
  193. { 'base': '?syr', '_types': ['c', 'z', 'x'],
  194. 'fname': 'zsyr.c',
  195. 'cblas': false, # NOTE: This oddly has no cblas set..
  196. },
  197. { 'base': '?syr2', '_types': ['s', 'd', 'q'],
  198. 'fname': 'syr2.c',
  199. 'cblas': true,
  200. },
  201. { 'base': '?syr2', '_types': ['c', 'z', 'x'],
  202. 'fname': 'zsyr2.c',
  203. 'cblas': false, # NOTE: This oddly has no cblas set..
  204. },
  205. { 'base': '?gbmv', '_types': ['s', 'd', 'q'],
  206. 'fname': 'gbmv.c',
  207. 'cblas': true,
  208. },
  209. { 'base': '?gbmv', '_types': ['c', 'z', 'x'],
  210. 'fname': 'zgbmv.c',
  211. 'cblas': true,
  212. },
  213. { 'base': '?sbmv', '_types': ['s', 'd', 'q'],
  214. 'fname': 'sbmv.c',
  215. 'cblas': true,
  216. },
  217. { 'base': '?sbmv', '_types': ['c', 'z', 'x'],
  218. 'fname': 'zsbmv.c',
  219. 'cblas': false, # NOTE: This oddly has no cblas set..
  220. },
  221. { 'base': '?spmv', '_types': ['s', 'd', 'q'],
  222. 'fname': 'spmv.c',
  223. 'cblas': true,
  224. },
  225. # TODO: NO_LAPACK
  226. { 'base': '?spmv', '_types': ['c', 'z', 'x'],
  227. 'fname': 'zspmv.c',
  228. 'cblas': false, # NOTE: This oddly has no cblas set..
  229. },
  230. { 'base': '?spr', '_types': ['s', 'd', 'q'],
  231. 'fname': 'spr.c',
  232. 'cblas': true,
  233. },
  234. { 'base': '?spr', '_types': ['c', 'z', 'x'],
  235. 'fname': 'zspr.c',
  236. 'cblas': false, # NOTE: This oddly has no cblas set..
  237. },
  238. { 'base': '?spr2', '_types': ['s', 'd', 'q'],
  239. 'fname': 'spr2.c',
  240. 'cblas': true,
  241. },
  242. { 'base': '?spr2', '_types': ['c', 'z', 'x'],
  243. 'fname': 'zspr2.c',
  244. 'cblas': false, # NOTE: This oddly has no cblas set..
  245. },
  246. { 'base': '?tbmv', '_types': ['s', 'd', 'q'],
  247. 'fname': 'tbmv.c',
  248. 'cblas': true,
  249. },
  250. { 'base': '?tbmv', '_types': ['c', 'z', 'x'],
  251. 'fname': 'ztbmv.c',
  252. 'cblas': true,
  253. },
  254. { 'base': '?tbsv', '_types': ['s', 'd', 'q'],
  255. 'fname': 'tbsv.c',
  256. 'cblas': true,
  257. },
  258. { 'base': '?tbsv', '_types': ['c', 'z', 'x'],
  259. 'fname': 'ztbsv.c',
  260. 'cblas': true,
  261. },
  262. { 'base': '?tpsv', '_types': ['s', 'd', 'q'],
  263. 'fname': 'tpsv.c',
  264. 'cblas': true,
  265. },
  266. { 'base': '?tpsv', '_types': ['c', 'z', 'x'],
  267. 'fname': 'ztpsv.c',
  268. 'cblas': true,
  269. },
  270. { 'base': '?tpmv', '_types': ['s', 'd', 'q'],
  271. 'fname': 'tpmv.c',
  272. 'cblas': true,
  273. },
  274. { 'base': '?tpmv', '_types': ['c', 'z', 'x'],
  275. 'fname': 'ztpmv.c',
  276. 'cblas': true,
  277. },
  278. { 'base': '?hemv', '_types': ['c', 'z', 'x'],
  279. 'fname': 'zhemv.c',
  280. 'cblas': true,
  281. },
  282. { 'base': '?hbmv', '_types': ['c', 'z', 'x'],
  283. 'fname': 'zhbmv.c',
  284. 'cblas': true,
  285. },
  286. { 'base': '?her', '_types': ['c', 'z', 'x'],
  287. 'fname': 'zher.c',
  288. 'cblas': true,
  289. },
  290. { 'base': '?her2', '_types': ['c', 'z', 'x'],
  291. 'fname': 'zher2.c',
  292. 'cblas': true,
  293. },
  294. { 'base': '?hpmv', '_types': ['c', 'z', 'x'],
  295. 'fname': 'zhpmv.c',
  296. 'cblas': true,
  297. },
  298. { 'base': '?hpr', '_types': ['c', 'z', 'x'],
  299. 'fname': 'zhpr.c',
  300. 'cblas': true,
  301. },
  302. { 'base': '?hpr2', '_types': ['c', 'z', 'x'],
  303. 'fname': 'zhpr2.c',
  304. 'cblas': true,
  305. },
  306. # TODO: BUILD_BFLOAT16 here, Makefile:1303
  307. { 'base': '?gemm', '_types': ['s', 'd', 'q',
  308. 'c', 'z', 'x'],
  309. 'fname': ['gemm.c', '../param.h'], # TODO: Will this work?
  310. 'cblas': true,
  311. },
  312. { 'base': '?gemmt', '_types': ['s', 'd', 'q',
  313. 'c', 'z', 'x'],
  314. 'fname': ['gemmt.c', '../param.h'],
  315. 'cblas': true,
  316. },
  317. { 'base': '?symm', '_types': ['s', 'd', 'q',
  318. 'c', 'z', 'x'],
  319. 'fname': 'symm.c',
  320. 'cblas': true,
  321. },
  322. { 'base': '?trmm', '_types': ['s', 'd', 'q',
  323. 'c', 'z', 'x'],
  324. 'fname': 'trsm.c', 'def': [ 'TRMM' ], 'undef': [ ],
  325. 'cblas': true,
  326. },
  327. { 'base': '?trsm', '_types': ['s', 'd', 'q',
  328. 'c', 'z', 'x'],
  329. 'fname': 'trsm.c',
  330. 'cblas': true,
  331. },
  332. { 'base': '?syrk', '_types': ['s', 'd', 'q',
  333. 'c', 'z', 'x'],
  334. 'fname': 'syrk.c',
  335. 'cblas': true,
  336. },
  337. { 'base': '?syr2k', '_types': ['s', 'd', 'q',
  338. 'c', 'z', 'x'],
  339. 'fname': 'syr2k.c',
  340. 'cblas': true,
  341. },
  342. { 'base': '?hemm', '_types': ['c', 'z', 'x'],
  343. 'fname': 'symm.c',
  344. 'cblas': true,
  345. },
  346. { 'base': '?herk', '_types': ['c', 'z', 'x'],
  347. 'fname': 'syrk.c',
  348. 'cblas': true,
  349. },
  350. { 'base': '?her2k', '_types': ['c', 'z', 'x'],
  351. 'fname': 'syr2k.c',
  352. 'cblas': true,
  353. },
  354. { 'base': '?gemm3m', '_types': ['c', 'z', 'x'],
  355. 'fname': 'gemm.c',
  356. 'cblas': true,
  357. },
  358. { 'base': '?symm3m', '_types': ['c', 'z', 'x'],
  359. 'fname': 'symm.c',
  360. },
  361. { 'base': '?hemm3m', '_types': ['c', 'z', 'x'],
  362. 'fname': 'symm.c',
  363. },
  364. { 'base': '?getf2', '_types': ['s', 'd'],
  365. 'fname': 'lapack/getf2.c',
  366. },
  367. # TODO: Makefile: 2074:2076 but doesn't exist
  368. # { 'base': '?getf2', '_types': ['q'],
  369. # 'fname': 'getf2.c',
  370. # },
  371. { 'base': '?getf2', '_types': ['c', 'z'],
  372. 'fname': 'lapack/zgetf2.c',
  373. },
  374. # TODO: Makefile: 2083:2085 but doesn't exist
  375. # { 'base': '?getf2', '_types': ['x'],
  376. # 'fname': 'zgetf2.c',
  377. # },
  378. { 'base': '?getrf', '_types': ['s', 'd'],
  379. 'fname': 'lapack/getrf.c',
  380. },
  381. # TODO: Not built, as are the other commented xdouble ones
  382. # { 'base': '?getrf', '_types': ['q'],
  383. # 'fname': 'getrf.c',
  384. # },
  385. { 'base': '?getrf', '_types': ['c', 'z'],
  386. 'fname': 'lapack/zgetrf.c',
  387. },
  388. # { 'base': '?getrf', '_types': ['x'],
  389. # 'fname': 'zgetrf.c',
  390. # },
  391. { 'base': '?lauu2', '_types': ['s', 'd'],
  392. 'fname': 'lapack/lauu2.c',
  393. },
  394. # { 'base': '?lauu2', '_types': ['q'],
  395. # 'fname': 'lauu2.c',
  396. # },
  397. { 'base': '?lauu2', '_types': ['c', 'z'],
  398. 'fname': 'lapack/zlauu2.c',
  399. },
  400. # { 'base': '?lauu2', '_types': ['x'],
  401. # 'fname': 'zlauu2.c',
  402. # },
  403. { 'base': '?lauum', '_types': ['s', 'd'],
  404. 'fname': 'lapack/lauum.c',
  405. },
  406. # { 'base': '?lauum', '_types': ['q'],
  407. # 'fname': 'lauum.c',
  408. # },
  409. { 'base': '?lauum', '_types': ['c', 'z'],
  410. 'fname': 'lapack/zlauum.c',
  411. },
  412. # { 'base': '?lauum', '_types': ['x'],
  413. # 'fname': 'zlauum.c',
  414. # },
  415. { 'base': '?potf2', '_types': ['s', 'd'],
  416. 'fname': 'lapack/potf2.c',
  417. },
  418. # { 'base': '?potf2', '_types': ['q'],
  419. # 'fname': 'potf2.c',
  420. # },
  421. { 'base': '?potf2', '_types': ['c', 'z'],
  422. 'fname': 'lapack/zpotf2.c',
  423. },
  424. # { 'base': '?potf2', '_types': ['x'],
  425. # 'fname': 'zpotf2.c',
  426. # },
  427. { 'base': '?potrf', '_types': ['s', 'd'],
  428. 'fname': 'lapack/potrf.c',
  429. },
  430. # { 'base': '?potrf', '_types': ['q'],
  431. # 'fname': 'potrf.c',
  432. # },
  433. { 'base': '?potrf', '_types': ['c', 'z'],
  434. 'fname': 'lapack/zpotrf.c',
  435. },
  436. # { 'base': '?potrf', '_types': ['x'],
  437. # 'fname': 'zpotrf.c',
  438. # },
  439. { 'base': '?trti2', '_types': ['s', 'd'],
  440. 'fname': 'lapack/trti2.c',
  441. },
  442. # { 'base': '?trti2', '_types': ['q'],
  443. # 'fname': 'trti2.c',
  444. # },
  445. { 'base': '?trti2', '_types': ['c', 'z'],
  446. 'fname': 'lapack/ztrti2.c',
  447. },
  448. # { 'base': '?trti2', '_types': ['x'],
  449. # 'fname': 'ztrti2.c',
  450. # },
  451. # { 'base': '?trti', '_types': ['s', 'd'],
  452. # 'fname': 'lapack/trti.c',
  453. # },
  454. # { 'base': '?trti', '_types': ['q'],
  455. # 'fname': 'trti.c',
  456. # },
  457. # { 'base': '?trti', '_types': ['c', 'z'],
  458. # 'fname': 'lapack/ztrti.c',
  459. # },
  460. # { 'base': '?trti', '_types': ['x'],
  461. # 'fname': 'ztrti.c',
  462. # },
  463. { 'base': '?laswp', '_types': ['s', 'd'],
  464. 'fname': 'lapack/laswp.c',
  465. },
  466. # { 'base': '?laswp', '_types': ['q'],
  467. # 'fname': 'laswp.c',
  468. # },
  469. { 'base': '?laswp', '_types': ['c', 'z'],
  470. 'fname': 'lapack/zlaswp.c',
  471. },
  472. # { 'base': '?laswp', '_types': ['x'],
  473. # 'fname': 'zlaswp.c',
  474. # },
  475. { 'base': '?getrs', '_types': ['s', 'd', 'q'],
  476. 'fname': 'lapack/getrs.c',
  477. },
  478. { 'base': '?getrs', '_types': ['c', 'z', 'x'],
  479. 'fname': 'lapack/zgetrs.c',
  480. },
  481. { 'base': '?trtrs', '_types': ['s', 'd', 'q'],
  482. 'fname': 'lapack/trtrs.c',
  483. },
  484. { 'base': '?trtrs', '_types': ['c', 'z', 'x'],
  485. 'fname': 'lapack/ztrtrs.c',
  486. },
  487. { 'base': '?gesv', '_types': ['s', 'd', 'c', 'z'],
  488. 'fname': 'lapack/gesv.c',
  489. },
  490. # { 'base': '?gesv', '_types': ['q'],
  491. # 'fname': 'gesv.c',
  492. # },
  493. # { 'base': '?gesv', '_types': ['x'],
  494. # 'fname': 'zgesv.c',
  495. # },
  496. { 'base': '?potri', '_types': ['s', 'd'],
  497. 'fname': 'lapack/potri.c',
  498. },
  499. # { 'base': '?potri', '_types': ['q'],
  500. # 'fname': 'potri.c',
  501. # },
  502. # BUG: potri is broken
  503. # { 'base': '?potri', '_types': ['c', 'z'],
  504. # 'fname': 'lapack/zpotri.c',
  505. # },
  506. # { 'base': '?potri', '_types': ['x'],
  507. # 'fname': 'zpotri.c',
  508. # },
  509. # NOTE: Where are these?
  510. # { 'base': '?larf', '_types': ['s', 'd', 'q',
  511. # 'c', 'z', 'x'],
  512. # 'fname': 'larf.c',
  513. # },
  514. # BLAS Extensions
  515. { 'base': '?axpby', '_types': ['s', 'd'],
  516. 'fname': 'axpby.c',
  517. 'cblas': true,
  518. },
  519. { 'base': '?axpby', '_types': ['c', 'z'],
  520. 'fname': 'zaxpby.c',
  521. 'cblas': true,
  522. },
  523. { 'base': '?omatcopy', '_types': ['s', 'd'],
  524. 'fname': 'omatcopy.c',
  525. 'cblas': true,
  526. },
  527. { 'base': '?omatcopy', '_types': ['c', 'z'],
  528. 'fname': 'zomatcopy.c',
  529. 'cblas': true,
  530. },
  531. { 'base': '?imatcopy', '_types': ['s', 'd'],
  532. 'fname': 'imatcopy.c',
  533. 'cblas': true,
  534. },
  535. { 'base': '?imatcopy', '_types': ['c', 'z'],
  536. 'fname': 'zimatcopy.c',
  537. 'cblas': true,
  538. },
  539. { 'base': '?geadd', '_types': ['s', 'd'],
  540. 'fname': 'geadd.c',
  541. 'cblas': true,
  542. },
  543. { 'base': '?geadd', '_types': ['c', 'z'],
  544. 'fname': 'zgeadd.c',
  545. 'cblas': true,
  546. },
  547. { 'base': '?xerbla', '_types': [''],
  548. 'fname': 'xerbla.c',
  549. 'cblas': true,
  550. },
  551. ]
  552. _interface_libs = []
  553. foreach conf : _blas_roots
  554. foreach type : conf['_types']
  555. if 'q' in type or 'x' in type
  556. # TODO: Figure out when to build these
  557. # These are the XDOUBLE symbols
  558. continue
  559. endif
  560. # Seed with common args
  561. compiler_args = [_cargs]
  562. # Generate the symbol flags
  563. base = conf['base']
  564. if symb_defs.has_key(base)
  565. symb_base = symb_defs[base]
  566. if symb_base.has_key('def')
  567. foreach _d : symb_base['def']
  568. compiler_args += ('-D' + _d)
  569. endforeach
  570. endif
  571. if symb_base.has_key('undef')
  572. foreach _u : symb_base['undef']
  573. compiler_args += ('-U' + _u)
  574. endforeach
  575. endif
  576. endif
  577. # Set the type arguments
  578. if precision_mappings.get(type).has_key('def')
  579. foreach d : precision_mappings[type]['def']
  580. compiler_args += ['-D' + d]
  581. endforeach
  582. endif
  583. if precision_mappings.get(type).has_key('undef')
  584. foreach u : precision_mappings[type]['undef']
  585. compiler_args += ['-U' + u]
  586. endforeach
  587. endif
  588. # Construct the actual symbol names, and mangled symbols
  589. # TODO: This might be conditional on other options
  590. sym_name = conf['base'].replace('?', type)
  591. sym_underscored = f'@sym_name@_'
  592. if conf.get('cblas', false)
  593. cblas_sym_name = 'cblas_' + sym_name
  594. cblas_sym_underscored = f'@cblas_sym_name@_'
  595. endif
  596. # Construct conditionals
  597. if conf.has_key('def')
  598. foreach d : conf['def']
  599. compiler_args += ['-D' + d]
  600. endforeach
  601. foreach u : conf['undef']
  602. compiler_args += ['-U' + u]
  603. endforeach
  604. endif
  605. # Make mangled symbols
  606. # TODO: This might be conditional on other options
  607. # Create the static library for each symbol
  608. lib = static_library(
  609. sym_name,
  610. sources: conf['fname'],
  611. include_directories: _inc,
  612. c_args: compiler_args + [
  613. f'-DASMNAME=@sym_name@',
  614. f'-DASMFNAME=@sym_underscored@',
  615. f'-DNAME=@sym_underscored@',
  616. f'-DCNAME=@sym_name@',
  617. f'-DCHAR_NAME="@sym_underscored@"',
  618. f'-DCHAR_CNAME="@sym_name@"'
  619. ]
  620. )
  621. _interface_libs += lib
  622. # If it's a CBLAS symbol, also create that
  623. if conf.get('cblas', false)
  624. if 'q' in type or 'x' in type
  625. # There are no cblas_q symbols
  626. # TODO: Handle edge cases around dz zd sc
  627. continue
  628. endif
  629. cblas_lib = static_library(
  630. cblas_sym_name,
  631. sources: conf['fname'],
  632. include_directories: _inc,
  633. c_args: compiler_args + [
  634. '-DCBLAS',
  635. f'-DASMNAME=@cblas_sym_name@',
  636. f'-DASMFNAME=@cblas_sym_underscored@',
  637. f'-DNAME=@cblas_sym_underscored@',
  638. f'-DCNAME=@cblas_sym_name@',
  639. f'-DCHAR_NAME="@cblas_sym_underscored@"',
  640. f'-DCHAR_CNAME="@cblas_sym_name@"'
  641. ]
  642. )
  643. _interface_libs += cblas_lib
  644. endif
  645. endforeach
  646. endforeach
  647. # Create a combined static library linking all individual static libraries
  648. _interface = static_library('_interface', link_whole: _interface_libs)