Skip to content

Regarding Pipeline Operations in tlp_v2_upsert_kernel_with_io Interface (upsert.cuh) #224

Description

@zhangyachen

In the tlp_v2_upsert_kernel_with_io interface of the upsert.cuh file, when the cooperative thread group writes values in a pipelined operation, why is __pipeline_wait_prior(0) used here? Does using __pipeline_wait_prior(0) also block prefetch operations, preventing the pipeline effect from being achieved?

  constexpr uint32_t GROUP_BUFs =
      GROUP_SIZE * 2 * STRIDE_S * sizeof(S) / sizeof(VecV);
  constexpr uint32_t GROUP_BUF = GROUP_BUFs / 2;
  auto sm_values_buffer =
      reinterpret_cast<VecV*>(&(sm_bucket_scores[0][0])) + groupID * GROUP_BUFs;

  auto occupy_result_next = g.shfl(occupy_result, 0);
  if ((occupy_result_next != OccupyResult::ILLEGAL) &&
      (occupy_result_next != OccupyResult::REFUSED)) {
    VecV* dst = sm_values_buffer;
    auto kv_idx_next = g.shfl(kv_idx, 0);
    const VecV* src = values + kv_idx_next * dim;
    CopyValue::ldg_sts(rank, dst, src, dim);
  }
  __pipeline_commit();

  for (int i = 0; i < GROUP_SIZE; i++) {
    if (i + 1 < GROUP_SIZE) {
      auto occupy_result_next = g.shfl(occupy_result, i + 1);
      if ((occupy_result_next != OccupyResult::ILLEGAL) &&
          (occupy_result_next != OccupyResult::REFUSED)) {
        VecV* dst = sm_values_buffer + diff_buf(i) * GROUP_BUF;
        auto kv_idx_next = g.shfl(kv_idx, i + 1);
        const VecV* src = values + kv_idx_next * dim;
        CopyValue::ldg_sts(rank, dst, src, dim);
      }
    }
    __pipeline_commit();
    auto occupy_result_cur = g.shfl(occupy_result, i);
    if ((occupy_result_cur != OccupyResult::ILLEGAL) &&
        (occupy_result_cur != OccupyResult::REFUSED)) {
      VecV* src = sm_values_buffer + same_buf(i) * GROUP_BUF;
     // --------- question about this code block
      __pipeline_wait_prior(0);           // this line
     // ----------
      VecV* dst = g.shfl(bucket_value_ptr, i);
      __pipeline_wait_prior(1);
      CopyValue::lds_stg(rank, dst, src, dim);
    }
  }

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions