Skip to content

Clean up uses of Strided1DIndexer #1805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions dpctl/tensor/libtensor/include/kernels/accumulators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,8 @@ sycl::event inclusive_scan_iter(sycl::queue &exec_q,
size_t src_size = acc_groups - 1;
using LocalScanIndexerT =
dpctl::tensor::offset_utils::Strided1DIndexer;
const LocalScanIndexerT scan_iter_indexer{
0, static_cast<ssize_t>(iter_nelems),
static_cast<ssize_t>(src_size)};
const LocalScanIndexerT scan_iter_indexer{/* size */ iter_nelems,
/* step */ src_size};

using IterIndexerT =
dpctl::tensor::offset_utils::TwoOffsets_CombinedIndexer<
Expand Down Expand Up @@ -623,11 +622,10 @@ sycl::event inclusive_scan_iter(sycl::queue &exec_q,
using LocalScanIndexerT =
dpctl::tensor::offset_utils::Strided1DIndexer;
const LocalScanIndexerT scan1_iter_indexer{
0, static_cast<ssize_t>(iter_nelems),
static_cast<ssize_t>(size_to_update)};
const LocalScanIndexerT scan2_iter_indexer{
0, static_cast<ssize_t>(iter_nelems),
static_cast<ssize_t>(src_size)};
/* size */ iter_nelems,
/* step */ size_to_update};
const LocalScanIndexerT scan2_iter_indexer{/* size */ iter_nelems,
/* step */ src_size};

