Merged
9201 vec datamove capi接口 #7325
ChenCangtaoAdd on 17 days ago
9201 vec datamove capi接口 #7325
Merged
Total: 13 files changed+1780-198
| @@ -479,6 +479,174 @@ __aicore__ inline void asc_copy_ub2gm_align(__gm__ fp8_e8m0_t* dst, __ubuf__ fp8 | |||
| 479 | asc_copy_ub2gm_align(dst, src, 1, size, static_cast<asc_store_l2_cache_mode>(0), 0, 0); | 479 | asc_copy_ub2gm_align(dst, src, 1, size, static_cast<asc_store_l2_cache_mode>(0), 0, 0); |
| 480 | } | 480 | } |
| 481 | 481 | ||
| 482 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 483 | + __ubuf__ int8_t* dst, __gm__ int8_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 484 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 485 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 486 | +{ | ||
| 487 | + if ASC_IS_AIV { | ||
| 488 | + nddma_out_to_ub_b8( | ||
| 489 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 490 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 491 | + } | ||
| 492 | +} | ||
| 493 | + | ||
| 494 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 495 | + __ubuf__ uint8_t* dst, __gm__ uint8_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 496 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 497 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 498 | +{ | ||
| 499 | + if ASC_IS_AIV { | ||
| 500 | + nddma_out_to_ub_b8( | ||
| 501 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 502 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 503 | + } | ||
| 504 | +} | ||
| 505 | + | ||
| 506 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 507 | + __ubuf__ fp4x2_e2m1_t* dst, __gm__ fp4x2_e2m1_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 508 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 509 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 510 | +{ | ||
| 511 | + if ASC_IS_AIV { | ||
| 512 | + nddma_out_to_ub_b8( | ||
| 513 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 514 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 515 | + } | ||
| 516 | +} | ||
| 517 | + | ||
| 518 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 519 | + __ubuf__ fp4x2_e1m2_t* dst, __gm__ fp4x2_e1m2_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 520 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 521 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 522 | +{ | ||
| 523 | + if ASC_IS_AIV { | ||
| 524 | + nddma_out_to_ub_b8( | ||
| 525 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 526 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 527 | + } | ||
| 528 | +} | ||
| 529 | + | ||
| 530 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 531 | + __ubuf__ fp8_e8m0_t* dst, __gm__ fp8_e8m0_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 532 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 533 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 534 | +{ | ||
| 535 | + if ASC_IS_AIV { | ||
| 536 | + nddma_out_to_ub_b8( | ||
| 537 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 538 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 539 | + } | ||
| 540 | +} | ||
| 541 | + | ||
| 542 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 543 | + __ubuf__ fp8_e5m2_t* dst, __gm__ fp8_e5m2_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 544 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 545 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 546 | +{ | ||
| 547 | + if ASC_IS_AIV { | ||
| 548 | + nddma_out_to_ub_b8( | ||
| 549 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 550 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 551 | + } | ||
| 552 | +} | ||
| 553 | + | ||
| 554 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 555 | + __ubuf__ fp8_e4m3fn_t* dst, __gm__ fp8_e4m3fn_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 556 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 557 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 558 | +{ | ||
| 559 | + if ASC_IS_AIV { | ||
| 560 | + nddma_out_to_ub_b8( | ||
| 561 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 562 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 563 | + } | ||
| 564 | +} | ||
| 565 | + | ||
| 566 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 567 | + __ubuf__ int16_t* dst, __gm__ int16_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 568 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 569 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 570 | +{ | ||
| 571 | + if ASC_IS_AIV { | ||
| 572 | + nddma_out_to_ub_b16( | ||
| 573 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 574 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 575 | + } | ||
| 576 | +} | ||
| 577 | + | ||
| 578 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 579 | + __ubuf__ uint16_t* dst, __gm__ uint16_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 580 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 581 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 582 | +{ | ||
| 583 | + if ASC_IS_AIV { | ||
| 584 | + nddma_out_to_ub_b16( | ||
| 585 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 586 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 587 | + } | ||
| 588 | +} | ||
| 589 | + | ||
| 590 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 591 | + __ubuf__ half* dst, __gm__ half* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 592 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 593 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 594 | +{ | ||
| 595 | + if ASC_IS_AIV { | ||
| 596 | + nddma_out_to_ub_b16( | ||
| 597 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 598 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 599 | + } | ||
| 600 | +} | ||
| 601 | + | ||
| 602 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 603 | + __ubuf__ bfloat16_t* dst, __gm__ bfloat16_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 604 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 605 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 606 | +{ | ||
| 607 | + if ASC_IS_AIV { | ||
| 608 | + nddma_out_to_ub_b16( | ||
| 609 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 610 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 611 | + } | ||
| 612 | +} | ||
| 613 | + | ||
| 614 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 615 | + __ubuf__ int32_t* dst, __gm__ int32_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 616 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 617 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 618 | +{ | ||
| 619 | + if ASC_IS_AIV { | ||
| 620 | + nddma_out_to_ub_b32( | ||
| 621 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 622 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 623 | + } | ||
| 624 | +} | ||
| 625 | + | ||
| 626 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 627 | + __ubuf__ uint32_t* dst, __gm__ uint32_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 628 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 629 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 630 | +{ | ||
| 631 | + if ASC_IS_AIV { | ||
| 632 | + nddma_out_to_ub_b32( | ||
| 633 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 634 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 635 | + } | ||
| 636 | +} | ||
| 637 | + | ||
| 638 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 639 | + __ubuf__ float* dst, __gm__ float* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 640 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 641 | + asc_load_l2_cache_mode l2_cache_mode) | ||
| 642 | +{ | ||
| 643 | + if ASC_IS_AIV { | ||
| 644 | + nddma_out_to_ub_b32( | ||
| 645 | + (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 646 | + loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 647 | + } | ||
| 648 | +} | ||
| 649 | + | ||
| 482 | ASC_DEPRECATED(9.2.0, "2027/09/07", asc_load_l2_cache_mode) | 650 | ASC_DEPRECATED(9.2.0, "2027/09/07", asc_load_l2_cache_mode) |
| 483 | __aicore__ inline void asc_ndim_copy_gm2ub( | 651 | __aicore__ inline void asc_ndim_copy_gm2ub( |
| 484 | __ubuf__ int8_t* dst, __gm__ int8_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | 652 | __ubuf__ int8_t* dst, __gm__ int8_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, |
| @@ -221,174 +221,6 @@ __aicore__ inline void asc_set_ndim_pad_value(float pad_value) | |||
| 221 | } | 221 | } |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 225 | - __ubuf__ int8_t* dst, __gm__ int8_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 226 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 227 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 228 | -{ | ||
| 229 | - if ASC_IS_AIV { | ||
| 230 | - nddma_out_to_ub_b8( | ||
| 231 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 232 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 233 | - } | ||
| 234 | -} | ||
| 235 | - | ||
| 236 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 237 | - __ubuf__ uint8_t* dst, __gm__ uint8_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 238 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 239 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 240 | -{ | ||
| 241 | - if ASC_IS_AIV { | ||
| 242 | - nddma_out_to_ub_b8( | ||
| 243 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 244 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 245 | - } | ||
| 246 | -} | ||
| 247 | - | ||
| 248 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 249 | - __ubuf__ fp4x2_e2m1_t* dst, __gm__ fp4x2_e2m1_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 250 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 251 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 252 | -{ | ||
| 253 | - if ASC_IS_AIV { | ||
| 254 | - nddma_out_to_ub_b8( | ||
| 255 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 256 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 257 | - } | ||
| 258 | -} | ||
| 259 | - | ||
| 260 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 261 | - __ubuf__ fp4x2_e1m2_t* dst, __gm__ fp4x2_e1m2_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 262 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 263 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 264 | -{ | ||
| 265 | - if ASC_IS_AIV { | ||
| 266 | - nddma_out_to_ub_b8( | ||
| 267 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 268 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 269 | - } | ||
| 270 | -} | ||
| 271 | - | ||
| 272 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 273 | - __ubuf__ fp8_e8m0_t* dst, __gm__ fp8_e8m0_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 274 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 275 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 276 | -{ | ||
| 277 | - if ASC_IS_AIV { | ||
| 278 | - nddma_out_to_ub_b8( | ||
| 279 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 280 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 281 | - } | ||
| 282 | -} | ||
| 283 | - | ||
| 284 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 285 | - __ubuf__ fp8_e5m2_t* dst, __gm__ fp8_e5m2_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 286 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 287 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 288 | -{ | ||
| 289 | - if ASC_IS_AIV { | ||
| 290 | - nddma_out_to_ub_b8( | ||
| 291 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 292 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 293 | - } | ||
| 294 | -} | ||
| 295 | - | ||
| 296 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 297 | - __ubuf__ fp8_e4m3fn_t* dst, __gm__ fp8_e4m3fn_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 298 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 299 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 300 | -{ | ||
| 301 | - if ASC_IS_AIV { | ||
| 302 | - nddma_out_to_ub_b8( | ||
| 303 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 304 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 305 | - } | ||
| 306 | -} | ||
| 307 | - | ||
| 308 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 309 | - __ubuf__ int16_t* dst, __gm__ int16_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 310 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 311 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 312 | -{ | ||
| 313 | - if ASC_IS_AIV { | ||
| 314 | - nddma_out_to_ub_b16( | ||
| 315 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 316 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 317 | - } | ||
| 318 | -} | ||
| 319 | - | ||
| 320 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 321 | - __ubuf__ uint16_t* dst, __gm__ uint16_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 322 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 323 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 324 | -{ | ||
| 325 | - if ASC_IS_AIV { | ||
| 326 | - nddma_out_to_ub_b16( | ||
| 327 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 328 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 329 | - } | ||
| 330 | -} | ||
| 331 | - | ||
| 332 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 333 | - __ubuf__ half* dst, __gm__ half* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 334 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 335 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 336 | -{ | ||
| 337 | - if ASC_IS_AIV { | ||
| 338 | - nddma_out_to_ub_b16( | ||
| 339 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 340 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 341 | - } | ||
| 342 | -} | ||
| 343 | - | ||
| 344 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 345 | - __ubuf__ bfloat16_t* dst, __gm__ bfloat16_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 346 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 347 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 348 | -{ | ||
| 349 | - if ASC_IS_AIV { | ||
| 350 | - nddma_out_to_ub_b16( | ||
| 351 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 352 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 353 | - } | ||
| 354 | -} | ||
| 355 | - | ||
| 356 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 357 | - __ubuf__ int32_t* dst, __gm__ int32_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 358 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 359 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 360 | -{ | ||
| 361 | - if ASC_IS_AIV { | ||
| 362 | - nddma_out_to_ub_b32( | ||
| 363 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 364 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 365 | - } | ||
| 366 | -} | ||
| 367 | - | ||
| 368 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 369 | - __ubuf__ uint32_t* dst, __gm__ uint32_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 370 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 371 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 372 | -{ | ||
| 373 | - if ASC_IS_AIV { | ||
| 374 | - nddma_out_to_ub_b32( | ||
| 375 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 376 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 377 | - } | ||
| 378 | -} | ||
| 379 | - | ||
| 380 | -__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 381 | - __ubuf__ float* dst, __gm__ float* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 382 | - uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 383 | - asc_load_l2_cache_mode l2_cache_mode) | ||
| 384 | -{ | ||
| 385 | - if ASC_IS_AIV { | ||
| 386 | - nddma_out_to_ub_b32( | ||
| 387 | - (__ubuf__ void*)dst, (__gm__ void*)src, 0, loop0_size, loop1_size, loop2_size, loop3_size, loop4_size, | ||
| 388 | - loop0_lp_count, loop0_rp_count, padding_mode, static_cast<uint8_t>(l2_cache_mode)); | ||
| 389 | - } | ||
| 390 | -} | ||
| 391 | - | ||
| 392 | __aicore__ inline void asc_ndim_copy_dci() | 224 | __aicore__ inline void asc_ndim_copy_dci() |
| 393 | { | 225 | { |
| 394 | if ASC_IS_AIV { | 226 | if ASC_IS_AIV { |
| @@ -622,6 +622,275 @@ ASC_DEPRECATED(9.1.0, "2027/09/07", asc_set_copy_pad_val) | |||
| 622 | __aicore__ inline void asc_set_gm2ub_pad(uint32_t pad_val); | 622 | __aicore__ inline void asc_set_gm2ub_pad(uint32_t pad_val); |
| 623 | 623 | ||
| 624 | #if (ASC_DEVKIT_VERSION_NUM >= 90300000) | 624 | #if (ASC_DEVKIT_VERSION_NUM >= 90300000) |
| 625 | + | ||
| 626 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 627 | + __gm__ uint8_t* dst, __ubuf__ uint8_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 628 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, uint64_t dst_stride, | ||
| 629 | + uint32_t src_stride, bool enable_retry); | ||
| 630 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 631 | + __gm__ int8_t* dst, __ubuf__ int8_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 632 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, uint64_t dst_stride, | ||
| 633 | + uint32_t src_stride, bool enable_retry); | ||
| 634 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 635 | + __gm__ uint16_t* dst, __ubuf__ uint16_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 636 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, uint64_t dst_stride, | ||
| 637 | + uint32_t src_stride, bool enable_retry); | ||
| 638 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 639 | + __gm__ int16_t* dst, __ubuf__ int16_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 640 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, uint64_t dst_stride, | ||
| 641 | + uint32_t src_stride, bool enable_retry); | ||
| 642 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 643 | + __gm__ uint32_t* dst, __ubuf__ uint32_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 644 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, uint64_t dst_stride, | ||
| 645 | + uint32_t src_stride, bool enable_retry); | ||
| 646 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 647 | + __gm__ int32_t* dst, __ubuf__ int32_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 648 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, uint64_t dst_stride, | ||
| 649 | + uint32_t src_stride, bool enable_retry); | ||
| 650 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 651 | + __gm__ half* dst, __ubuf__ half* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 652 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, uint64_t dst_stride, | ||
| 653 | + uint32_t src_stride, bool enable_retry); | ||
| 654 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 655 | + __gm__ float* dst, __ubuf__ float* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 656 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, uint64_t dst_stride, | ||
| 657 | + uint32_t src_stride, bool enable_retry); | ||
| 658 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 659 | + __gm__ hifloat8_t* dst, __ubuf__ hifloat8_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 660 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, uint64_t dst_stride, | ||
| 661 | + uint32_t src_stride, bool enable_retry); | ||
| 662 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 663 | + __gm__ bfloat16_t* dst, __ubuf__ bfloat16_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 664 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, uint64_t dst_stride, | ||
| 665 | + uint32_t src_stride, bool enable_retry); | ||
| 666 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 667 | + __gm__ fp8_e5m2_t* dst, __ubuf__ fp8_e5m2_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 668 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, uint64_t dst_stride, | ||
| 669 | + uint32_t src_stride, bool enable_retry); | ||
| 670 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 671 | + __gm__ fp8_e4m3fn_t* dst, __ubuf__ fp8_e4m3fn_t* src, uint32_t burst_count, uint32_t burst_len, | ||
| 672 | + bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, | ||
| 673 | + uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 674 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 675 | + __gm__ fp8_e8m0_t* dst, __ubuf__ fp8_e8m0_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 676 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, uint64_t dst_stride, | ||
| 677 | + uint32_t src_stride, bool enable_retry); | ||
| 678 | +__aicore__ inline void asc_remote_copy_ub2gm_align( | ||
| 679 | + __gm__ fp8_e6m2_t* dst, __ubuf__ fp8_e6m2_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 680 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, asc_store_l2_cache_mode l2_cache_mode, uint64_t dst_stride, | ||
| 681 | + uint32_t src_stride, bool enable_retry); | ||
| 682 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 683 | + __gm__ uint8_t* dst, __ubuf__ uint8_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 684 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 685 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 686 | + __gm__ uint8_t* dst, __ubuf__ uint8_t* src, uint32_t size, bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, | ||
| 687 | + uint8_t rsw_buffset_size, bool enable_retry); | ||
| 688 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 689 | + __gm__ int8_t* dst, __ubuf__ int8_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 690 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 691 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 692 | + __gm__ int8_t* dst, __ubuf__ int8_t* src, uint32_t size, bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, | ||
| 693 | + uint8_t rsw_buffset_size, bool enable_retry); | ||
| 694 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 695 | + __gm__ uint16_t* dst, __ubuf__ uint16_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 696 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 697 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 698 | + __gm__ uint16_t* dst, __ubuf__ uint16_t* src, uint32_t size, bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, | ||
| 699 | + uint8_t rsw_buffset_size, bool enable_retry); | ||
| 700 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 701 | + __gm__ int16_t* dst, __ubuf__ int16_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 702 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 703 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 704 | + __gm__ int16_t* dst, __ubuf__ int16_t* src, uint32_t size, bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, | ||
| 705 | + uint8_t rsw_buffset_size, bool enable_retry); | ||
| 706 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 707 | + __gm__ uint32_t* dst, __ubuf__ uint32_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 708 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 709 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 710 | + __gm__ uint32_t* dst, __ubuf__ uint32_t* src, uint32_t size, bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, | ||
| 711 | + uint8_t rsw_buffset_size, bool enable_retry); | ||
| 712 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 713 | + __gm__ int32_t* dst, __ubuf__ int32_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 714 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 715 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 716 | + __gm__ int32_t* dst, __ubuf__ int32_t* src, uint32_t size, bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, | ||
| 717 | + uint8_t rsw_buffset_size, bool enable_retry); | ||
| 718 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 719 | + __gm__ half* dst, __ubuf__ half* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 720 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 721 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 722 | + __gm__ half* dst, __ubuf__ half* src, uint32_t size, bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, | ||
| 723 | + uint8_t rsw_buffset_size, bool enable_retry); | ||
| 724 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 725 | + __gm__ float* dst, __ubuf__ float* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 726 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 727 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 728 | + __gm__ float* dst, __ubuf__ float* src, uint32_t size, bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, | ||
| 729 | + uint8_t rsw_buffset_size, bool enable_retry); | ||
| 730 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 731 | + __gm__ hifloat8_t* dst, __ubuf__ hifloat8_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 732 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 733 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 734 | + __gm__ hifloat8_t* dst, __ubuf__ hifloat8_t* src, uint32_t size, bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, | ||
| 735 | + uint8_t rsw_buffset_size, bool enable_retry); | ||
| 736 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 737 | + __gm__ bfloat16_t* dst, __ubuf__ bfloat16_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 738 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 739 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 740 | + __gm__ bfloat16_t* dst, __ubuf__ bfloat16_t* src, uint32_t size, bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, | ||
| 741 | + uint8_t rsw_buffset_size, bool enable_retry); | ||
| 742 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 743 | + __gm__ fp8_e5m2_t* dst, __ubuf__ fp8_e5m2_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 744 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 745 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 746 | + __gm__ fp8_e5m2_t* dst, __ubuf__ fp8_e5m2_t* src, uint32_t size, bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, | ||
| 747 | + uint8_t rsw_buffset_size, bool enable_retry); | ||
| 748 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 749 | + __gm__ fp8_e4m3fn_t* dst, __ubuf__ fp8_e4m3fn_t* src, uint32_t burst_count, uint32_t burst_len, | ||
| 750 | + bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, | ||
| 751 | + uint32_t src_stride, bool enable_retry); | ||
| 752 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 753 | + __gm__ fp8_e4m3fn_t* dst, __ubuf__ fp8_e4m3fn_t* src, uint32_t size, bool enable_rsw_ctrl, | ||
| 754 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, bool enable_retry); | ||
| 755 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 756 | + __gm__ fp8_e8m0_t* dst, __ubuf__ fp8_e8m0_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 757 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 758 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 759 | + __gm__ fp8_e8m0_t* dst, __ubuf__ fp8_e8m0_t* src, uint32_t size, bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, | ||
| 760 | + uint8_t rsw_buffset_size, bool enable_retry); | ||
| 761 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 762 | + __gm__ fp8_e6m2_t* dst, __ubuf__ fp8_e6m2_t* src, uint32_t burst_count, uint32_t burst_len, bool enable_rsw_ctrl, | ||
| 763 | + bool enable_rsw_packet_ctrl, uint8_t rsw_buffset_size, uint64_t dst_stride, uint32_t src_stride, bool enable_retry); | ||
| 764 | +__aicore__ inline void asc_remote_copy_ub2gm( | ||
| 765 | + __gm__ fp8_e6m2_t* dst, __ubuf__ fp8_e6m2_t* src, uint32_t size, bool enable_rsw_ctrl, bool enable_rsw_packet_ctrl, | ||
| 766 | + uint8_t rsw_buffset_size, bool enable_retry); | ||
| 767 | + | ||
| 768 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 769 | + __ubuf__ int8_t* dst, __gm__ int8_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 770 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 771 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 772 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 773 | + __ubuf__ uint8_t* dst, __gm__ uint8_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 774 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 775 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 776 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 777 | + __ubuf__ fp4x2_e2m1_t* dst, __gm__ fp4x2_e2m1_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 778 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 779 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 780 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 781 | + __ubuf__ fp4x2_e1m2_t* dst, __gm__ fp4x2_e1m2_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 782 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 783 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 784 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 785 | + __ubuf__ fp8_e8m0_t* dst, __gm__ fp8_e8m0_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 786 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 787 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 788 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 789 | + __ubuf__ fp8_e5m2_t* dst, __gm__ fp8_e5m2_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 790 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 791 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 792 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 793 | + __ubuf__ fp8_e4m3fn_t* dst, __gm__ fp8_e4m3fn_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 794 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 795 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 796 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 797 | + __ubuf__ int16_t* dst, __gm__ int16_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 798 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 799 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 800 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 801 | + __ubuf__ uint16_t* dst, __gm__ uint16_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 802 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 803 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 804 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 805 | + __ubuf__ half* dst, __gm__ half* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 806 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 807 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 808 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 809 | + __ubuf__ bfloat16_t* dst, __gm__ bfloat16_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 810 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 811 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 812 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 813 | + __ubuf__ int32_t* dst, __gm__ int32_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 814 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 815 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 816 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 817 | + __ubuf__ uint32_t* dst, __gm__ uint32_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 818 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 819 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 820 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 821 | + __ubuf__ float* dst, __gm__ float* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 822 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 823 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 824 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 825 | + __ubuf__ fp8_e6m2_t* dst, __gm__ fp8_e6m2_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 826 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 827 | + bool enable_pre_load_ignore_sync, asc_load_l2_cache_mode l2_cache_mode); | ||
| 828 | +__aicore__ inline void asc_ndim_copy_gm2ub( | ||
| 829 | + __ubuf__ fp8_e6m2_t* dst, __gm__ fp8_e6m2_t* src, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 830 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 831 | + asc_load_l2_cache_mode l2_cache_mode); | ||
| 832 | + | ||
| 833 | +__aicore__ inline void asc_copy_gm2ub( | ||
| 834 | + __ubuf__ void* dst, __gm__ void* src, uint32_t burst_count, uint32_t burst_len, bool enable_pre_load_ignore_sync, | ||
| 835 | + uint16_t src_stride, uint16_t dst_stride, bool enable_retry); | ||
| 836 | + | ||
| 837 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 838 | + __ubuf__ uint8_t* dst, __gm__ uint8_t* src, uint32_t burst_count, uint32_t burst_len, uint8_t left_padding_num, | ||
| 839 | + uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 840 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 841 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 842 | + __ubuf__ int8_t* dst, __gm__ int8_t* src, uint32_t burst_count, uint32_t burst_len, uint8_t left_padding_num, | ||
| 843 | + uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 844 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 845 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 846 | + __ubuf__ uint16_t* dst, __gm__ uint16_t* src, uint32_t burst_count, uint32_t burst_len, uint8_t left_padding_num, | ||
| 847 | + uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 848 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 849 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 850 | + __ubuf__ int16_t* dst, __gm__ int16_t* src, uint32_t burst_count, uint32_t burst_len, uint8_t left_padding_num, | ||
| 851 | + uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 852 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 853 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 854 | + __ubuf__ uint32_t* dst, __gm__ uint32_t* src, uint32_t burst_count, uint32_t burst_len, uint8_t left_padding_num, | ||
| 855 | + uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 856 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 857 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 858 | + __ubuf__ int32_t* dst, __gm__ int32_t* src, uint32_t burst_count, uint32_t burst_len, uint8_t left_padding_num, | ||
| 859 | + uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 860 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 861 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 862 | + __ubuf__ half* dst, __gm__ half* src, uint32_t burst_count, uint32_t burst_len, uint8_t left_padding_num, | ||
| 863 | + uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 864 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 865 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 866 | + __ubuf__ float* dst, __gm__ float* src, uint32_t burst_count, uint32_t burst_len, uint8_t left_padding_num, | ||
| 867 | + uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 868 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 869 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 870 | + __ubuf__ hifloat8_t* dst, __gm__ hifloat8_t* src, uint32_t burst_count, uint32_t burst_len, | ||
| 871 | + uint8_t left_padding_num, uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 872 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 873 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 874 | + __ubuf__ bfloat16_t* dst, __gm__ bfloat16_t* src, uint32_t burst_count, uint32_t burst_len, | ||
| 875 | + uint8_t left_padding_num, uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 876 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 877 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 878 | + __ubuf__ fp8_e5m2_t* dst, __gm__ fp8_e5m2_t* src, uint32_t burst_count, uint32_t burst_len, | ||
| 879 | + uint8_t left_padding_num, uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 880 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 881 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 882 | + __ubuf__ fp8_e8m0_t* dst, __gm__ fp8_e8m0_t* src, uint32_t burst_count, uint32_t burst_len, | ||
| 883 | + uint8_t left_padding_num, uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 884 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 885 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 886 | + __ubuf__ fp8_e4m3fn_t* dst, __gm__ fp8_e4m3fn_t* src, uint32_t burst_count, uint32_t burst_len, | ||
| 887 | + uint8_t left_padding_num, uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 888 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 889 | +__aicore__ inline void asc_copy_gm2ub_align( | ||
| 890 | + __ubuf__ fp8_e6m2_t* dst, __gm__ fp8_e6m2_t* src, uint32_t burst_count, uint32_t burst_len, | ||
| 891 | + uint8_t left_padding_num, uint8_t right_padding_num, bool enable_constant_pad, bool enable_pre_load_ignore_sync, | ||
| 892 | + asc_load_l2_cache_mode l2_cache_mode, uint64_t src_stride, uint32_t dst_stride, bool enable_retry); | ||
| 893 | + | ||
| 625 | // ==========asc_scatter_ub2gm=========== | 894 | // ==========asc_scatter_ub2gm=========== |
| 626 | __aicore__ inline void asc_scatter_ub2gm( | 895 | __aicore__ inline void asc_scatter_ub2gm( |
| 627 | __gm__ uint8_t* dst, __ubuf__ uint8_t* src, uint8_t offset_type, __ubuf__ void* offset_addr, | 896 | __gm__ uint8_t* dst, __ubuf__ uint8_t* src, uint8_t offset_type, __ubuf__ void* offset_addr, |
| @@ -27,6 +27,8 @@ static void test_host_c_api_vector_datamove_0() | |||
| 27 | using ::asc_copy_ub2ub_sync; | 27 | using ::asc_copy_ub2ub_sync; |
| 28 | using ::asc_ndim_copy_dci; | 28 | using ::asc_ndim_copy_dci; |
| 29 | using ::asc_ndim_copy_gm2ub; | 29 | using ::asc_ndim_copy_gm2ub; |
| 30 | + using ::asc_remote_copy_ub2gm; | ||
| 31 | + using ::asc_remote_copy_ub2gm_align; | ||
| 30 | using ::asc_set_copy_pad_val; | 32 | using ::asc_set_copy_pad_val; |
| 31 | using ::asc_set_gm2ub_loop1_stride; | 33 | using ::asc_set_gm2ub_loop1_stride; |
| 32 | using ::asc_set_gm2ub_loop2_stride; | 34 | using ::asc_set_gm2ub_loop2_stride; |
| @@ -0,0 +1,45 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +#include <gtest/gtest.h> | ||
| 12 | +#include "c_api/stub/cce_stub.h" | ||
| 13 | +#include "c_api/asc_simd.h" | ||
| 14 | + | ||
| 15 | +TEST(TestVectorDatamoveCopyUB2GM, CopyConfigSucc) | ||
| 16 | +{ | ||
| 17 | + __gm__ void* dst = reinterpret_cast<__gm__ void*>(11); | ||
| 18 | + __ubuf__ void* src = reinterpret_cast<__ubuf__ void*>(22); | ||
| 19 | + reset_copy_ubuf_to_gm_align_v2_stub_state(); | ||
| 20 | + asc_copy_ub2gm(dst, src, 1, 44, 5, 6); | ||
| 21 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.call_count, 1U); | ||
| 22 | + EXPECT_FALSE(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_ctrl); | ||
| 23 | + EXPECT_FALSE(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_packet_ctrl); | ||
| 24 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_buffset_size, 0U); | ||
| 25 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.l2_cache_mode, 0U); | ||
| 26 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.dst_stride, 5U); | ||
| 27 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.src_stride, 6U); | ||
| 28 | + EXPECT_FALSE(g_copy_ubuf_to_gm_align_v2_stub_state.non_eod_ctrl); | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +TEST(TestVectorDatamoveCopyUB2GM, CopySizeSucc) | ||
| 32 | +{ | ||
| 33 | + __gm__ void* dst = reinterpret_cast<__gm__ void*>(11); | ||
| 34 | + __ubuf__ void* src = reinterpret_cast<__ubuf__ void*>(22); | ||
| 35 | + reset_copy_ubuf_to_gm_align_v2_stub_state(); | ||
| 36 | + asc_copy_ub2gm(dst, src, 32U); | ||
| 37 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.call_count, 1U); | ||
| 38 | + EXPECT_FALSE(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_ctrl); | ||
| 39 | + EXPECT_FALSE(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_packet_ctrl); | ||
| 40 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_buffset_size, 0U); | ||
| 41 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.l2_cache_mode, 0U); | ||
| 42 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.dst_stride, 0U); | ||
| 43 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.src_stride, 0U); | ||
| 44 | + EXPECT_FALSE(g_copy_ubuf_to_gm_align_v2_stub_state.non_eod_ctrl); | ||
| 45 | +} | ||
| @@ -0,0 +1,53 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software; you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +#include <gtest/gtest.h> | ||
| 12 | +#include <mockcpp/mockcpp.hpp> | ||
| 13 | +#include "c_api/stub/cce_stub.h" | ||
| 14 | +#include "c_api/asc_simd.h" | ||
| 15 | + | ||
| 16 | +#define TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(data_type) \ | ||
| 17 | + \ | ||
| 18 | + class TestNdimCopyGM2UBPreLoad##data_type##CApi : public testing::Test { \ | ||
| 19 | + protected: \ | ||
| 20 | + void SetUp() {} \ | ||
| 21 | + void TearDown() {} \ | ||
| 22 | + }; \ | ||
| 23 | + \ | ||
| 24 | + TEST_F(TestNdimCopyGM2UBPreLoad##data_type##CApi, asc_ndim_copy_gm2ub_pre_load_##data_type##_Succ) \ | ||
| 25 | + { \ | ||
| 26 | + __ubuf__ data_type* dst = reinterpret_cast<__ubuf__ data_type*>(11); \ | ||
| 27 | + __gm__ data_type* src = reinterpret_cast<__gm__ data_type*>(22); \ | ||
| 28 | + asc_load_l2_cache_mode cache_mode = asc_load_l2_cache_mode::NOTALLOC_DROP; \ | ||
| 29 | + \ | ||
| 30 | + asc_ndim_copy_gm2ub( \ | ||
| 31 | + dst, src, static_cast<uint32_t>(1), static_cast<uint32_t>(2), static_cast<uint32_t>(3), \ | ||
| 32 | + static_cast<uint32_t>(4), static_cast<uint32_t>(5), static_cast<uint8_t>(6), static_cast<uint8_t>(7), \ | ||
| 33 | + true, true, cache_mode); \ | ||
| 34 | + GlobalMockObject::verify(); \ | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(int8_t); | ||
| 38 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(uint8_t); | ||
| 39 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(fp4x2_e2m1_t); | ||
| 40 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(fp4x2_e1m2_t); | ||
| 41 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(fp8_e8m0_t); | ||
| 42 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(fp8_e5m2_t); | ||
| 43 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(fp8_e4m3fn_t); | ||
| 44 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(fp8_e6m2_t); | ||
| 45 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(int16_t); | ||
| 46 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(uint16_t); | ||
| 47 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(half); | ||
| 48 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(bfloat16_t); | ||
| 49 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(int32_t); | ||
| 50 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(uint32_t); | ||
| 51 | +TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD(float); | ||
| 52 | + | ||
| 53 | +#undef TEST_VECTOR_DATAMOVE_NDIM_COPY_GM2UB_PRE_LOAD | ||
| @@ -0,0 +1,62 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software; you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +#include <gtest/gtest.h> | ||
| 12 | +#include "c_api/stub/cce_stub.h" | ||
| 13 | +#include "c_api/asc_simd.h" | ||
| 14 | + | ||
| 15 | +#define TEST_REMOTE_COPY_UB2GM(data_type) \ | ||
| 16 | + TEST(TestVectorDatamoveRemoteCopyUB2GM, CopyConfigSucc_##data_type) \ | ||
| 17 | + { \ | ||
| 18 | + __gm__ data_type* dst = reinterpret_cast<__gm__ data_type*>(11); \ | ||
| 19 | + __ubuf__ data_type* src = reinterpret_cast<__ubuf__ data_type*>(22); \ | ||
| 20 | + reset_copy_ubuf_to_gm_align_v2_stub_state(); \ | ||
| 21 | + asc_remote_copy_ub2gm(dst, src, 3, 44, true, false, 9, 5, 6, true); \ | ||
| 22 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.call_count, 1U); \ | ||
| 23 | + EXPECT_TRUE(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_ctrl); \ | ||
| 24 | + EXPECT_FALSE(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_packet_ctrl); \ | ||
| 25 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_buffset_size, 9U); \ | ||
| 26 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.l2_cache_mode, 0U); \ | ||
| 27 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.dst_stride, 5U); \ | ||
| 28 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.src_stride, 6U); \ | ||
| 29 | + EXPECT_TRUE(g_copy_ubuf_to_gm_align_v2_stub_state.non_eod_ctrl); \ | ||
| 30 | + } \ | ||
| 31 | + TEST(TestVectorDatamoveRemoteCopyUB2GM, CopySizeSucc_##data_type) \ | ||
| 32 | + { \ | ||
| 33 | + __gm__ data_type* dst = reinterpret_cast<__gm__ data_type*>(11); \ | ||
| 34 | + __ubuf__ data_type* src = reinterpret_cast<__ubuf__ data_type*>(22); \ | ||
| 35 | + reset_copy_ubuf_to_gm_align_v2_stub_state(); \ | ||
| 36 | + asc_remote_copy_ub2gm(dst, src, 44, false, true, 7, false); \ | ||
| 37 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.call_count, 1U); \ | ||
| 38 | + EXPECT_FALSE(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_ctrl); \ | ||
| 39 | + EXPECT_TRUE(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_packet_ctrl); \ | ||
| 40 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_buffset_size, 7U); \ | ||
| 41 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.l2_cache_mode, 0U); \ | ||
| 42 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.dst_stride, 0U); \ | ||
| 43 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.src_stride, 0U); \ | ||
| 44 | + EXPECT_FALSE(g_copy_ubuf_to_gm_align_v2_stub_state.non_eod_ctrl); \ | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | +TEST_REMOTE_COPY_UB2GM(uint8_t); | ||
| 48 | +TEST_REMOTE_COPY_UB2GM(int8_t); | ||
| 49 | +TEST_REMOTE_COPY_UB2GM(uint16_t); | ||
| 50 | +TEST_REMOTE_COPY_UB2GM(int16_t); | ||
| 51 | +TEST_REMOTE_COPY_UB2GM(uint32_t); | ||
| 52 | +TEST_REMOTE_COPY_UB2GM(int32_t); | ||
| 53 | +TEST_REMOTE_COPY_UB2GM(half); | ||
| 54 | +TEST_REMOTE_COPY_UB2GM(float); | ||
| 55 | +TEST_REMOTE_COPY_UB2GM(hifloat8_t); | ||
| 56 | +TEST_REMOTE_COPY_UB2GM(bfloat16_t); | ||
| 57 | +TEST_REMOTE_COPY_UB2GM(fp8_e5m2_t); | ||
| 58 | +TEST_REMOTE_COPY_UB2GM(fp8_e4m3fn_t); | ||
| 59 | +TEST_REMOTE_COPY_UB2GM(fp8_e8m0_t); | ||
| 60 | +TEST_REMOTE_COPY_UB2GM(fp8_e6m2_t); | ||
| 61 | + | ||
| 62 | +#undef TEST_REMOTE_COPY_UB2GM | ||
| @@ -0,0 +1,52 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software; you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +#include <gtest/gtest.h> | ||
| 12 | +#include "c_api/stub/cce_stub.h" | ||
| 13 | +#include "c_api/asc_simd.h" | ||
| 14 | + | ||
| 15 | +#define TEST_REMOTE_COPY_UB2GM_ALIGN(data_type) \ | ||
| 16 | + TEST(TestVectorDatamoveRemoteCopyUB2GM, CopyConfigAlignSucc_##data_type) \ | ||
| 17 | + { \ | ||
| 18 | + __gm__ data_type* dst = reinterpret_cast<__gm__ data_type*>(11); \ | ||
| 19 | + __ubuf__ data_type* src = reinterpret_cast<__ubuf__ data_type*>(22); \ | ||
| 20 | + reset_copy_ubuf_to_gm_align_v2_stub_state(); \ | ||
| 21 | + \ | ||
| 22 | + asc_remote_copy_ub2gm_align( \ | ||
| 23 | + dst, src, 3, 44, true, false, 9, asc_store_l2_cache_mode::NORMAL_FIRST_VICTIM, 5, 6, true); \ | ||
| 24 | + \ | ||
| 25 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.call_count, 1U); \ | ||
| 26 | + EXPECT_TRUE(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_ctrl); \ | ||
| 27 | + EXPECT_FALSE(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_packet_ctrl); \ | ||
| 28 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_buffset_size, 9U); \ | ||
| 29 | + EXPECT_EQ( \ | ||
| 30 | + g_copy_ubuf_to_gm_align_v2_stub_state.l2_cache_mode, \ | ||
| 31 | + static_cast<uint8_t>(asc_store_l2_cache_mode::NORMAL_FIRST_VICTIM)); \ | ||
| 32 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.dst_stride, 5U); \ | ||
| 33 | + EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.src_stride, 6U); \ | ||
| 34 | + EXPECT_TRUE(g_copy_ubuf_to_gm_align_v2_stub_state.non_eod_ctrl); \ | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | +TEST_REMOTE_COPY_UB2GM_ALIGN(uint8_t); | ||
| 38 | +TEST_REMOTE_COPY_UB2GM_ALIGN(int8_t); | ||
| 39 | +TEST_REMOTE_COPY_UB2GM_ALIGN(uint16_t); | ||
| 40 | +TEST_REMOTE_COPY_UB2GM_ALIGN(int16_t); | ||
| 41 | +TEST_REMOTE_COPY_UB2GM_ALIGN(uint32_t); | ||
| 42 | +TEST_REMOTE_COPY_UB2GM_ALIGN(int32_t); | ||
| 43 | +TEST_REMOTE_COPY_UB2GM_ALIGN(half); | ||
| 44 | +TEST_REMOTE_COPY_UB2GM_ALIGN(float); | ||
| 45 | +TEST_REMOTE_COPY_UB2GM_ALIGN(hifloat8_t); | ||
| 46 | +TEST_REMOTE_COPY_UB2GM_ALIGN(bfloat16_t); | ||
| 47 | +TEST_REMOTE_COPY_UB2GM_ALIGN(fp8_e5m2_t); | ||
| 48 | +TEST_REMOTE_COPY_UB2GM_ALIGN(fp8_e4m3fn_t); | ||
| 49 | +TEST_REMOTE_COPY_UB2GM_ALIGN(fp8_e8m0_t); | ||
| 50 | +TEST_REMOTE_COPY_UB2GM_ALIGN(fp8_e6m2_t); | ||
| 51 | + | ||
| 52 | +#undef TEST_REMOTE_COPY_UB2GM_ALIGN | ||
| @@ -0,0 +1,64 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +#include <gtest/gtest.h> | ||
| 12 | +#include "c_api/stub/cce_stub.h" | ||
| 13 | +#include "c_api/asc_simd.h" | ||
| 14 | + | ||
| 15 | +#define RESET_COPY_GM2UB() reset_copy_gm_to_ubuf_align_v2_stub_state() | ||
| 16 | + | ||
| 17 | +#define VERIFY_COPY_GM2UB() \ | ||
| 18 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.call_count, 1U); \ | ||
| 19 | + EXPECT_FALSE(g_copy_gm_to_ubuf_align_v2_stub_state.pre_allocation); \ | ||
| 20 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.l2_cache_mode, 0U); \ | ||
| 21 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.src_stride, 0U); \ | ||
| 22 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.dst_stride, 0U); \ | ||
| 23 | + EXPECT_FALSE(g_copy_gm_to_ubuf_align_v2_stub_state.non_eod_ctrl) | ||
| 24 | + | ||
| 25 | +class TestVectorDatamoveCopyGM2UBCApi : public testing::Test {}; | ||
| 26 | + | ||
| 27 | +TEST_F(TestVectorDatamoveCopyGM2UBCApi, CopyConfigSucc) | ||
| 28 | +{ | ||
| 29 | + __ubuf__ void* dst = reinterpret_cast<__ubuf__ void*>(11); | ||
| 30 | + __gm__ void* src = reinterpret_cast<__gm__ void*>(22); | ||
| 31 | + RESET_COPY_GM2UB(); | ||
| 32 | + asc_copy_gm2ub( | ||
| 33 | + dst, src, static_cast<uint32_t>(1), static_cast<uint32_t>(44), static_cast<uint64_t>(0), | ||
| 34 | + static_cast<uint32_t>(0)); | ||
| 35 | + VERIFY_COPY_GM2UB(); | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +TEST_F(TestVectorDatamoveCopyGM2UBCApi, CopySizeSucc) | ||
| 39 | +{ | ||
| 40 | + __ubuf__ void* dst = reinterpret_cast<__ubuf__ void*>(11); | ||
| 41 | + __gm__ void* src = reinterpret_cast<__gm__ void*>(22); | ||
| 42 | + RESET_COPY_GM2UB(); | ||
| 43 | + asc_copy_gm2ub(dst, src, static_cast<uint32_t>(44)); | ||
| 44 | + VERIFY_COPY_GM2UB(); | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +TEST_F(TestVectorDatamoveCopyGM2UBCApi, CopyExtendedConfigSucc) | ||
| 48 | +{ | ||
| 49 | + __ubuf__ void* dst = reinterpret_cast<__ubuf__ void*>(11); | ||
| 50 | + __gm__ void* src = reinterpret_cast<__gm__ void*>(22); | ||
| 51 | + RESET_COPY_GM2UB(); | ||
| 52 | + asc_copy_gm2ub( | ||
| 53 | + dst, src, static_cast<uint32_t>(1), static_cast<uint32_t>(44), true, static_cast<uint16_t>(5), | ||
| 54 | + static_cast<uint16_t>(6), true); | ||
| 55 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.call_count, 1U); | ||
| 56 | + EXPECT_TRUE(g_copy_gm_to_ubuf_align_v2_stub_state.pre_allocation); | ||
| 57 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.l2_cache_mode, 0U); | ||
| 58 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.src_stride, 5U); | ||
| 59 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.dst_stride, 6U); | ||
| 60 | + EXPECT_TRUE(g_copy_gm_to_ubuf_align_v2_stub_state.non_eod_ctrl); | ||
| 61 | +} | ||
| 62 | + | ||
| 63 | +#undef RESET_COPY_GM2UB | ||
| 64 | +#undef VERIFY_COPY_GM2UB | ||
| @@ -49,6 +49,42 @@ | |||
| 49 | RESET_COPY_GM2UB_ALIGN(); \ | 49 | RESET_COPY_GM2UB_ALIGN(); \ |
| 50 | c_api_name(dst, src, static_cast<uint32_t>(44)); \ | 50 | c_api_name(dst, src, static_cast<uint32_t>(44)); \ |
| 51 | VERIFY_COPY_GM2UB_ALIGN(); \ | 51 | VERIFY_COPY_GM2UB_ALIGN(); \ |
| 52 | + } \ | ||
| 53 | + \ | ||
| 54 | + TEST_F(TestVectorDatamove##class_name##_##data_type##_CApi, c_api_name##_ExtendedConfig_Succ) \ | ||
| 55 | + { \ | ||
| 56 | + __ubuf__ data_type* dst = reinterpret_cast<__ubuf__ data_type*>(11); \ | ||
| 57 | + __gm__ data_type* src = reinterpret_cast<__gm__ data_type*>(22); \ | ||
| 58 | + RESET_COPY_GM2UB_ALIGN(); \ | ||
| 59 | + c_api_name( \ | ||
| 60 | + dst, src, static_cast<uint32_t>(1), static_cast<uint32_t>(44), static_cast<uint8_t>(0), \ | ||
| 61 | + static_cast<uint8_t>(0), false, true, asc_load_l2_cache_mode::NORMAL_FIRST_VICTIM, \ | ||
| 62 | + static_cast<uint64_t>(5), static_cast<uint32_t>(6), true); \ | ||
| 63 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.call_count, 1U); \ | ||
| 64 | + EXPECT_TRUE(g_copy_gm_to_ubuf_align_v2_stub_state.pre_allocation); \ | ||
| 65 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.l2_cache_mode, 0U); \ | ||
| 66 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.src_stride, 5U); \ | ||
| 67 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.dst_stride, 6U); \ | ||
| 68 | + EXPECT_TRUE(g_copy_gm_to_ubuf_align_v2_stub_state.non_eod_ctrl); \ | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | +#define TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_EXTENDED_INSTR(class_name, c_api_name, data_type) \ | ||
| 72 | + class TestVectorDatamove##class_name##_##data_type##_CApi : public testing::Test {}; \ | ||
| 73 | + TEST_F(TestVectorDatamove##class_name##_##data_type##_CApi, c_api_name##_ExtendedConfig_Succ) \ | ||
| 74 | + { \ | ||
| 75 | + __ubuf__ data_type* dst = reinterpret_cast<__ubuf__ data_type*>(11); \ | ||
| 76 | + __gm__ data_type* src = reinterpret_cast<__gm__ data_type*>(22); \ | ||
| 77 | + RESET_COPY_GM2UB_ALIGN(); \ | ||
| 78 | + c_api_name( \ | ||
| 79 | + dst, src, static_cast<uint32_t>(1), static_cast<uint32_t>(44), static_cast<uint8_t>(0), \ | ||
| 80 | + static_cast<uint8_t>(0), false, true, asc_load_l2_cache_mode::NORMAL_FIRST_VICTIM, \ | ||
| 81 | + static_cast<uint64_t>(5), static_cast<uint32_t>(6), true); \ | ||
| 82 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.call_count, 1U); \ | ||
| 83 | + EXPECT_TRUE(g_copy_gm_to_ubuf_align_v2_stub_state.pre_allocation); \ | ||
| 84 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.l2_cache_mode, 0U); \ | ||
| 85 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.src_stride, 5U); \ | ||
| 86 | + EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.dst_stride, 6U); \ | ||
| 87 | + EXPECT_TRUE(g_copy_gm_to_ubuf_align_v2_stub_state.non_eod_ctrl); \ | ||
| 52 | } | 88 | } |
| 53 | 89 | ||
| 54 | TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_INSTR(CopyGM2UBALIGN, asc_copy_gm2ub_align, uint8_t); | 90 | TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_INSTR(CopyGM2UBALIGN, asc_copy_gm2ub_align, uint8_t); |
| @@ -63,21 +99,10 @@ TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_INSTR(CopyGM2UBALIGN, asc_copy_gm2ub_align | |||
| 63 | TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_INSTR(CopyGM2UBALIGN, asc_copy_gm2ub_align, bfloat16_t); | 99 | TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_INSTR(CopyGM2UBALIGN, asc_copy_gm2ub_align, bfloat16_t); |
| 64 | TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_INSTR(CopyGM2UBALIGN, asc_copy_gm2ub_align, fp8_e5m2_t); | 100 | TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_INSTR(CopyGM2UBALIGN, asc_copy_gm2ub_align, fp8_e5m2_t); |
| 65 | TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_INSTR(CopyGM2UBALIGN, asc_copy_gm2ub_align, fp8_e4m3fn_t); | 101 | TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_INSTR(CopyGM2UBALIGN, asc_copy_gm2ub_align, fp8_e4m3fn_t); |
| 66 | - | 102 | +TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_EXTENDED_INSTR(CopyGM2UBALIGN, asc_copy_gm2ub_align, fp8_e8m0_t); |
| 67 | -TEST(TestVectorDatamoveCopyGM2UB, CopyConfigSucc) | 103 | +TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_EXTENDED_INSTR(CopyGM2UBALIGN, asc_copy_gm2ub_align, fp8_e6m2_t); |
| 68 | -{ | ||
| 69 | - __ubuf__ void* dst = reinterpret_cast<__ubuf__ void*>(11); | ||
| 70 | - __gm__ void* src = reinterpret_cast<__gm__ void*>(22); | ||
| 71 | - RESET_COPY_GM2UB_ALIGN(); | ||
| 72 | - asc_copy_gm2ub(dst, src, 1, 44, 5, 6); | ||
| 73 | - EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.call_count, 1U); | ||
| 74 | - EXPECT_FALSE(g_copy_gm_to_ubuf_align_v2_stub_state.pre_allocation); | ||
| 75 | - EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.l2_cache_mode, 0U); | ||
| 76 | - EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.src_stride, 5U); | ||
| 77 | - EXPECT_EQ(g_copy_gm_to_ubuf_align_v2_stub_state.dst_stride, 6U); | ||
| 78 | - EXPECT_FALSE(g_copy_gm_to_ubuf_align_v2_stub_state.non_eod_ctrl); | ||
| 79 | -} | ||
| 80 | 104 | ||
| 81 | #undef RESET_COPY_GM2UB_ALIGN | 105 | #undef RESET_COPY_GM2UB_ALIGN |
| 82 | #undef VERIFY_COPY_GM2UB_ALIGN | 106 | #undef VERIFY_COPY_GM2UB_ALIGN |
| 83 | #undef TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_INSTR | 107 | #undef TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_INSTR |
| 108 | +#undef TEST_VECTOR_DATAMOVE_COPY_GM2UB_ALIGN_EXTENDED_INSTR | ||
| @@ -65,22 +65,6 @@ TEST_VECTOR_DATAMOVE_COPY_UBUF_TO_GM_ALIGN(CopyUB2GMALIGN, asc_copy_ub2gm_align, | |||
| 65 | TEST_VECTOR_DATAMOVE_COPY_UBUF_TO_GM_ALIGN(CopyUB2GMALIGN, asc_copy_ub2gm_align, fp8_e5m2_t); | 65 | TEST_VECTOR_DATAMOVE_COPY_UBUF_TO_GM_ALIGN(CopyUB2GMALIGN, asc_copy_ub2gm_align, fp8_e5m2_t); |
| 66 | TEST_VECTOR_DATAMOVE_COPY_UBUF_TO_GM_ALIGN(CopyUB2GMALIGN, asc_copy_ub2gm_align, fp8_e4m3fn_t); | 66 | TEST_VECTOR_DATAMOVE_COPY_UBUF_TO_GM_ALIGN(CopyUB2GMALIGN, asc_copy_ub2gm_align, fp8_e4m3fn_t); |
| 67 | 67 | ||
| 68 | -TEST(TestVectorDatamoveCopyUB2GM, CopyConfigSucc) | ||
| 69 | -{ | ||
| 70 | - __gm__ void* dst = reinterpret_cast<__gm__ void*>(11); | ||
| 71 | - __ubuf__ void* src = reinterpret_cast<__ubuf__ void*>(22); | ||
| 72 | - RESET_COPY_UB2GM_ALIGN(); | ||
| 73 | - asc_copy_ub2gm(dst, src, 1, 44, 5, 6); | ||
| 74 | - EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.call_count, 1U); | ||
| 75 | - EXPECT_FALSE(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_ctrl); | ||
| 76 | - EXPECT_FALSE(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_packet_ctrl); | ||
| 77 | - EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.rsw_buffset_size, 0U); | ||
| 78 | - EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.l2_cache_mode, 0U); | ||
| 79 | - EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.dst_stride, 5U); | ||
| 80 | - EXPECT_EQ(g_copy_ubuf_to_gm_align_v2_stub_state.src_stride, 6U); | ||
| 81 | - EXPECT_FALSE(g_copy_ubuf_to_gm_align_v2_stub_state.non_eod_ctrl); | ||
| 82 | -} | ||
| 83 | - | ||
| 84 | #undef RESET_COPY_UB2GM_ALIGN | 68 | #undef RESET_COPY_UB2GM_ALIGN |
| 85 | #undef VERIFY_COPY_UB2GM_ALIGN | 69 | #undef VERIFY_COPY_UB2GM_ALIGN |
| 86 | #undef TEST_VECTOR_DATAMOVE_COPY_UBUF_TO_GM_ALIGN | 70 | #undef TEST_VECTOR_DATAMOVE_COPY_UBUF_TO_GM_ALIGN |
| @@ -1302,6 +1302,20 @@ inline void copy_gm_to_ubuf_align_v2( | |||
| 1302 | { | 1302 | { |
| 1303 | record_copy_gm_to_ubuf_align_v2(reserved, l2_cache_ctl, burst_src_stride, burst_dst_stride, reserved2); | 1303 | record_copy_gm_to_ubuf_align_v2(reserved, l2_cache_ctl, burst_src_stride, burst_dst_stride, reserved2); |
| 1304 | } | 1304 | } |
| 1305 | +inline void copy_gm_to_ubuf_align_v2( | ||
| 1306 | + __ubuf__ fp8_e8m0_t* dst_addr, __gm__ fp8_e8m0_t* src_addr, uint8_t sid, uint32_t burst_num, uint32_t burst_len, | ||
| 1307 | + uint8_t left_padding_count, uint8_t right_padding_count, bool constant_padding_ctl, bool reserved, | ||
| 1308 | + uint8_t l2_cache_ctl, uint64_t burst_src_stride, uint32_t burst_dst_stride, bool reserved2) | ||
| 1309 | +{ | ||
| 1310 | + record_copy_gm_to_ubuf_align_v2(reserved, l2_cache_ctl, burst_src_stride, burst_dst_stride, reserved2); | ||
| 1311 | +} | ||
| 1312 | +inline void copy_gm_to_ubuf_align_v2( | ||
| 1313 | + __ubuf__ fp8_e6m2_t* dst_addr, __gm__ fp8_e6m2_t* src_addr, uint8_t sid, uint32_t burst_num, uint32_t burst_len, | ||
| 1314 | + uint8_t left_padding_count, uint8_t right_padding_count, bool constant_padding_ctl, bool reserved, | ||
| 1315 | + uint8_t l2_cache_ctl, uint64_t burst_src_stride, uint32_t burst_dst_stride, bool reserved2) | ||
| 1316 | +{ | ||
| 1317 | + record_copy_gm_to_ubuf_align_v2(reserved, l2_cache_ctl, burst_src_stride, burst_dst_stride, reserved2); | ||
| 1318 | +} | ||
| 1305 | inline void copy_gm_to_cbuf_multi_dn2nz( | 1319 | inline void copy_gm_to_cbuf_multi_dn2nz( |
| 1306 | __cbuf__ fp8_e5m2_t* dst_addr, __gm__ fp8_e5m2_t* src_addr, uint8_t sid, uint64_t loop1_src_stride, | 1320 | __cbuf__ fp8_e5m2_t* dst_addr, __gm__ fp8_e5m2_t* src_addr, uint8_t sid, uint64_t loop1_src_stride, |
| 1307 | uint8_t l2_cache_ctl, uint16_t n_value, uint32_t d_value, uint64_t loop4_src_stride, bool smallc0_en, bool reserved) | 1321 | uint8_t l2_cache_ctl, uint16_t n_value, uint32_t d_value, uint64_t loop4_src_stride, bool smallc0_en, bool reserved) |
| @@ -1559,6 +1573,24 @@ inline int32_t g_coreType = 2; | |||
| 1559 | 1573 | ||
| 1560 | // ==========9201 v2 instruction stubs========== | 1574 | // ==========9201 v2 instruction stubs========== |
| 1561 | #if defined(__NPU_ARCH__) && (__NPU_ARCH__ == 9201) | 1575 | #if defined(__NPU_ARCH__) && (__NPU_ARCH__ == 9201) |
| 1576 | +inline void nddma_out_to_ub_b8( | ||
| 1577 | + __ubuf__ void* dst, __gm__ void* src, uint8_t sid, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 1578 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 1579 | + bool enable_pre_load_ignore_sync, uint8_t l2_cache_ctl) | ||
| 1580 | +{} | ||
| 1581 | + | ||
| 1582 | +inline void nddma_out_to_ub_b16( | ||
| 1583 | + __ubuf__ void* dst, __gm__ void* src, uint8_t sid, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 1584 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 1585 | + bool enable_pre_load_ignore_sync, uint8_t l2_cache_ctl) | ||
| 1586 | +{} | ||
| 1587 | + | ||
| 1588 | +inline void nddma_out_to_ub_b32( | ||
| 1589 | + __ubuf__ void* dst, __gm__ void* src, uint8_t sid, uint32_t loop0_size, uint32_t loop1_size, uint32_t loop2_size, | ||
| 1590 | + uint32_t loop3_size, uint32_t loop4_size, uint8_t loop0_lp_count, uint8_t loop0_rp_count, bool padding_mode, | ||
| 1591 | + bool enable_pre_load_ignore_sync, uint8_t l2_cache_ctl) | ||
| 1592 | +{} | ||
| 1593 | + | ||
| 1562 | inline void vfma(vector_f16& dst, vector_f16 src0, vector_f16 src1, vector_bool mask, Literal mode) {} | 1594 | inline void vfma(vector_f16& dst, vector_f16 src0, vector_f16 src1, vector_bool mask, Literal mode) {} |
| 1563 | inline void vfma(vector_bf16& dst, vector_bf16 src0, vector_bf16 src1, vector_bool mask, Literal mode) {} | 1595 | inline void vfma(vector_bf16& dst, vector_bf16 src0, vector_bf16 src1, vector_bool mask, Literal mode) {} |
| 1564 | inline void vfma(vector_f32& dst, vector_f32 src0, vector_f32 src1, vector_bool mask, Literal mode) {} | 1596 | inline void vfma(vector_f32& dst, vector_f32 src0, vector_f32 src1, vector_bool mask, Literal mode) {} |
🟡 Medium Priority
本 hunk 在 impl/c_api/reg_base_impl/vector_datamove_intf_impl.h 中删除了 14 个旧签名(无
enable_pre_load_ignore_sync参数)的asc_ndim_copy_gm2ub定义(原 224-390 行,int8_t…float)。该文件是公共实现文件:它只在__NPU_ARCH__ == 3510/== 9201时额外 include 架构专有实现(第 23-27 行),删除的这些定义本身不在任何架构条件编译块内,是其余架构(既非 3510 也非 9201 的编译目标)唯一的定义来源。与此同时 include/c_api/vector_datamove/vector_datamove.h 第 340-395 行仍然无条件声明旧式asc_ndim_copy_gm2ub(...asc_load_l2_cache_mode)重载(未改动),本 diff 又在 884-887 行新增了旧式fp8_e6m2_t重载声明。后果:在这些架构上编译任何调用旧式asc_ndim_copy_gm2ub的 kernel,会得到“inline function used but never defined”告警并最终链接失败(旧代码是可编译的,属于回归)。触发条件是目标架构不是 3510/9201 且使用了该旧接口;由于头文件仍公开声明它,调用方无法从声明侧感知不可用。建议:二选一保持一致:要么保留(或在非 3510/9201 分支下补回)这些旧签名定义,要么同步删除 vector_datamove.h 第 340-395 行与 884-887 行对应的旧式声明(并用 ASC_DEPRECATED 或版本宏标记),避免头文件声明与实现不匹配。