Add comments and debug for LeadingFreeSizesGreaterOrEqual
Explain expanded role, may rename later
@@ -176,6 +176,7 @@ namespace Tensile
}
};
+ // If the tensor contains no free dimensions, then the first batch dimension serves as the leading free size
struct LeadingFreeSizesGreaterOrEqual: public Predicate_CRTP<LeadingFreeSizesGreaterOrEqual, ContractionProblem>
{
enum { HasIndex = false, HasValue = true };
@@ -188,12 +189,26 @@ namespace Tensile
virtual bool operator()(ContractionProblem const& problem) const override
{
+ assert(problem.batchIndices().size() <= 1);
// TODO: this is not quite right since it assumes batchSize(0) is lowest order in index assignments
// If tensor contains multiple batch dims this may not be true.
// Really should modify Contractions.py to select SizeN >= value, based on desired index requirement
return (problem.freeIndicesA().size() ? problem.freeSizeA(0) >= value : problem.batchSize(0) >= value)
&& (problem.freeIndicesB().size() ? problem.freeSizeB(0) >= value : problem.batchSize(0) >= value);
}
+ virtual bool debugEval(ContractionProblem const& problem, std::ostream & stream) const override
+ {
+ bool rv = (*this)(problem);
+
+ stream << *this << ": ("
+ << (problem.freeIndicesA().size() ? "freeA0:":"batchA0:")
+ << (problem.freeIndicesA().size() ? problem.freeSizeA(0) : problem.batchSize(0)) << " >= " << value << " && "
+ << (problem.freeIndicesB().size() ? "freeB0:":"batchB0:")
+ << (problem.freeIndicesB().size() ? problem.freeSizeB(0) : problem.batchSize(0)) << " >= " << value
+ << ") == " << rv;
+
+ return rv;
+ }
};
struct SizeEqual: public Predicate_CRTP<SizeEqual, ContractionProblem>
