This repository was archived by the owner on Apr 28, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 26
26
#include " tc/core/polyhedral/codegen.h"
27
27
#include " tc/core/polyhedral/cuda/codegen.h"
28
28
#include " tc/core/polyhedral/cuda/mapping_types.h"
29
+ #include " tc/core/polyhedral/exceptions.h"
29
30
#include " tc/core/polyhedral/memory_promotion.h"
30
31
#include " tc/core/polyhedral/schedule_isl_conversion.h"
31
32
#include " tc/core/polyhedral/schedule_transforms.h"
@@ -357,7 +358,14 @@ void emitReductionInit(
357
358
auto call = provide->values [0 ].as <Halide::Internal::Call>();
358
359
CHECK (call && call->is_intrinsic (tc2halide::kReductionUpdate ));
359
360
auto assoc = prove_associativity (provide->name , provide->args , call->args );
360
- CHECK (assoc.associative ());
361
+ if (!assoc.associative ()) {
362
+ std::stringstream ss;
363
+ ss << " Not associative: " << provide->name << " , provide: " ;
364
+ Halide::Internal::IRPrinter p (ss);
365
+ p.print (Halide::Internal::Stmt (provide));
366
+ ss << " \n Generated so far:\n " << context.ss .str ();
367
+ throw codegen::NotAssociativeError (ss.str ());
368
+ }
361
369
auto statementContext = CodegenStatementContext (context, stmtId);
362
370
CHECK_EQ (assoc.pattern .identities .size (), 1u );
363
371
detail::emitHalideExpr (assoc.pattern .identities [0 ], statementContext);
Original file line number Diff line number Diff line change @@ -64,5 +64,11 @@ struct GroupingError : public std::logic_error {
64
64
};
65
65
} // namespace promotion
66
66
67
+ namespace codegen {
68
+
69
+ struct NotAssociativeError : public std ::logic_error {
70
+ explicit NotAssociativeError (const std::string& s) : std::logic_error(s) {}
71
+ };
72
+ } // namespace codegen
67
73
} // namespace polyhedral
68
74
} // namespace tc
You can’t perform that action at this time.
0 commit comments