LdcEqualsLdd correctly handle different num of tensor dims
@@ -269,7 +269,7 @@ private:
// Base template for ProblemKey
-// - stores the sizes
+// - stores the sizes and strides
// - supports hash generation and comparison for lookup
// TensileCreateLibrary.cpp will create a typedef for each specific problem, ie
// ProblemKey_Cijk_Ailk_Bljk_SB.
@@ -424,11 +424,11 @@ struct RandomDistance {
class ProblemType
{
public:
- ProblemType(const std::vector<int> &indicesFree,
- const std::vector<int> &indicesSummation,
- const std::vector<int> &indicesBatch,
- const std::vector<int> &indexAssignmentsA,
- const std::vector<int> &indexAssignmentsB)
+ ProblemType(const std::vector<unsigned> &indicesFree,
+ const std::vector<unsigned> &indicesSummation,
+ const std::vector<unsigned> &indicesBatch,
+ const std::vector<unsigned> &indexAssignmentsA,
+ const std::vector<unsigned> &indexAssignmentsB)
: _indicesFree(indicesFree),
_indicesSummation(indicesSummation),
_indicesBatch(indicesBatch),
@@ -437,22 +437,23 @@ public:
{
}
- int lastSummationIdx() const { return _indicesSummation.back(); };
- int free0Idx() const { return _indicesFree[0]; };
- int free1Idx() const { return _indicesFree[1]; };
- bool isBatchIdx(int idx) const {
+ unsigned lastSummationIdx() const { return _indicesSummation.back(); };
+ unsigned free0Idx() const { return _indicesFree[0]; };
+ unsigned free1Idx() const { return _indicesFree[1]; };
+ bool isBatchIdx(unsigned idx) const {
return std::find(_indicesBatch.begin(), _indicesBatch.end(), idx) != _indicesBatch.end();
};
+ unsigned numIndicesC() const { return _indicesFree.size() + _indicesBatch.size(); };
- const std::vector<int> indexAssignmentsA() const { return _indexAssignmentsA; }
- const std::vector<int> indexAssignmentsB() const { return _indexAssignmentsB; }
+ const std::vector<unsigned> indexAssignmentsA() const { return _indexAssignmentsA; }
+ const std::vector<unsigned> indexAssignmentsB() const { return _indexAssignmentsB; }
private:
- const std::vector<int> _indicesFree;
- const std::vector<int> _indicesSummation;
- const std::vector<int> _indicesBatch;
- const std::vector<int> _indexAssignmentsA;
- const std::vector<int> _indexAssignmentsB;
+ const std::vector<unsigned> _indicesFree;
+ const std::vector<unsigned> _indicesSummation;
+ const std::vector<unsigned> _indicesBatch;
+ const std::vector<unsigned> _indexAssignmentsA;
+ const std::vector<unsigned> _indexAssignmentsB;
};
@@ -532,8 +533,14 @@ struct ProblemProperties {
else
_approxSize = 99; // big enough
- _equalStrides = ((pdims.strideD(0) == pdims.strideC(0)) &&
- (pdims.strideD(1) == pdims.strideC(1)));
+ _equalStrides = true;
+ // Would need to fix for UseInitialStrides, if UseInitialStrides==1 then don't subtract 1
+ for (int i=0; i<props->numIndicesC()-1; i++) {
+ if (pdims.strideD(i) != pdims.strideC(i)) {
+ _equalStrides = false;
+ break;
+ }
+ }
_allBatchAStridesAreZero = 1;
int strideIdx = 0;
@@ -589,6 +596,8 @@ struct ProblemProperties {
check_print(_free1ElementMultiple, >=);
check_print(_approxSize, >=);
check_print(_equalStrides, ==);
+ check_print(_allBatchAStridesAreZero, >=);
+ check_print(_allBatchBStridesAreZero, >=);
#undef check_print
}
else
