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

Commit 7ecfcc2

Browse files
Namespace cpu::MappedScop to avoid collisions
@ftynse reported segfaults due to improper namespacing. Isolate the cpu MappedScop in its own namespace.
1 parent 1499725 commit 7ecfcc2

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

tc/core/polyhedral/cpu/mapped_scop.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
namespace tc {
3939
namespace polyhedral {
40+
namespace cpu {
4041

4142
std::unique_ptr<Jit> MappedScop::codegen(
4243
const std::string& specializedName) const {
@@ -89,5 +90,6 @@ std::unique_ptr<MappedScop> MappedScop::makeSequential(
8990
return mappedScop;
9091
}
9192

93+
} // namespace cpu
9294
} // namespace polyhedral
9395
} // namespace tc

tc/core/polyhedral/cpu/mapped_scop.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
namespace tc {
3131
namespace polyhedral {
32+
namespace cpu {
3233

3334
class MappedScop {
3435
private:
@@ -70,5 +71,7 @@ class MappedScop {
7071
public:
7172
const uint64_t unroll;
7273
};
74+
75+
} // namespace cpu
7376
} // namespace polyhedral
7477
} // namespace tc

test/test_mapper_llvm.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def fun(float(N, M) A, float(N, M) B) -> (C) {
4848
auto ctx = isl::with_exceptions::globalIslCtx();
4949
auto scop = polyhedral::Scop::makeScop(ctx, tc);
5050
scop = Scop::makeSpecializedScop<int>(*scop, {{"N", N}, {"M", M}});
51-
auto mscop = MappedScop::makeSequential(
51+
auto mscop = cpu::MappedScop::makeSequential(
5252
std::move(scop), CpuMappingOptions::makeNaiveMappingOptions());
5353
auto pJit = mscop->codegen("kernel_anon");
5454
auto fptr = reinterpret_cast<void (*)(float*, float*, float*, int, int)>(
@@ -89,7 +89,7 @@ TEST(LLVMCodegen, MultiStmt) {
8989
auto scop = polyhedral::Scop::makeScop(ctx, tc);
9090
scop = Scop::makeSpecializedScop<int>(
9191
*scop, {{"N", N}, {"M", M}, {"K", K}, {"L", L}});
92-
auto mscop = MappedScop::makeSequential(
92+
auto mscop = cpu::MappedScop::makeSequential(
9393
std::move(scop), CpuMappingOptions::makeNaiveMappingOptions());
9494
auto pJit = mscop->codegen("kernel_anon");
9595
auto fptr = reinterpret_cast<void (*)(
@@ -170,7 +170,7 @@ def batch_matmul(float(B, N, M) X, float(B, M, K) Y) -> (Z) {
170170
auto scop = polyhedral::Scop::makeScop(ctx, tc);
171171
scop = Scop::makeSpecializedScop<int>(
172172
*scop, {{"N", N}, {"M", M}, {"K", K}, {"B", B}});
173-
auto mscop = MappedScop::makeSequential(
173+
auto mscop = cpu::MappedScop::makeSequential(
174174
std::move(scop), CpuMappingOptions::makeNaiveMappingOptions());
175175
auto pJit = mscop->codegen("batch_matmul");
176176
auto fptr =
@@ -220,7 +220,7 @@ def convolution(float(N,C,H,W) I, float(O,C,KH,KW) W1, float(O) B) -> (tmp, O1)
220220
{"W", W},
221221
{"KW", KW},
222222
{"C", C}});
223-
auto mscop = MappedScop::makeSequential(
223+
auto mscop = cpu::MappedScop::makeSequential(
224224
std::move(scop), CpuMappingOptions::makeNaiveMappingOptions());
225225
auto pJit = mscop->codegen("convolution");
226226
auto fptr = reinterpret_cast<void (*)(
@@ -274,7 +274,7 @@ def concat(float(M, N) A, float(M, N) B) -> (O1) {
274274
auto ctx = isl::with_exceptions::globalIslCtx();
275275
auto scop = polyhedral::Scop::makeScop(ctx, tc);
276276
scop = Scop::makeSpecializedScop<int>(*scop, {{"N", N}, {"M", M}});
277-
auto mscop = MappedScop::makeSequential(
277+
auto mscop = cpu::MappedScop::makeSequential(
278278
std::move(scop), CpuMappingOptions::makeNaiveMappingOptions());
279279
auto pJit = mscop->codegen("concat");
280280
auto fptr = reinterpret_cast<void (*)(float*, float*, float*, int, int)>(

0 commit comments

Comments
 (0)