cutlass2.x源码解读之PredicatedTileAccessIterator

构造函数作用:

CUTLASS_HOST_DEVICE
PredicatedTileAccessIterator(
    Params const &params,
    Pointer pointer,
    TensorCoord extent,
    int thread_id,
    TensorCoord const &threadblock_offset,
    int const *indices = nullptr)
  1. 初始化参数params_ = params

  2. 设置谓词the_predicates(extent)

  3. 计算线程偏移set_predicates(thread_id, threadblock_offset)

  4. 设置指针add_pointer_offset(...)

add_tile_offset方法:

     两种模式
  • residue tile:第一个不完整 tile
  • steady state:后续完整 tile
    简化代码说明:
CUTLASS_DEVICE
void add_tile_offset(TensorCoord const &tile_offset) {
    if (is_residue_tile_) {
        // 1. 更新线程偏移
        the_predicates.thread_offset_ += the_predicates.residue_offset_;
    
        // 2. 重新计算谓词
        the_predicates.compute_predicates_(extent, true);
    
        // 3. 更新指针
        add_pointer_offset(layout(residue_offset_));
    
        // 4
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值