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

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