1# Math functions not yet available in the libc project, or those not yet tuned 2# for GPU workloads are provided as wrappers over vendor libraries. If we find 3# them ahead of time we will import them statically. Otherwise, we will keep 4# them as external references and expect them to be resolved by the user when 5# they compile. In the future,we will use implementations from the 'libc' 6# project and not provide these wrappers. 7find_package(AMDDeviceLibs QUIET HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm) 8if(AMDDeviceLibs_FOUND) 9 message(STATUS "Found the ROCm device library. Implementations falling back " 10 "to the vendor libraries will be resolved statically.") 11 get_target_property(ocml_path ocml IMPORTED_LOCATION) 12 set(bitcode_link_flags 13 "SHELL:-Xclang -mlink-builtin-bitcode -Xclang ${ocml_path}") 14else() 15 message(STATUS "Could not find the ROCm device library. Unimplemented " 16 "functions will be an external reference to the vendor libraries.") 17endif() 18 19add_entrypoint_object( 20 ceil 21 SRCS 22 ceil.cpp 23 HDRS 24 ../ceil.h 25 COMPILE_OPTIONS 26 -O2 27) 28 29add_entrypoint_object( 30 ceilf 31 SRCS 32 ceilf.cpp 33 HDRS 34 ../ceilf.h 35 COMPILE_OPTIONS 36 -O2 37) 38 39add_entrypoint_object( 40 copysign 41 SRCS 42 copysign.cpp 43 HDRS 44 ../copysign.h 45 COMPILE_OPTIONS 46 -O2 47) 48 49add_entrypoint_object( 50 copysignf 51 SRCS 52 copysignf.cpp 53 HDRS 54 ../copysignf.h 55 COMPILE_OPTIONS 56 -O2 57) 58 59add_entrypoint_object( 60 fabs 61 SRCS 62 fabs.cpp 63 HDRS 64 ../fabs.h 65 COMPILE_OPTIONS 66 -O2 67) 68 69add_entrypoint_object( 70 fabsf 71 SRCS 72 fabsf.cpp 73 HDRS 74 ../fabsf.h 75 COMPILE_OPTIONS 76 -O2 77) 78 79add_entrypoint_object( 80 floor 81 SRCS 82 floor.cpp 83 HDRS 84 ../floor.h 85 COMPILE_OPTIONS 86 -O2 87) 88 89add_entrypoint_object( 90 floorf 91 SRCS 92 floorf.cpp 93 HDRS 94 ../floorf.h 95 COMPILE_OPTIONS 96 -O2 97) 98 99add_entrypoint_object( 100 fma 101 SRCS 102 fma.cpp 103 HDRS 104 ../fma.h 105 COMPILE_OPTIONS 106 -O2 107) 108 109add_entrypoint_object( 110 fmaf 111 SRCS 112 fmaf.cpp 113 HDRS 114 ../fmaf.h 115 COMPILE_OPTIONS 116 -O2 117) 118 119add_entrypoint_object( 120 fmax 121 SRCS 122 fmax.cpp 123 HDRS 124 ../fmax.h 125 COMPILE_OPTIONS 126 -O2 127) 128 129add_entrypoint_object( 130 fmaxf 131 SRCS 132 fmaxf.cpp 133 HDRS 134 ../fmaxf.h 135 COMPILE_OPTIONS 136 -O2 137) 138 139add_entrypoint_object( 140 fmin 141 SRCS 142 fmin.cpp 143 HDRS 144 ../fmin.h 145 COMPILE_OPTIONS 146 -O2 147) 148 149add_entrypoint_object( 150 fminf 151 SRCS 152 fminf.cpp 153 HDRS 154 ../fminf.h 155 COMPILE_OPTIONS 156 -O2 157) 158 159add_entrypoint_object( 160 fmod 161 SRCS 162 fmod.cpp 163 HDRS 164 ../fmod.h 165 COMPILE_OPTIONS 166 -O2 167) 168 169add_entrypoint_object( 170 fmodf 171 SRCS 172 fmodf.cpp 173 HDRS 174 ../fmodf.h 175 COMPILE_OPTIONS 176 -O2 177) 178 179add_entrypoint_object( 180 nearbyint 181 SRCS 182 nearbyint.cpp 183 HDRS 184 ../nearbyint.h 185 COMPILE_OPTIONS 186 -O2 187) 188 189add_entrypoint_object( 190 nearbyintf 191 SRCS 192 nearbyintf.cpp 193 HDRS 194 ../nearbyintf.h 195 COMPILE_OPTIONS 196 -O2 197) 198 199add_entrypoint_object( 200 remainder 201 SRCS 202 remainder.cpp 203 HDRS 204 ../remainder.h 205 COMPILE_OPTIONS 206 -O2 207) 208 209add_entrypoint_object( 210 remainderf 211 SRCS 212 remainderf.cpp 213 HDRS 214 ../remainderf.h 215 COMPILE_OPTIONS 216 -O2 217) 218 219add_entrypoint_object( 220 rint 221 SRCS 222 rint.cpp 223 HDRS 224 ../rint.h 225 COMPILE_OPTIONS 226 -O2 227) 228 229add_entrypoint_object( 230 rintf 231 SRCS 232 rintf.cpp 233 HDRS 234 ../rintf.h 235 COMPILE_OPTIONS 236 -O2 237) 238 239add_entrypoint_object( 240 round 241 SRCS 242 round.cpp 243 HDRS 244 ../round.h 245 COMPILE_OPTIONS 246 -O2 247) 248 249add_entrypoint_object( 250 sqrt 251 SRCS 252 sqrt.cpp 253 HDRS 254 ../sqrt.h 255 COMPILE_OPTIONS 256 -O2 257) 258 259add_entrypoint_object( 260 sqrtf 261 SRCS 262 sqrtf.cpp 263 HDRS 264 ../sqrtf.h 265 COMPILE_OPTIONS 266 -O2 267) 268 269add_entrypoint_object( 270 trunc 271 SRCS 272 trunc.cpp 273 HDRS 274 ../trunc.h 275 COMPILE_OPTIONS 276 -O2 277) 278 279add_entrypoint_object( 280 truncf 281 SRCS 282 truncf.cpp 283 HDRS 284 ../truncf.h 285 COMPILE_OPTIONS 286 -O2 287) 288 289add_entrypoint_object( 290 frexp 291 SRCS 292 frexp.cpp 293 HDRS 294 ../frexp.h 295 COMPILE_OPTIONS 296 -O2 297) 298 299add_entrypoint_object( 300 frexpf 301 SRCS 302 frexpf.cpp 303 HDRS 304 ../frexpf.h 305 COMPILE_OPTIONS 306 -O2 307) 308 309add_entrypoint_object( 310 scalbn 311 SRCS 312 scalbn.cpp 313 HDRS 314 ../scalbn.h 315 COMPILE_OPTIONS 316 -O2 317) 318 319add_entrypoint_object( 320 scalbnf 321 SRCS 322 scalbnf.cpp 323 HDRS 324 ../scalbnf.h 325 COMPILE_OPTIONS 326 -O2 327) 328 329add_entrypoint_object( 330 ldexp 331 SRCS 332 ldexp.cpp 333 HDRS 334 ../ldexp.h 335 COMPILE_OPTIONS 336 -O2 337) 338 339add_entrypoint_object( 340 ldexpf 341 SRCS 342 ldexpf.cpp 343 HDRS 344 ../ldexpf.h 345 COMPILE_OPTIONS 346 -O2 347) 348 349# The following functions currently are not implemented natively and borrow from 350# existing implementations. This will be removed in the future. 351add_entrypoint_object( 352 acos 353 SRCS 354 acos.cpp 355 HDRS 356 ../acos.h 357 VENDOR 358 COMPILE_OPTIONS 359 ${bitcode_link_flags} 360 -O2 361) 362 363add_entrypoint_object( 364 acosh 365 SRCS 366 acosh.cpp 367 HDRS 368 ../acosh.h 369 COMPILE_OPTIONS 370 ${bitcode_link_flags} 371 -O2 372 VENDOR 373) 374 375add_entrypoint_object( 376 asin 377 SRCS 378 asin.cpp 379 HDRS 380 ../asin.h 381 COMPILE_OPTIONS 382 ${bitcode_link_flags} 383 -O2 384 VENDOR 385) 386 387add_entrypoint_object( 388 asinh 389 SRCS 390 asinh.cpp 391 HDRS 392 ../asinh.h 393 COMPILE_OPTIONS 394 ${bitcode_link_flags} 395 -O2 396 VENDOR 397) 398 399add_entrypoint_object( 400 atan 401 SRCS 402 atan.cpp 403 HDRS 404 ../atan.h 405 COMPILE_OPTIONS 406 ${bitcode_link_flags} 407 -O2 408 VENDOR 409) 410 411add_entrypoint_object( 412 atanh 413 SRCS 414 atanh.cpp 415 HDRS 416 ../atanh.h 417 COMPILE_OPTIONS 418 ${bitcode_link_flags} 419 -O2 420 VENDOR 421) 422 423add_entrypoint_object( 424 cosh 425 SRCS 426 cosh.cpp 427 HDRS 428 ../cosh.h 429 COMPILE_OPTIONS 430 ${bitcode_link_flags} 431 -O2 432 VENDOR 433) 434 435add_entrypoint_object( 436 erf 437 SRCS 438 erf.cpp 439 HDRS 440 ../erf.h 441 COMPILE_OPTIONS 442 ${bitcode_link_flags} 443 -O2 444 VENDOR 445) 446 447add_entrypoint_object( 448 powi 449 SRCS 450 powi.cpp 451 HDRS 452 ../powi.h 453 COMPILE_OPTIONS 454 ${bitcode_link_flags} 455 -O2 456 VENDOR 457) 458 459add_entrypoint_object( 460 powif 461 SRCS 462 powif.cpp 463 HDRS 464 ../powif.h 465 COMPILE_OPTIONS 466 ${bitcode_link_flags} 467 -O2 468 VENDOR 469) 470 471add_entrypoint_object( 472 sinh 473 SRCS 474 sinh.cpp 475 HDRS 476 ../sinh.h 477 COMPILE_OPTIONS 478 ${bitcode_link_flags} 479 -O2 480 VENDOR 481) 482 483add_entrypoint_object( 484 tanh 485 SRCS 486 tanh.cpp 487 HDRS 488 ../tanh.h 489 COMPILE_OPTIONS 490 ${bitcode_link_flags} 491 -O2 492 VENDOR 493) 494 495add_entrypoint_object( 496 tgamma 497 SRCS 498 tgamma.cpp 499 HDRS 500 ../tgamma.h 501 COMPILE_OPTIONS 502 ${bitcode_link_flags} 503 -O2 504 VENDOR 505) 506 507add_entrypoint_object( 508 tgammaf 509 SRCS 510 tgammaf.cpp 511 HDRS 512 ../tgammaf.h 513 COMPILE_OPTIONS 514 ${bitcode_link_flags} 515 -O2 516 VENDOR 517) 518 519add_entrypoint_object( 520 lgamma 521 SRCS 522 lgamma.cpp 523 HDRS 524 ../lgamma.h 525 COMPILE_OPTIONS 526 ${bitcode_link_flags} 527 -O2 528 VENDOR 529) 530 531add_entrypoint_object( 532 lgamma_r 533 SRCS 534 lgamma_r.cpp 535 HDRS 536 ../lgamma_r.h 537 COMPILE_OPTIONS 538 ${bitcode_link_flags} 539 -O2 540 VENDOR 541) 542