using IterIndexerT =
dpctl::tensor::offset_utils::TwoOffsets_CombinedIndexer<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ sycl::event masked_extract_all_slices_strided_impl(
/* StridedIndexer(int _nd, ssize_t _offset, ssize_t const
* *_packed_shape_strides) */
const StridedIndexer masked_src_indexer(nd, 0, packed_src_shape_strides);
const Strided1DIndexer masked_dst_indexer(0, dst_size, dst_stride);
const Strided1DIndexer masked_dst_indexer(/* size */ dst_size,
/* step */ dst_stride);

sycl::event comp_ev = exec_q.submit([&](sycl::handler &cgh) {
cgh.depends_on(depends);
Expand Down Expand Up @@ -309,8 +310,8 @@ sycl::event masked_extract_some_slices_strided_impl(

const StridedIndexer masked_src_indexer{masked_nd, 0,
packed_masked_src_shape_strides};
const Strided1DIndexer masked_dst_indexer{0, masked_dst_size,
masked_dst_stride};
const Strided1DIndexer masked_dst_indexer{/* size */ masked_dst_size,
/* step */ masked_dst_stride};

sycl::event comp_ev = exec_q.submit([&](sycl::handler &cgh) {
cgh.depends_on(depends);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,8 @@ dot_product_contig_impl(sycl::queue &exec_q,
dpctl::tensor::offset_utils::TwoOffsets_CombinedIndexer<
NoOpIndexerT, NoOpIndexerT>;

const InputBatchIndexerT inp_batch_indexer{
0, static_cast<ssize_t>(batches),
static_cast<ssize_t>(reduction_nelems)};
const InputBatchIndexerT inp_batch_indexer{/* size */ batches,
/* step */ reduction_nelems};
const InputOutputBatchIndexerT inp_out_batch_indexer{
inp_batch_indexer, inp_batch_indexer, NoOpIndexerT{}};
constexpr ReductionIndexerT reduction_indexer{NoOpIndexerT{},
Expand Down Expand Up @@ -612,9 +611,8 @@ dot_product_contig_impl(sycl::queue &exec_q,
dpctl::tensor::offset_utils::TwoOffsets_CombinedIndexer<
NoOpIndexerT, NoOpIndexerT>;

const InputBatchIndexerT inp_batch_indexer{
0, static_cast<ssize_t>(batches),
static_cast<ssize_t>(reduction_nelems)};
const InputBatchIndexerT inp_batch_indexer{/* size */ batches,
/* step */ reduction_nelems};
const InputOutputBatchIndexerT inp_out_batch_indexer{
inp_batch_indexer, inp_batch_indexer, NoOpIndexerT{}};
constexpr ReductionIndexerT reduction_indexer{NoOpIndexerT{},
Expand Down Expand Up @@ -1089,9 +1087,8 @@ sycl::event dot_product_tree_impl(sycl::queue &exec_q,
InputIndexerT, ResIndexerT>;
using ReductionIndexerT = dpctl::tensor::offset_utils::NoOpIndexer;

const InputIndexerT inp_indexer{
0, static_cast<ssize_t>(batches),
static_cast<ssize_t>(reduction_groups_)};
const InputIndexerT inp_indexer{/* size */ batches,
/* step */ reduction_groups_};
constexpr ResIndexerT res_iter_indexer{};

const InputOutputIterIndexerT in_out_iter_indexer{inp_indexer,
Expand Down Expand Up @@ -1120,9 +1117,8 @@ sycl::event dot_product_tree_impl(sycl::queue &exec_q,
InputIndexerT, ResIndexerT>;
using ReductionIndexerT = dpctl::tensor::offset_utils::NoOpIndexer;

const InputIndexerT inp_indexer{
0, static_cast<ssize_t>(batches),
static_cast<ssize_t>(remaining_reduction_nelems)};
const InputIndexerT inp_indexer{/* size */ batches,
/* step */ remaining_reduction_nelems};
const ResIndexerT res_iter_indexer{
batch_nd, batch_res_offset,
/* shape */ batch_shape_and_strides,
Expand Down Expand Up @@ -1200,9 +1196,8 @@ dot_product_contig_tree_impl(sycl::queue &exec_q,
dpctl::tensor::offset_utils::TwoOffsets_CombinedIndexer<
NoOpIndexerT, NoOpIndexerT>;

const InputBatchIndexerT inp_batch_indexer{
0, static_cast<ssize_t>(batches),
static_cast<ssize_t>(reduction_nelems)};
const InputBatchIndexerT inp_batch_indexer{/* size */ batches,
/* step */ reduction_nelems};
const InputOutputBatchIndexerT inp_out_batch_indexer{
inp_batch_indexer, inp_batch_indexer, NoOpIndexerT{}};
constexpr ReductionIndexerT reduction_indexer{NoOpIndexerT{},
Expand Down Expand Up @@ -1238,9 +1233,8 @@ dot_product_contig_tree_impl(sycl::queue &exec_q,
dpctl::tensor::offset_utils::TwoOffsets_CombinedIndexer<
NoOpIndexerT, NoOpIndexerT>;

const InputBatchIndexerT inp_batch_indexer{
0, static_cast<ssize_t>(batches),
static_cast<ssize_t>(reduction_nelems)};
const InputBatchIndexerT inp_batch_indexer{/* size */ batches,
/* step */ reduction_nelems};
const InputOutputBatchIndexerT inp_out_batch_indexer{
inp_batch_indexer, inp_batch_indexer, NoOpIndexerT{}};
constexpr ReductionIndexerT reduction_indexer{NoOpIndexerT{},
Expand Down Expand Up @@ -1307,8 +1301,8 @@ dot_product_contig_tree_impl(sycl::queue &exec_q,
NoOpIndexerT, NoOpIndexerT>;

const InputBatchIndexerT inp_batch_indexer{
0, static_cast<ssize_t>(batches),
static_cast<ssize_t>(reduction_nelems)};
/* size */ batches,
/* step */ reduction_nelems};
const InputOutputBatchIndexerT inp_out_batch_indexer{
inp_batch_indexer, inp_batch_indexer, NoOpIndexerT{}};
constexpr ReductionIndexerT reduction_indexer{NoOpIndexerT{},
Expand Down Expand Up @@ -1343,9 +1337,8 @@ dot_product_contig_tree_impl(sycl::queue &exec_q,
InputIndexerT, ResIndexerT>;
using ReductionIndexerT = dpctl::tensor::offset_utils::NoOpIndexer;

const InputIndexerT inp_indexer{
0, static_cast<ssize_t>(batches),
static_cast<ssize_t>(reduction_groups_)};
const InputIndexerT inp_indexer{/* size */ batches,
/* step */ reduction_groups_};
constexpr ResIndexerT res_iter_indexer{};

const InputOutputIterIndexerT in_out_iter_indexer{inp_indexer,
Expand Down Expand Up @@ -1374,9 +1367,8 @@ dot_product_contig_tree_impl(sycl::queue &exec_q,
InputIndexerT, ResIndexerT>;
using ReductionIndexerT = dpctl::tensor::offset_utils::NoOpIndexer;

const InputIndexerT inp_indexer{
0, static_cast<ssize_t>(batches),
static_cast<ssize_t>(remaining_reduction_nelems)};
const InputIndexerT inp_indexer{/* size */ batches,
/* step */ remaining_reduction_nelems};
constexpr ResIndexerT res_iter_indexer{};

const InputOutputIterIndexerT in_out_iter_indexer{inp_indexer,
Expand Down
Loading
Loading