Skip to content

Commit

Permalink
mk_runtime_error formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
oOTigger committed Oct 8, 2024
1 parent d50914c commit f1f2698
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions lib/kernels/include/kernels/accessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class GenericTensorAccessorW {
throw mk_runtime_error("Calling at() on non-CPU allocated tensor");
}
if (this->data_type != DT) {
throw mk_runtime_error(
"Invalid access data type ({} != {})", this->data_type, DT);
throw mk_runtime_error(fmt::format(
"Invalid access data type ({} != {})", this->data_type, DT));
}

using T = real_type_t<DT>;
Expand All @@ -64,8 +64,8 @@ class GenericTensorAccessorW {
throw mk_runtime_error("Calling at() on non-CPU allocated tensor");
}
if (this->data_type != DT) {
throw mk_runtime_error(
"Invalid access data type ({} != {})", this->data_type, DT);
throw mk_runtime_error(fmt::format(
"Invalid access data type ({} != {})", this->data_type, DT));
}

using T = real_type_t<DT>;
Expand Down Expand Up @@ -131,7 +131,7 @@ class GenericTensorAccessorR {
}
if (this->data_type != DT) {
throw mk_runtime_error(
"Invalid access data type ({} != {})", this->data_type, DT);
fmt::format("Invalid access data type ({} != {})", this->data_type, DT));
}

using T = real_type_t<DT>;
Expand Down
16 changes: 8 additions & 8 deletions lib/kernels/src/accessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ size_t GenericTensorAccessorW::calculate_index_offset(
std::initializer_list<size_t> const &indices) const {

if (indices.size() != this->shape.num_dims()) {
throw mk_runtime_error(
throw mk_runtime_error(fmt::format(
"Number of indices ({}) does not match the number of dimensions ({}).",
indices.size(),
this->shape.num_dims());
this->shape.num_dims()));
}

size_t offset = 0;
Expand All @@ -36,11 +36,11 @@ size_t GenericTensorAccessorW::calculate_index_offset(
cur_idx = *it--;

if (cur_idx >= this->shape[legion_dim_t(i)]) {
throw mk_runtime_error("In {} dimension, attempting to access index {} "
throw mk_runtime_error(fmt::format("In {} dimension, attempting to access index {} "
"when only {} indexes exist",
i,
cur_idx,
this->shape[legion_dim_t(i)]);
this->shape[legion_dim_t(i)]));
}

offset += cur_idx * multiplier;
Expand Down Expand Up @@ -110,10 +110,10 @@ size_t GenericTensorAccessorR::calculate_index_offset(
std::initializer_list<size_t> const &indices) const {

if (indices.size() != this->shape.num_dims()) {
throw mk_runtime_error(
throw mk_runtime_error(fmt::format(
"Number of indices ({}) does not match the number of dimensions ({}).",
indices.size(),
this->shape.num_dims());
this->shape.num_dims()));
}

size_t offset = 0;
Expand All @@ -125,11 +125,11 @@ size_t GenericTensorAccessorR::calculate_index_offset(
cur_idx = *it--;

if (cur_idx >= this->shape[legion_dim_t(i)]) {
throw mk_runtime_error("In {} dimension, attempting to access index {} "
throw mk_runtime_error(fmt::format("In {} dimension, attempting to access index {} "
"when only {} indexes exist",
i,
cur_idx,
this->shape[legion_dim_t(i)]);
this->shape[legion_dim_t(i)]));
}

offset += cur_idx * multiplier;
Expand Down

0 comments on commit f1f2698

Please sign in to comment.