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

Commit feed0a4

Browse files
committed
add primitive test for register promotion not crashing
1 parent c133cb5 commit feed0a4

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/test_mapper_memory_promotion.cc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,31 @@ TEST_F(MapperMemoryPromotionRAW, throwIfCopiesBelowThreads) {
455455
promotion::PromotionBelowThreadsException);
456456
}
457457

458+
class MatMulBias : public TestMapper {
459+
public:
460+
std::string emitCode(
461+
const std::unordered_map<std::string, size_t>& parameters,
462+
const std::vector<size_t>& tileSizes) {
463+
std::string tc = R"TC(
464+
def fun(float(N,K) A, float(K,M) B, float(N,M) C) -> (O) {
465+
O(i,j) +=! A(i,k) * B(k,j)
466+
O(i,j) = O(i,j) + C(i,j)
467+
}
468+
)TC";
469+
470+
auto mappingOptions = MappingOptions::makeNaiveMappingOptions()
471+
.tile(tileSizes)
472+
.useSharedMemory(false)
473+
.usePrivateMemory(true);
474+
auto mscop = makeMappedScop(tc, mappingOptions, parameters);
475+
return std::get<0>(mscop->codegen("fun"));
476+
}
477+
};
478+
479+
TEST_F(MatMulBias, RegisterPromotion) {
480+
emitCode({{"N", 42}, {"M", 56}, {"K", 37}}, {32, 32, 32});
481+
}
482+
458483
int main(int argc, char** argv) {
459484
::testing::InitGoogleTest(&argc, argv);
460485
::gflags::ParseCommandLineFlags(&argc, &argv, true);

0 commit comments

Comments
 (0)