Skip to content

Commit

Permalink
Improve asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
mcourteaux committed Jan 30, 2025
1 parent c323d01 commit ea4d9bb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/CodeGen_GPU_Dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@ void CodeGen_GPU_C::visit(const Shuffle *op) {

std::vector<std::string> vecs;
for (const Expr &v : op->vectors) {
std::string expr = print_expr(v);
internal_assert(!expr.empty()) << "Expression did not serialize.";
vecs.push_back(std::move(expr));
vecs.push_back(print_expr(v));
}

std::string src = vecs[0];
Expand All @@ -190,8 +188,8 @@ void CodeGen_GPU_C::visit(const Shuffle *op) {
break;
}
}
internal_assert(lane_idx != -1) << "Shuffle lane index not found.";
internal_assert(vector_idx < op->vectors.size()) << "Shuffle vector index not found.";
internal_assert(lane_idx != -1) << "Shuffle lane index not found: i=" << i;
internal_assert(vector_idx < op->vectors.size()) << "Shuffle vector index not found: i=" << i << ", lane=" << lane_idx;
rhs << vecs[vector_idx];
if (op->vectors[vector_idx].type().lanes() > 1) {
switch (vector_declaration_style) {
Expand Down

0 comments on commit ea4d9bb

Please sign in to comment.