Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 020faf0

Browse files
author
Nicolas Vasilache
committed
Compilation fix for -Werror=shadow-compatible-local
1 parent 7e92e1a commit 020faf0

File tree

3 files changed

+35
-32
lines changed

3 files changed

+35
-32
lines changed

tc/core/polyhedral/codegen_llvm.cc

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -614,31 +614,32 @@ IslCodegenRes codegenISL(const Scop& scop) {
614614
auto collectIteratorMaps =
615615
[](isl::ast_node node,
616616
isl::ast_build build,
617-
IteratorMapsType& iteratorMaps,
618-
const Scop& scop,
619-
StmtSubscriptExprMapType& stmtSubscripts) -> isl::ast_node {
617+
IteratorMapsType& iteratorMapsInFun,
618+
const Scop& scopInFun,
619+
StmtSubscriptExprMapType& stmtSubscriptsInFun) -> isl::ast_node {
620620
auto user = node.as<isl::ast_node_user>();
621621
CHECK(user);
622622
auto expr = user.get_expr().as<isl::ast_expr_op>();
623623
auto schedule = build.get_schedule();
624624
auto scheduleMap = isl::map::from_union_map(schedule);
625625

626626
auto stmtId = expr.get_arg(0).as<isl::ast_expr_id>().get_id();
627-
CHECK_EQ(0u, iteratorMaps.count(stmtId)) << "entry exists: " << stmtId;
627+
CHECK_EQ(0u, iteratorMapsInFun.count(stmtId))
628+
<< "entry exists: " << stmtId;
628629
auto iteratorMap = isl::pw_multi_aff(scheduleMap.reverse());
629-
auto iterators = scop.halide.iterators.at(stmtId);
630-
auto& stmtIteratorMap = iteratorMaps[stmtId];
630+
auto iterators = scopInFun.halide.iterators.at(stmtId);
631+
auto& stmtIteratorMap = iteratorMapsInFun[stmtId];
631632
for (size_t i = 0; i < iterators.size(); ++i) {
632633
auto expr = build.expr_from(iteratorMap.get_pw_aff(i));
633634
stmtIteratorMap.emplace(iterators[i], expr);
634635
}
635-
auto& subscripts = stmtSubscripts[stmtId];
636-
auto provide =
637-
scop.halide.statements.at(stmtId).as<Halide::Internal::Provide>();
636+
auto& subscripts = stmtSubscriptsInFun[stmtId];
637+
auto provide = scopInFun.halide.statements.at(stmtId)
638+
.as<Halide::Internal::Provide>();
638639
for (auto e : provide->args) {
639640
const auto& map = iteratorMap;
640641
auto space = map.get_space().params();
641-
auto aff = scop.makeIslAffFromStmtExpr(stmtId, space, e);
642+
auto aff = scopInFun.makeIslAffFromStmtExpr(stmtId, space, e);
642643
auto pulled = isl::pw_aff(aff).pullback(map);
643644
CHECK_EQ(pulled.n_piece(), 1);
644645
subscripts.push_back(build.expr_from(pulled));

tc/core/polyhedral/cuda/mapped_scop.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,16 @@ isl::union_set modifyMappingNames(
463463
space = space.set_dim_name(isl::dim_type::param, dim, name + suffix);
464464
}
465465
auto newSet = isl::union_set::empty(space);
466-
set.foreach_set([&newSet, &identifiers, &suffix](isl::set set) {
466+
set.foreach_set([&newSet, &identifiers, &suffix](isl::set setInFun) {
467467
for (auto id : identifiers) {
468468
auto name = id.get_name();
469-
auto dim = set.get_space().find_dim_by_name(isl::dim_type::param, name);
469+
auto dim =
470+
setInFun.get_space().find_dim_by_name(isl::dim_type::param, name);
470471
CHECK_LE(0, dim);
471-
set = set.set_dim_name(isl::dim_type::param, dim, name + suffix);
472+
setInFun =
473+
setInFun.set_dim_name(isl::dim_type::param, dim, name + suffix);
472474
}
473-
newSet = newSet.unite(set);
475+
newSet = newSet.unite(setInFun);
474476
});
475477
return newSet;
476478
}

test/cuda/test_tc_mapper.cc

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,10 @@ def batch_triple_hadamard(float(B, D) U, float(B, D) V, float(B, D) W) -> (Z) {
260260
}
261261
)TC";
262262

263-
auto checkFun = [=](const std::vector<at::Tensor>& inputs,
264-
std::vector<at::Tensor>& outputs) {
265-
at::Tensor diff = outputs[0].sub(inputs[0] * inputs[1] * inputs[2]);
266-
checkRtol(diff, inputs, D);
263+
auto checkFun = [=](const std::vector<at::Tensor>& ins,
264+
std::vector<at::Tensor>& outs) {
265+
at::Tensor diff = outs[0].sub(ins[0] * ins[1] * ins[2]);
266+
checkRtol(diff, ins, D);
267267
};
268268
Check(
269269
TC,
@@ -289,8 +289,8 @@ def tensordot(float(N, C1, C2, H, W) I0, float(N, C2, C3, H, W) I1) -> (O) {
289289
}
290290
)TC";
291291
// No defaults for this case
292-
auto checkFun = [](const std::vector<at::Tensor>& inputs,
293-
std::vector<at::Tensor>& outputs) { return true; };
292+
auto checkFun = [](const std::vector<at::Tensor>& ins,
293+
std::vector<at::Tensor>& outs) { return true; };
294294
auto options = tc::CudaMappingOptions::makeNaiveMappingOptions();
295295
auto name = "tensordot";
296296
Check(TC, name, options, inputs, checkFun);
@@ -314,13 +314,13 @@ def fun(float(B, R) LUT, int32(B, N) I) -> (O) {
314314
}
315315
)TC";
316316

317-
auto checkFun = [=](const std::vector<at::Tensor>& inputs,
318-
std::vector<at::Tensor>& outputs) {
319-
at::Tensor LUT = inputs[0].toBackend(at::kCPU);
320-
at::Tensor I = inputs[1].toBackend(at::kCPU);
321-
at::Tensor O = outputs[0].toBackend(at::kCPU);
322-
auto LUTAccessor = LUT.accessor<float, 2>();
323-
auto IAccessor = I.accessor<int, 2>();
317+
auto checkFun = [=](const std::vector<at::Tensor>& ins,
318+
std::vector<at::Tensor>& outs) {
319+
at::Tensor lut = ins[0].toBackend(at::kCPU);
320+
at::Tensor in = ins[1].toBackend(at::kCPU);
321+
at::Tensor O = outs[0].toBackend(at::kCPU);
322+
auto LUTAccessor = lut.accessor<float, 2>();
323+
auto IAccessor = in.accessor<int, 2>();
324324
auto OAccessor = O.accessor<float, 2>();
325325
for (int b = 0; b < B; b++) {
326326
for (int n = 0; n < N; n++) {
@@ -334,7 +334,7 @@ def fun(float(B, R) LUT, int32(B, N) I) -> (O) {
334334
}
335335
}
336336

337-
checkRtol(O, inputs, 5e-7);
337+
checkRtol(O, ins, 5e-7);
338338
};
339339
Check(
340340
TC,
@@ -378,8 +378,8 @@ def spatial_batch_norm(
378378
normalizedOut(n, c, h, w) = O(n, c, h, w)
379379
})TC";
380380

381-
auto checkFun = [=](const std::vector<at::Tensor>& inputs,
382-
std::vector<at::Tensor>& outputs) {
381+
auto checkFun = [=](const std::vector<at::Tensor>& ins,
382+
std::vector<at::Tensor>& outs) {
383383
TC_CUDA_RUNTIMEAPI_ENFORCE(cudaDeviceSynchronize());
384384
double prec = 3e-7;
385385
std::cout << "Checking expected output relative precision @" << prec;
@@ -396,8 +396,8 @@ def spatial_batch_norm(
396396
at::Scalar(momentum[0]).toFloat(),
397397
at::Scalar(eps[0]).toFloat(),
398398
true);
399-
auto diff = O.sub(outputs[0]);
400-
checkRtol(diff, inputs, N * H * W, prec);
399+
auto diff = O.sub(outs[0]);
400+
checkRtol(diff, ins, N * H * W, prec);
401401
};
402402

403403
auto name = "spatial_batch_norm";

0 commit comments

Comments
 (0)